rail.tools.photometry_tools module
Module that implements operations on photometric data such as magnitudes and fluxes.
- class rail.tools.photometry_tools.Dereddener
Bases:
DustMapBaseUtility stage that does dereddening
- Parameters:
output_mode ([str] default=default) – What to do with the outputs. The options are ‘default’, where outputs will be written to files and some returned, and ‘return’, where outputs will only be returned and not written.
ra_name ([str] default=ra) – Name of the RA column
dec_name ([str] default=dec) – Name of the DEC column
mag_name ([str] default=mag_{band}_lsst) – Template for the magnitude columns
band_a_env (dict] (default={'mag_u_lsst': 4.81, 'mag_g_lsst': 3.64, 'mag_r_lsst': 2.7, 'mag_i_lsst': 2.06, 'mag_z_lsst': 1.58, 'mag_y_lsst': 1.31}))
dustmap_name ([str] default=sfd) – Name of the dustmap in question
dustmap_dir ([str] (required)) – Directory with dustmaps
copy_cols ([list] default=[]) – Additional columns to copy
copy_all_cols ([bool] default=False) – Copy all the columns
input (PqHandle (INPUT))
output (PqHandle (OUTPUT))
- entrypoint_function: str | None = '__call__'
- interactive_function: str | None = 'dereddener'
- name = 'Dereddener'
- stage_columns: list[str] | None
- class rail.tools.photometry_tools.DustMapBase
Bases:
RailStageUtility stage that does dereddening
Note: set copy_all_cols=True to copy all columns in data, copy_cols will be ignored
- Parameters:
output_mode ([str] default=default) – What to do with the outputs. The options are ‘default’, where outputs will be written to files and some returned, and ‘return’, where outputs will only be returned and not written.
ra_name ([str] default=ra) – Name of the RA column
dec_name ([str] default=dec) – Name of the DEC column
mag_name ([str] default=mag_{band}_lsst) – Template for the magnitude columns
band_a_env (dict] (default={'mag_u_lsst': 4.81, 'mag_g_lsst': 3.64, 'mag_r_lsst': 2.7, 'mag_i_lsst': 2.06, 'mag_z_lsst': 1.58, 'mag_y_lsst': 1.31}))
dustmap_name ([str] default=sfd) – Name of the dustmap in question
dustmap_dir ([str] (required)) – Directory with dustmaps
copy_cols ([list] default=[]) – Additional columns to copy
copy_all_cols ([bool] default=False) – Copy all the columns
input (PqHandle (INPUT))
output (PqHandle (OUTPUT))
- entrypoint_function: str | None = '__call__'
- fetch_map()
- inputs = [('input', <class 'rail.core.data.PqHandle'>)]
- interactive_function: str | None = 'dust_map_base'
- name = 'DustMapBase'
- outputs = [('output', <class 'rail.core.data.PqHandle'>)]
- run()
Run the stage and return the execution status.
Subclasses must implemented this method.
- stage_columns: list[str] | None
- class rail.tools.photometry_tools.HyperbolicMagnitudes
Bases:
PhotometryManipulatorConvert a set of classical magnitudes to hyperbolic magnitudes (Lupton et al. 1999). Requires input from the initial stage (HyperbolicSmoothing) to supply optimal values for the smoothing parameters (b).
- Parameters:
output_mode ([str] default=default) – What to do with the outputs. The options are ‘default’, where outputs will be written to files and some returned, and ‘return’, where outputs will only be returned and not written.
value_columns ([list] default=['mag_u_lsst', 'mag_g_lsst', 'mag_r_lsst', 'mag_i_lsst', 'mag_z_lsst', 'mag_y_lsst']) – list of columns that prove photometric measurements (fluxes or magnitudes)
error_columns ([list] default=['mag_err_u_lsst', 'mag_err_g_lsst', 'mag_err_r_lsst', 'mag_err_i_lsst', 'mag_err_z_lsst', 'mag_err_y_lsst']) – list of columns with errors corresponding to value_columns (assuming same ordering)
zeropoints ([list] default=[]) – optional list of magnitude zeropoints for value_columns (assuming same ordering, defaults to 0.0)
is_flux ([bool] default=False) – whether the provided quantities are fluxes or magnitudes
input (PqHandle (INPUT))
parameters (PqHandle (INPUT))
output (PqHandle (OUTPUT))
- compute(data, parameters, **kwargs)
Main method to call. Outputs hyperbolic magnitudes compuated from a set of smoothing parameters and input catalogue with classical magitudes and their respective errors.
- Parameters:
data (PqHandle) – Input table with photometry (magnitudes or flux columns and their respective uncertainties) as defined by the configuration.
parameters (PqHandle) – Table witdh smoothing parameters per photometric band, determined by HyperbolicSmoothing.
- Returns:
Output table containting hyperbolic magnitudes and their uncertainties. If the columns in the input table contain a prefix mag_, this output tabel will replace the prefix with hyp_mag_, otherwise the column names will be identical to the input table.
- Return type:
- entrypoint_function: str | None = 'compute'
- inputs = [('input', <class 'rail.core.data.PqHandle'>), ('parameters', <class 'rail.core.data.PqHandle'>)]
- interactive_function: str | None = 'hyperbolic_magnitudes'
- name = 'HyperbolicMagnitudes'
- outputs = [('output', <class 'rail.core.data.PqHandle'>)]
- run()
Compute hyperbolic magnitudes and their error based on the parameters determined by HyperbolicSmoothing.
- stage_columns: list[str] | None
- class rail.tools.photometry_tools.HyperbolicSmoothing
Bases:
PhotometryManipulatorInitial stage to compute hyperbolic magnitudes (Lupton et al. 1999). Estimates the smoothing parameter b that is used by the second stage (HyperbolicMagnitudes) to convert classical to hyperbolic magnitudes.
- Parameters:
output_mode ([str] default=default) – What to do with the outputs. The options are ‘default’, where outputs will be written to files and some returned, and ‘return’, where outputs will only be returned and not written.
value_columns ([list] default=['mag_u_lsst', 'mag_g_lsst', 'mag_r_lsst', 'mag_i_lsst', 'mag_z_lsst', 'mag_y_lsst']) – list of columns that prove photometric measurements (fluxes or magnitudes)
error_columns ([list] default=['mag_err_u_lsst', 'mag_err_g_lsst', 'mag_err_r_lsst', 'mag_err_i_lsst', 'mag_err_z_lsst', 'mag_err_y_lsst']) – list of columns with errors corresponding to value_columns (assuming same ordering)
zeropoints ([list] default=[]) – optional list of magnitude zeropoints for value_columns (assuming same ordering, defaults to 0.0)
is_flux ([bool] default=False) – whether the provided quantities are fluxes or magnitudes
input (PqHandle (INPUT))
parameters (PqHandle (OUTPUT))
- compute(data, **kwargs)
Main method to call. Computes the set of smoothing parameters (b) for an input catalogue with classical photometry and their respective errors. These parameters are required by the follow-up stage HyperbolicMagnitudes and are parsed as tabular data.
- Parameters:
data (PqHandle) – Input table with magnitude and magnitude error columns as defined in the configuration.
- Returns:
Table with smoothing parameters per photometric band and additional meta data.
- Return type:
- entrypoint_function: str | None = 'compute'
- inputs = [('input', <class 'rail.core.data.PqHandle'>)]
- interactive_function: str | None = 'hyperbolic_smoothing'
- name = 'HyperbolicSmoothing'
- outputs = [('parameters', <class 'rail.core.data.PqHandle'>)]
- run()
Computes the smoothing parameter b (see Lupton et al. 1999) per photometric band.
- stage_columns: list[str] | None
- class rail.tools.photometry_tools.LSSTFluxToMagConverter
Bases:
RailStageUtility stage that converts from fluxes to magnitudes
Note, this is hardwired to take parquet files as input and provide hdf5 files as output
- Parameters:
output_mode ([str] default=default) – What to do with the outputs. The options are ‘default’, where outputs will be written to files and some returned, and ‘return’, where outputs will only be returned and not written.
bands ([list] default=['u', 'g', 'r', 'i', 'z', 'y']) – Names of the bands
flux_name ([str] default={band}_gaap1p0Flux) – Template for band names
flux_err_name ([str] default={band}_gaap1p0FluxErr) – Template for band error column names
mag_name ([str] default=mag_{band}_lsst) – Template for magnitude column names
mag_err_name ([str] default=mag_err_{band}_lsst) – Template for magnitude error column names
copy_col_dict ([dict] default={}) – Map of other columns to copy
mag_offset ([float] default=31.4) – Magntidue offset value
input (PqHandle (INPUT))
output (PqHandle (OUTPUT))
- entrypoint_function: str | None = '__call__'
- inputs = [('input', <class 'rail.core.data.PqHandle'>)]
- interactive_function: str | None = 'lsst_flux_to_mag_converter'
- mag_conv = np.float64(0.9210340371976184)
- name = 'LSSTFluxToMagConverter'
- outputs = [('output', <class 'rail.core.data.PqHandle'>)]
- run()
Run the stage and return the execution status.
Subclasses must implemented this method.
- stage_columns: list[str] | None
- class rail.tools.photometry_tools.PhotometryManipulator
Bases:
RailStage,ABCBase class to perform opertations on magnitudes. A table with input magnitudes and errors is processed and transformed into an output table with new magnitudes and errors.
Subclasses must implement the run() and compute() method.
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- abstractmethod compute(data)
Main method to call.
- Parameters:
data (PqHandle) – Input tabular data with column names as defined in the configuration.
- Returns:
Output tabular data.
- Return type:
- entrypoint_function: str | None = 'compute'
- get_as_fluxes()
Loads specified photometric data as fluxes, converting magnitudes on the fly.
- inputs = [('input', <class 'rail.core.data.PqHandle'>)]
- interactive_function: str | None = 'photometry_manipulator'
- name = 'PhotometryManipulator'
- outputs = [('output', <class 'rail.core.data.PqHandle'>)]
- abstractmethod run()
Implements the operation performed on the photometric data.
- class rail.tools.photometry_tools.Reddener
Bases:
DustMapBaseUtility stage that does reddening
- Parameters:
output_mode ([str] default=default) – What to do with the outputs. The options are ‘default’, where outputs will be written to files and some returned, and ‘return’, where outputs will only be returned and not written.
ra_name ([str] default=ra) – Name of the RA column
dec_name ([str] default=dec) – Name of the DEC column
mag_name ([str] default=mag_{band}_lsst) – Template for the magnitude columns
band_a_env (dict] (default={'mag_u_lsst': 4.81, 'mag_g_lsst': 3.64, 'mag_r_lsst': 2.7, 'mag_i_lsst': 2.06, 'mag_z_lsst': 1.58, 'mag_y_lsst': 1.31}))
dustmap_name ([str] default=sfd) – Name of the dustmap in question
dustmap_dir ([str] (required)) – Directory with dustmaps
copy_cols ([list] default=[]) – Additional columns to copy
copy_all_cols ([bool] default=False) – Copy all the columns
input (PqHandle (INPUT))
output (PqHandle (OUTPUT))
- entrypoint_function: str | None = '__call__'
- interactive_function: str | None = 'reddener'
- name = 'Reddener'
- stage_columns: list[str] | None