rail.plotting.dataset_factory module

class rail.plotting.dataset_factory.RailDatasetFactory[source]

Bases: RailFactoryMixin

Factory class to make datasets

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

Data:
  - Project:
     name: some_project
     yaml_file: /path/to/rail_project_file
  - Dataset:
      name: gold_baseline_test
      class: rail.plotting.project_dataset_holder.RailProjectDatasetHolder
      extractor: rail.plotting.pz_data_extractor.PZPointEstimateDataExtractor
      project: some_project
      selection: gold
      flavor: baseline
      tag: test
      algos: ['all']
  - Dataset:
      name: blend_baseline_test
      class: rail.plotting.project_dataset_holder.RailProjectDatasetHolder
      exctractor: rail.plottings.pz_data_extractor.PZPointEstimateDataExtractor
      project: some_project
      selection: blend
      flavor: baseline
      tag: test
      algos: ['all']

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

Data:
  - DatasetList:
      name: baseline_test
      datasets:
        - gold_baseline_test
        - blend_baseline_test
classmethod add_dataset(dataset_holder)[source]

Add a particular RailDatasetHolder to the factory

Return type:

None

Parameters:

dataset_holder (RailDatasetHolder)

classmethod add_dataset_list(dataset_list)[source]

Add a particular RailDatasetListHolder to the factory

Return type:

None

Parameters:

dataset_list (RailDatasetListHolder)

classmethod add_project(project_holder)[source]

Add a particular RailProjectHolder to the factory

Return type:

None

Parameters:

project_holder (RailProjectHolder)

client_classes: list[type[Configurable]] = [<class 'rail.plotting.dataset_holder.RailProjectHolder'>, <class 'rail.plotting.dataset_holder.RailDatasetHolder'>, <class 'rail.plotting.dataset_holder.RailDatasetListHolder'>]
property dataset_lists: dict[str, RailDatasetListHolder]

Return the dictionary of lists of datasets

property datasets: dict[str, RailDatasetHolder]

Return the dictionary of individual datasets

classmethod get_dataset(name)[source]

Get dataset by it’s assigned name

Return type:

RailDatasetHolder

Parameters:

name (str) – Name of the dataset to return

Returns:

dataset – Dataset in question

Return type:

dict

classmethod get_dataset_list(name)[source]

Get a list of datasets their assigned name

Return type:

RailDatasetListHolder

Parameters:

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

Returns:

datasets – Datasets in question

Return type:

list[dict]

classmethod get_dataset_list_names()[source]

Return the names of the dataset lists

Return type:

list[str]

classmethod get_dataset_lists()[source]

Return the dict of all the datasets

Return type:

dict[str, RailDatasetListHolder]

classmethod get_dataset_names()[source]

Return the names of the datasets

Return type:

list[str]

classmethod get_datasets()[source]

Return the dict of all the datasets

Return type:

dict[str, RailDatasetHolder]

classmethod get_project(key)[source]

Return a project by name

Return type:

RailProject

Parameters:

key (str)

classmethod get_project_names()[source]

Return the names of all the projects

Return type:

list[str]

classmethod get_projects()[source]

Return the dict of all the projects

Return type:

dict[str, RailProject]

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 projects: dict[str, RailProjectHolder]

Return the dictionary of RailProjects

yaml_tag: str = 'Data'