rail.creation.engine module

Abstract base classes defining a Creator.

A Creator will create synthetic photometric data and a PosteriorCalculator, which can calculate posteriors for the data with respect to the distribution defined by the Creator.

class rail.creation.engine.Creator

Bases: RailStage

Base class for Creators that generate synthetic photometric data from a model.

Creator will output a table of photometric data. The details will depend on the particular engine.

__init__(args, **kwargs)

Initialize Creator

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

None

entrypoint_function: str | None = 'sample'
inputs = [('model', <class 'rail.core.data.ModelHandle'>)]
name = 'Creator'
outputs = [('output', <class 'rail.core.data.TableHandle'>)]
sample(n_samples=None, seed=None, **kwargs)

Draw samples from the model specified in the configuration.

This is a method for running a Creator in interactive mode. In pipeline mode, the subclass run method will be called by itself.

Parameters:
  • n_samples (int, optional) – The number of samples to draw, by default None

  • seed (int, optional) – The random seed to control sampling, by default None

  • **kwargs (Any) – Used to update the configuration

Returns:

TableHandle wrapping the newly created samples

Return type:

TableHandle

Notes

This method puts n_samples and seed into the stage configuration data, which makes them available to other methods.

It then calls the run method, which must be defined by a subclass.

Finally, the TableHandle associated to the output tag is returned.

class rail.creation.engine.Modeler

Bases: RailStage

Base class for creating a model of redshift and photometry.

__init__(args, **kwargs)

Initialize Modeler

Parameters:
  • args (Any)

  • kwargs (Any)

entrypoint_function: str | None = 'fit_model'
fit_model(input_data, **kwargs)

Produce a creation model from which photometry and redshifts can be generated.

Parameters:

input_data (DataHandle) –

???

Returns:

This will definitely be a wrapper around a File, but the filetype and format depend entirely on the modeling approach

Return type:

ModelHandle

inputs = [('input', <class 'rail.core.data.DataHandle'>)]
name = 'Modeler'
outputs = [('model', <class 'rail.core.data.ModelHandle'>)]
class rail.creation.engine.PosteriorCalculator

Bases: RailStage

Base class for object that calculates the posterior distribution of a particular field in a table of photometric data (typically the redshift).

The posteriors will be contained in a qp Ensemble.

__init__(args, **kwargs)

Initialize PosteriorCalculator

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

None

entrypoint_function: str | None = 'get_posterior'
get_posterior(input_data, **kwargs)

Return posteriors for the given column.

This is a method for running a Creator in interactive mode. In pipeline mode, the subclass run method will be called by itself.

Parameters:
  • input_data (TableLike) – A table of the galaxies for which posteriors are calculated

  • **kwargs (Any) – Used to update configuration

Returns:

Posterior Estimate

Return type:

QPHandle

Notes

This will put the data argument input this Stages the DataStore using this stages input tag.

This will put the additional functional arguments into this Stages configuration data.

It will then call self.run() and return the QPHandle associated to the output tag.

inputs = [('model', <class 'rail.core.data.ModelHandle'>), ('input', <class 'rail.core.data.TableHandle'>)]
name = 'PosteriorCalculator'
outputs = [('output', <class 'rail.core.data.QPHandle'>)]