rail.plotting.plotter_factory module

class rail.plotting.plotter_factory.RailPlotterFactory[source]

Bases: RailFactoryMixin

Factory class to make plotters

Expected usage is that user will define a yaml file with the various plotters that they wish to use with the following example syntax:

Plots:
  - Plotter:
      name: zestimate_v_ztrue_hist2d
      class_name: rail.plotters.pz_plotters.PZPlotterPointEstimateVsTrueHist2D
      z_min: 0.0
      z_max: 3.0
      n_zbins: 150
- Plotter:
      name: zestimate_v_ztrue_profile
      class_name: rail.plotters.pz_plotters.PZPlotterPointEstimateVsTrueProfile
      z_min: 0.0
      z_max: 3.0
      n_zbins: 60

And group them into lists of plotter that can be run over particular types of data, using the following example syntax:

Plots:
  - PlotterList:
      name: z_estimate_v_z_true
      plotters:
        - zestimate_v_ztrue_hist2d
        - zestimate_v_ztrue_profile
classmethod add_plotter(plotter)[source]

Add a particular RailPlotter to the factory

Return type:

None

Parameters:

plotter (RailPlotter)

classmethod add_plotter_list(plotter_list)[source]

Add a particular RailPlotGroupRailPlotterList to the factory

Return type:

None

Parameters:

plotter_list (RailPlotterList)

client_classes: list[type[Configurable]] = [<class 'rail.plotting.plotter.RailPlotter'>, <class 'rail.plotting.plotter.RailPlotterList'>]
classmethod get_plotter(name)[source]

Get plotter it’s assigned name

Return type:

RailPlotter

Parameters:

name (str) – Name of the plotter to return

Returns:

plotter – Plotter in question

Return type:

RailPlotter

classmethod get_plotter_list(name)[source]

Get a list of plotters their assigned name

Return type:

RailPlotterList

Parameters:

name (str) – Name of the plotter list to return

Returns:

plotters – Plotters in question

Return type:

list[RailPlotter]

classmethod get_plotter_list_names()[source]

Return the names of the plotter lists

Return type:

list[str]

classmethod get_plotter_lists()[source]

Return the dict of all the plotters

Return type:

dict[str, RailPlotterList]

classmethod get_plotter_names()[source]

Return the names of the plotters

Return type:

list[str]

classmethod get_plotters()[source]

Return the dict of all the plotters

Return type:

dict[str, RailPlotter]

load_object_from_yaml_tag(configurable_class, yaml_tag)[source]

Create and add an object of one of the client classes from a yaml tag

Return type:

None

Parameters:
  • configurable_class (type[C]) – Client class in question

  • yaml_tag (dict[str, Any]) – Yaml used to create the object

property plotter_lists: dict[str, RailPlotterList]

Return the dictionary of lists of RailPlotter objects

property plotters: dict[str, RailPlotter]

Return the dictionary of individual RailPlotter objects

yaml_tag: str = 'Plots'