rail.creation.degraders.specz_som module
Selector that emulate specz selection with SOM
- class rail.creation.degraders.specz_som.SOMSpecSelector
Bases:
SelectorClass that creates a specz sample by training a SOM on data with spec-z, classifying all galaxies from a larger sample via the SOM, then selecting the same number of galaxies in each SOM cell as there are in the specz sample. If fewer galaxies are available in the large sample for a cell, it just takes as many as possible, so you can still mismatch the distribution numbers, i.e. if you have a lot of bright galaxies with speczs from a really wide survey like SDSS and the second dataset does not have the same areal coverage, then there may not be enough bright objects in the second dataset to select, so you will end up with fewer.
For the columns used to construct the SOM, there are two sets of columns, noncolor_cols is a config option where you supply a list of columns that will be used directly in the SOM, e.g. redshift, i-magnitude, etc… color_cols, on the other hand, is a config parameter where the user supplies an ordered list of columns that will be differenced before being used as SOM inputs, e.g. if you supply [‘u’, ‘g’,’r’] then a function in the code will compute u-g and g-r and use those in SOM construction. The code combines the noncolor_cols and color_cols features and all are used in construction of the SOM.
As this degrader inherits from Selector, it simply computes a mask, the Selector parent class code will perform the masking, and will return the final dataset that mimics the input reference sample.
- 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.
drop_rows ([bool] default=True) – Drop selected rows from output table
seed ([type not specified] default=None) – Set to an int to force reproducible results.
nondetect_val (float] (default=99.0))
noncolor_cols ([list] default=['i', 'redshift']) – data columns used for SOM, can be a single band ifyou will also be using colordata in ‘color_cols’, or can be as many as you want
noncolor_nondet ([list] default=[28.62, -1.0]) – list of nondetect replacement values for the non-color cols
color_cols ([list] default=['u', 'g', 'r', 'i', 'z', 'y']) – columns that will be differenced to make colors. This will be done in order, so put in increasing WL order
color_nondet ([list] default=[27.79, 29.04, 29.06, 28.62, 27.98, 27.05]) – list of nondetect replacement vals for color columns
som_size ([list] default=[32, 32]) – tuple containing the size (x, y) of the SOM
n_epochs ([int] default=10) – number of training epochs.
spec_data (TableHandle (INPUT))
input (TableHandle (INPUT))
output (PqHandle (OUTPUT))
- __init__(args, **kwargs)
Constructor: Do RailStage specific initialization
- entrypoint_function: str | None = '__call__'
- inputs = [('spec_data', <class 'rail.core.data.TableHandle'>), ('input', <class 'rail.core.data.TableHandle'>)]
- interactive_function: str | None = 'som_spec_selector'
- make_data_selection(df)
make the data to train the som or input to som
- name = 'SOMSpecSelector'