Loading etl/prs/prs_compute_integrated_fluxes_and_ratios.py +40 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,15 @@ def populate_mom_zero_table(config_prs: dict, aggregated_moment_zero: float, executed_on: datetime.timestamp, engine: sqlalchemy.engine): """ Insert record in DB for the moment zero table :param config_prs: configuration of the presentation layer :param fits_cube_name: name of the fits cube :param moment_zero_map_fits: filename of the moment zero map :param aggregated_moment_zero: the aggregated value of the moment zero :param executed_on: timestamp of execution :param engine: SQLAlchemy engine to use """ _integration_limit_low = get_value_if_specified(config_prs, 'integration_limits')[0] if get_value_if_specified( config_prs, 'integration_limits') != 'all' else None _integration_limit_high = get_value_if_specified(config_prs, 'integration_limits')[1] if get_value_if_specified( Loading Loading @@ -48,6 +57,15 @@ def populate_line_ratios_table(config_prs: dict, aggregated_ratio: float, engine: sqlalchemy.engine, executed_on: datetime.timestamp): """ Insert record in DB for the line ratios table :param config_prs: configuration of the presentation layer :param moment_zero_map_fits_list: list of the moment 0 maps to use to compute the ratio :param ratio_map_name: filename of the ratio map :param aggregated_ratio: aggregated value of the ratio :param engine: SQLAlchemy engine to use :param executed_on: timestamp of execution """ _integration_limit_low = get_value_if_specified(config_prs, 'integration_limits')[0] if get_value_if_specified( config_prs, 'integration_limits') != 'all' else None _integration_limit_high = get_value_if_specified(config_prs, 'integration_limits')[1] if get_value_if_specified( Loading Loading @@ -75,6 +93,16 @@ def compute_moment_zero(cube: str, moment_zero_path: Union[str, None] = None, moment_zero_fits_name: Union[str, None] = None, hdu_idx: int = 0) -> float: """ Compute moment zero map, given a cube :param cube: filename of the fits cube :param config: configuration of the presentation layer :param cube_path: path where the fits cube is to be found :param moment_zero_path: path where the moment 0 map is to be saved :param moment_zero_fits_name: filename for the moment zero map :param hdu_idx: index of the HDU to extract the data and the header :return: the aggregated value of the moment zero, according to the function specified in the configuration """ _cube_path = validate_parameter(cube_path, default=os.path.join('prs', 'fits', 'cubes')) _moment_zero_path = validate_parameter(moment_zero_path, default=os.path.join('prs', 'fits', 'moments')) _moment_zero_fits_name = validate_parameter(moment_zero_fits_name, default='test_mom0.fits') Loading Loading @@ -111,6 +139,18 @@ def compute_image_ratios(fits1: str, ratio_fits_name: Union[str, None] = None, hdu1_idx: int = 0, hdu2_idx: int = 0): """ Compute the ratio of the images and save it to fits. The ratio is computed as fits1/fits2 :param fits1: filename of the first moment 0 map :param fits2: filename of the second moment 0 map :param config: configuration of the presentation layer :param fits_path: path where the fits files are to be found :param ratio_fits_path: path where the ratio map is to be saved :param ratio_fits_name: filename for the ratio map :param hdu1_idx: index of the HDU to extract the data and the header, for the first fits file :param hdu2_idx: index of the HDU to extract the data and the header, for the second fits file :return: """ _fits_path = validate_parameter(fits_path, default=os.path.join('prs', 'fits', 'moments')) _ratio_fits_path = validate_parameter(ratio_fits_path, default=os.path.join('prs', 'fits', 'ratios')) _ratio_fits_name = validate_parameter(ratio_fits_name, default='ratio.fits') Loading Loading
etl/prs/prs_compute_integrated_fluxes_and_ratios.py +40 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,15 @@ def populate_mom_zero_table(config_prs: dict, aggregated_moment_zero: float, executed_on: datetime.timestamp, engine: sqlalchemy.engine): """ Insert record in DB for the moment zero table :param config_prs: configuration of the presentation layer :param fits_cube_name: name of the fits cube :param moment_zero_map_fits: filename of the moment zero map :param aggregated_moment_zero: the aggregated value of the moment zero :param executed_on: timestamp of execution :param engine: SQLAlchemy engine to use """ _integration_limit_low = get_value_if_specified(config_prs, 'integration_limits')[0] if get_value_if_specified( config_prs, 'integration_limits') != 'all' else None _integration_limit_high = get_value_if_specified(config_prs, 'integration_limits')[1] if get_value_if_specified( Loading Loading @@ -48,6 +57,15 @@ def populate_line_ratios_table(config_prs: dict, aggregated_ratio: float, engine: sqlalchemy.engine, executed_on: datetime.timestamp): """ Insert record in DB for the line ratios table :param config_prs: configuration of the presentation layer :param moment_zero_map_fits_list: list of the moment 0 maps to use to compute the ratio :param ratio_map_name: filename of the ratio map :param aggregated_ratio: aggregated value of the ratio :param engine: SQLAlchemy engine to use :param executed_on: timestamp of execution """ _integration_limit_low = get_value_if_specified(config_prs, 'integration_limits')[0] if get_value_if_specified( config_prs, 'integration_limits') != 'all' else None _integration_limit_high = get_value_if_specified(config_prs, 'integration_limits')[1] if get_value_if_specified( Loading Loading @@ -75,6 +93,16 @@ def compute_moment_zero(cube: str, moment_zero_path: Union[str, None] = None, moment_zero_fits_name: Union[str, None] = None, hdu_idx: int = 0) -> float: """ Compute moment zero map, given a cube :param cube: filename of the fits cube :param config: configuration of the presentation layer :param cube_path: path where the fits cube is to be found :param moment_zero_path: path where the moment 0 map is to be saved :param moment_zero_fits_name: filename for the moment zero map :param hdu_idx: index of the HDU to extract the data and the header :return: the aggregated value of the moment zero, according to the function specified in the configuration """ _cube_path = validate_parameter(cube_path, default=os.path.join('prs', 'fits', 'cubes')) _moment_zero_path = validate_parameter(moment_zero_path, default=os.path.join('prs', 'fits', 'moments')) _moment_zero_fits_name = validate_parameter(moment_zero_fits_name, default='test_mom0.fits') Loading Loading @@ -111,6 +139,18 @@ def compute_image_ratios(fits1: str, ratio_fits_name: Union[str, None] = None, hdu1_idx: int = 0, hdu2_idx: int = 0): """ Compute the ratio of the images and save it to fits. The ratio is computed as fits1/fits2 :param fits1: filename of the first moment 0 map :param fits2: filename of the second moment 0 map :param config: configuration of the presentation layer :param fits_path: path where the fits files are to be found :param ratio_fits_path: path where the ratio map is to be saved :param ratio_fits_name: filename for the ratio map :param hdu1_idx: index of the HDU to extract the data and the header, for the first fits file :param hdu2_idx: index of the HDU to extract the data and the header, for the second fits file :return: """ _fits_path = validate_parameter(fits_path, default=os.path.join('prs', 'fits', 'moments')) _ratio_fits_path = validate_parameter(ratio_fits_path, default=os.path.join('prs', 'fits', 'ratios')) _ratio_fits_name = validate_parameter(ratio_fits_name, default='ratio.fits') Loading