rail.estimation.summarizer module

Abstract base classes defining Summarizers of the redshift distribution of an ensemble of galaxies

class rail.estimation.summarizer.CatSummarizer

Bases: RailStage

The base class for classes that go from catalog-like tables to ensemble NZ estimates.

CatSummarizer take as “input” a catalog-like table. I.e., a table with fluxes in photometric bands among the set of columns.

provide as “output” a QPEnsemble, with per-ensemble n(z).

entrypoint_function: str | None = 'summarize'
inputs = [('input', <class 'rail.core.data.TableHandle'>)]
name = 'CatSummarizer'
outputs = [('output', <class 'rail.core.data.QPHandle'>)]
summarize(input_data)

The main run method for the summarization, should be implemented in the specific subclass.

This will attach the input_data to this CatSummarizer (for introspection and provenance tracking).

Then it will call the run() and finalize() methods, which need to be implemented by the sub-classes.

The run() method will need to register the data that it creates to this CatSummarizer by using self.add_data(‘output’, output_data).

Finally, this will return a QPHandle providing access to that output data.

Parameters:

input_data (TableLike) – Either a dictionary of all input data or a TableHandle providing access to the same

Returns:

Ensemble with n(z), and any ancillary data

Return type:

QPHandle

class rail.estimation.summarizer.PZSummarizer

Bases: RailStage

The base class for classes that go from per-galaxy PZ estimates to ensemble NZ estimates

PZSummarizer take as “input” a qp.Ensemble with per-galaxy PDFs, and provide as “output” a QPEnsemble, with per-ensemble n(z).

entrypoint_function: str | None = 'summarize'
inputs = [('model', <class 'rail.core.data.ModelHandle'>), ('input', <class 'rail.core.data.QPHandle'>)]
name = 'PZtoNZSummarizer'
outputs = [('output', <class 'rail.core.data.QPHandle'>)]
summarize(input_data, **kwargs)

The main run method for the summarization, should be implemented in the specific subclass.

This will attach the input_data to this PZtoNZSummarizer (for introspection and provenance tracking).

Then it will call the run() and finalize() methods, which need to be implemented by the sub-classes.

The run() method will need to register the data that it creates to this Estimator by using self.add_data(‘output’, output_data).

Finally, this will return a QPHandle providing access to that output data.

Parameters:

input_data (qp.Ensemble) – Per-galaxy p(z), and any ancillary data associated with it

Returns:

Ensemble with n(z), and any ancillary data

Return type:

QPHandle

class rail.estimation.summarizer.SZPZSummarizer

Bases: RailStage

The base class for classes that use two sets of data: a photometry sample with spec-z values, and a photometry sample with unknown redshifts, e.g. minisom_som and outputs a QP Ensemble with bootstrap realization of the N(z) distribution

__init__(args, **kwargs)

Initialize Estimator that can sample galaxy data.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

None

entrypoint_function: str | None = 'summarize'
inputs = [('input', <class 'rail.core.data.TableHandle'>), ('spec_input', <class 'rail.core.data.TableHandle'>), ('model', <class 'rail.core.data.ModelHandle'>)]
name = 'SZPZtoNZSummarizer'
outputs = [('output', <class 'rail.core.data.QPHandle'>)]
summarize(input_data, spec_data, **kwargs)

The main run method for the summarization, should be implemented in the specific subclass.

This will attach the input_data to this SZandPhottoNZSummarizer (for introspection and provenance tracking).

Then it will call the run() and finalize() methods, which need to be implemented by the sub-classes.

The run() method will need to register the data that it creates to this Estimator by using self.add_data(‘output’, output_data).

Finally, this will return a QPHandle providing access to that output data.

Parameters:
  • input_data (qp.Ensemble) – Per-galaxy p(z), and any ancillary data associated with it

  • spec_data (np.ndarray) – Spectroscopic data

Returns:

Ensemble with n(z), and any ancillary data

Return type:

qp.Ensemble