rail.estimation.algos.NZDir module

Implement simple version of TxPipe NZDir summarizer

class rail.estimation.algos.NZDir.Inform_NZDir(args, comm=None)[source]

Bases: CatInformer

Quick implementation of an NZ Estimator that creates weights for each input object using sklearn’s NearestNeighbors. Very basic, we can probably create a more sophisticated SOM-based DIR method in the future. This inform stage just creates a nearneigh model of the spec-z data and some distances to N-th neighbor that will be used in the estimate stage.

Notes

This will create model a dictionary of the nearest neighboor model and params used by estimate

bands = ['u', 'g', 'r', 'i', 'z', 'y']
config_options = {'distance_delta': <ceci.config.StageParameter object>, 'hdf5_groupname': <ceci.config.StageParameter object>, 'kalgo': <ceci.config.StageParameter object>, 'kmetric': <ceci.config.StageParameter object>, 'n_neigh': <ceci.config.StageParameter object>, 'output_mode': <ceci.config.StageParameter object>, 'save_train': True, 'szname': <ceci.config.StageParameter object>, 'szweightcol': <ceci.config.StageParameter object>, 'usecols': <ceci.config.StageParameter object>}
default_usecols = ['mag_u_lsst', 'mag_g_lsst', 'mag_r_lsst', 'mag_i_lsst', 'mag_z_lsst', 'mag_y_lsst']
name = 'Inform_NZDir'
run()[source]

Run the stage and return the execution status

class rail.estimation.algos.NZDir.NZDir(args, comm=None)[source]

Bases: CatEstimator

Quick implementation of a summarizer that creates weights for each input object using sklearn’s NearestNeighbors. Very basic, we can probably create a more sophisticated SOM-based DIR method in the future :param zmin: min redshift for z grid :type zmin: float :param zmax: max redshift for z grid :type zmax: float :param nzbins: number of bins in z grid :type nzbins: int

Returns:

qp_ens – histogram Ensemble describing N(z) estimate

Return type:

qp Ensemble

bands = ['u', 'g', 'r', 'i', 'z', 'y']
config_options = {'chunk_size': 10000, 'hdf5_groupname': <ceci.config.StageParameter object>, 'leafsize': <ceci.config.StageParameter object>, 'nsamples': <ceci.config.StageParameter object>, 'nzbins': <ceci.config.StageParameter object>, 'output_mode': <ceci.config.StageParameter object>, 'phot_weightcol': <ceci.config.StageParameter object>, 'seed': <ceci.config.StageParameter object>, 'usecols': <ceci.config.StageParameter object>, 'zmax': <ceci.config.StageParameter object>, 'zmin': <ceci.config.StageParameter object>}
default_usecols = ['mag_u_lsst', 'mag_g_lsst', 'mag_r_lsst', 'mag_i_lsst', 'mag_z_lsst', 'mag_y_lsst']
initialize_handle(tag, data, npdf)[source]
join_histograms()[source]
name = 'NZDir'
open_model(**kwargs)[source]

Load the mode and/or attach it to this Estimator

Parameters:

model (object, str or ModelHandle) – Either an object with a trained model, a path pointing to a file that can be read to obtain the trained model, or a ModelHandle providing access to the trained model.

Returns:

self.model – The object encapsulating the trained model.

Return type:

object

outputs = [('output', <class 'rail.core.data.QPHandle'>), ('single_NZ', <class 'rail.core.data.QPHandle'>)]
run()[source]

Run the stage and return the execution status