Coverage for hiperta_stream/plots/plotting_utils.py: 0%
12 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-07-16 10:16 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-07-16 10:16 +0000
1#!/usr/bin/env python
3import subprocess as sp
4from pathlib import Path
7def create_r0_calib_plots(base_config_file, output_directory):
8 """
9 Run `rta_plot_r0_calib` entry point on the base structure hdf5 config file
11 :param base_config_file: str
12 Path to base structure hdf5 config file
13 :param output_directory: str
14 Path to output directory
15 """
16 print(f'\n====== Starting creation of r0 calibration plots')
17 parse_run = base_config_file.name.split("_")[-1].split(".")[0]
18 r0_calib_plot_file = Path(output_directory,
19 f'output_r0_calib_plot_{parse_run}.pdf')
21 cmd_plot_ro = ['rta_plot_r0_calib',
22 '-i', f'{base_config_file.absolute().as_posix()}',
23 '-o', f'{r0_calib_plot_file.absolute().as_posix()}']
25 answer = sp.run(cmd_plot_ro)
27 if answer.returncode == 0:
28 print(f'====== r0 calibration plot file successfully created: {r0_calib_plot_file.name}')
29 return r0_calib_plot_file
30 else:
31 raise ChildProcessError(" !! r0 calibration plots not correctly created!")