Tools
The tools namespace is not a type of RAIL stage, but it is called in the same way. It is a collection of many utility modules for operations and calculations on photometry, catalogs, and more.
Tools API
Column Mapper
RAIL Package: https://github.com/LSSTDESC/rail_base
- class rail.tools.table_tools.ColumnMapper
Utility stage that remaps the names of columns.
This operates on pandas dataframs in parquet files.
2. In short, this does: output_data = input_data.rename(columns=self.config.columns, in_place=self.config.in_place)
- 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.
columns ([dict] (required)) – Map of columns to rename
in_place ([bool] default=False) – Update file in place
input (PqHandle (INPUT))
output (PqHandle (OUTPUT))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- classmethod __new__(*args, **kwargs)
Row Selector
RAIL Package: https://github.com/LSSTDESC/rail_base
- class rail.tools.table_tools.RowSelector
Utility Stage that sub-selects rows from a table by index
This operates on pandas dataframs in parquet files.
2. In short, this does: output_data = input_data[self.config.start_row:self.config.stop_row]
- 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.
start_row ([int] (required)) – starting row number
stop_row ([int] (required)) – Stoppig row number
input (PqHandle (INPUT))
output (PqHandle (OUTPUT))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- classmethod __new__(*args, **kwargs)
Table Converter
RAIL Package: https://github.com/LSSTDESC/rail_base
- class rail.tools.table_tools.TableConverter
Utility stage that converts tables from one format to anothe
FIXME, this is hardwired to convert parquet tables to Hdf5Tables. It would be nice to have more options here.
- 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.
output_format ([str] (required)) – Format of output table
input (PqHandle (INPUT))
output (Hdf5Handle (OUTPUT))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- classmethod __new__(*args, **kwargs)
Reddener
RAIL Package: https://github.com/LSSTDESC/rail_astro_tools
- class rail.tools.photometry_tools.Reddener
Utility 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))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- classmethod __new__(*args, **kwargs)
Dereddener
RAIL Package: https://github.com/LSSTDESC/rail_astro_tools
- class rail.tools.photometry_tools.Dereddener
Utility 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))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- classmethod __new__(*args, **kwargs)
Dust Map Base
RAIL Package: https://github.com/LSSTDESC/rail_astro_tools
- class rail.tools.photometry_tools.DustMapBase
Utility 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))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- classmethod __new__(*args, **kwargs)
Hyperbolic Magnitudes
RAIL Package: https://github.com/LSSTDESC/rail_astro_tools
- class rail.tools.photometry_tools.HyperbolicMagnitudes
Convert 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))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- classmethod __new__(*args, **kwargs)
Hyperbolic Smoothing
RAIL Package: https://github.com/LSSTDESC/rail_astro_tools
- class rail.tools.photometry_tools.HyperbolicSmoothing
Initial 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))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- classmethod __new__(*args, **kwargs)
LSST Flux To Magnitude Converter
RAIL Package: https://github.com/LSSTDESC/rail_astro_tools
- class rail.tools.photometry_tools.LSSTFluxToMagConverter
Utility 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_cols ([dict] default={}) – Map of other columns to copy
mag_offset ([float] default=31.4) – Magntidue offset value
input (PqHandle (INPUT))
output (PqHandle (OUTPUT))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- classmethod __new__(*args, **kwargs)
Photometry Manipulator
RAIL Package: https://github.com/LSSTDESC/rail_astro_tools
- class rail.tools.photometry_tools.PhotometryManipulator
Base 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
- classmethod __new__(*args, **kwargs)
Flow Handle
RAIL Package: https://github.com/LSSTDESC/rail_pzflow
- class rail.tools.flow_handle.FlowHandle
A wrapper around a file that describes a PZFlow object
- __init__(tag, data=None, path=None, creator=None)
Constructor
- Parameters:
tag (str) – The tag under which this data handle can be found in the store
data (DataLike | None) – The associated data
path (str | None) – The path to the associated file
creator (str | None) – The name of the stage that created this data handle
- Return type:
None
- classmethod __new__(*args, **kwargs)