rail.projects.project_file_factory module

class rail.projects.project_file_factory.RailProjectFileFactory[source]

Bases: RailFactoryMixin

Factory class to make files

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

Files:
  - FileTemplate:
      name: test_file_100k
      path_template: "{catalogs_dir}/test/{project}_{selection}_baseline_100k.hdf5"

Or the used can specifiy particular file instances where everything except the interation_vars are resolved

Files:
  - FileInstance
      name: test_file_100k_roman_rubin_v1.1.3_gold
      path: <full_path_to_file>
classmethod add_file_instance(file_instance)[source]

Add a particular RailProjectFileInstance to the factory

Return type:

None

Parameters:

file_instance (RailProjectFileInstance)

classmethod add_file_template(file_template)[source]

Add a particular RailProjectFileTemplate to the factory

Return type:

None

Parameters:

file_template (RailProjectFileTemplate)

client_classes: list[type[Configurable]] = [<class 'rail.projects.file_template.RailProjectFileInstance'>, <class 'rail.projects.file_template.RailProjectFileTemplate'>]
property file_instances: dict[str, RailProjectFileInstance]

Return the dictionary of file instances

property file_templates: dict[str, RailProjectFileTemplate]

Return the dictionary of file templates

classmethod get_file_instance(name)[source]

Get a file instance by its assigned name

Return type:

RailProjectFileInstance

Parameters:

name (str) – Name of the file instance list to return

Returns:

file instance in question

Return type:

RailProjectFileInstance

classmethod get_file_instance_names()[source]

Return the names of the file instances lists

Return type:

list[str]

classmethod get_file_instances()[source]

Return the dict of all the file instances

Return type:

dict[str, RailProjectFileInstance]

classmethod get_file_template(name)[source]

Get file template by it’s assigned name

Return type:

RailProjectFileTemplate

Parameters:

name (str) – Name of the file templates to return

Returns:

file templates in question

Return type:

RailProjectFileTemplate

classmethod get_file_template_names()[source]

Return the names of the file templates

Return type:

list[str]

classmethod get_file_templates()[source]

Return the dict of all the file templates

Return type:

dict[str, RailProjectFileTemplate]

print_instance_contents()[source]

Print the contents of the factory

Return type:

None

yaml_tag: str = 'Files'