rail.interfaces.tool_factory module

class rail.interfaces.tool_factory.ToolFactory

Bases: object

Factory class to provide a unified interface to rail tool stages

classmethod build_stage_instance(stage_name, stage_class, data_path='none', **config_params)

Build and configure a rail tool stage

Parameters:
  • stage_name (str) – Name of the stage instance, used to construct output file name

  • stage_class (type) – Python class for the stage

  • data_path (str) – Path to the input data, defaults to ‘none’

  • config_params (dict) – Configuration parameters for the stage

Returns:

stage_obj – Newly constructed and configured RailStage instance

Return type:

RailStage

classmethod build_tool_stage(stage_name, class_name, module_name, data_path='none', **config_params)

Build and configure a rail tool stage

Parameters:
  • stage_name (str) – Name of the stage instance, used to construct output file name

  • class_name (str) – Name of the class, used to find the class

  • module_name (str) – Name of the python module that constains the class, used to import it

  • data_path (str) – Path to the input data, defaults to ‘none’

  • config_params (dict) – Configuration parameters for the stage

Returns:

stage_obj – Newly constructed and configured Estimator instance

Return type:

CatEstimator

classmethod get_tool_stage(stage_name)

Return a tool stage

Parameters:

stage_name (str)

Return type:

RailStage

classmethod reset()

Reset the dictionary of cached stage objects

Return type:

None

static run_tool_stage(stage_obj, data_path)

Run a p(z) estimator on an input data file

Parameters:
  • stage_obj (CatEstimator) – Object that will do the estimation

  • data_path (str)

Returns:

data_handle – Object that can give access to the data

Return type:

DataHandle