full_specs module
Gather in a single object all the parameters for LW to run.
- class ConfSpec(files='', beam='', beam_calculator='', beam_calculator_post='', plots='', evaluators='', design_space='', wtf='', **kwargs)[source]
Bases:
objectDefine structure of a configuration object.
- Parameters:
MANDATORY_CONFIG_ENTRIES (tuple[str, ...]) – Entries that you must declare for this
ConfSpecto work.files (
str, default:'')beam (
str, default:'')beam_calculator (
str, default:'')beam_calculator_post (
str, default:'')plots (
str, default:'')evaluators (
str, default:'')design_space (
str, default:'')wtf (
str, default:'')
- __init__(files='', beam='', beam_calculator='', beam_calculator_post='', plots='', evaluators='', design_space='', wtf='', **kwargs)[source]
Declare the attributes.
- _get_proper_table(table_id, id_type='configured_object')[source]
Get the
TableConfSpecnamedtable_id.- Parameters:
table_id (str) – Name of the desired table.
id_type (Literal["configured_object", "table_entry"], optional) – If
table_idis the name of the object (eg'beam') or of the table entry in the.toml(eg'my_proton_beam', without brackets).
- Returns:
The desired object.
- Return type:
- to_toml_strings(toml_fulldict, id_type='configured_object', original_toml_folder=None, **kwargs)[source]
Convert the given dict in string that can be put in a
.toml.- Parameters:
toml_fulldict (dict[str, dict[str, Any]]) – Holds the full configuration.
id_type (Literal["configured_object", "table_entry"], optional) – If
toml_fulldictkeys are name of the object (eg'beam') or of the table entry in the.toml(eg'my_proton_beam', without brackets).original_toml_folder (pathlib.Path | None, optional) – Where the original
.tomlwas; this is used to resolve paths relative to this location.
- Returns:
The
.tomlcontent that can be directly written to a.tomlfile.- Return type:
- prepare(toml_fulldict, toml_folder, id_type='configured_object', **kwargs)[source]
Check that all the tables in
toml_fulldictare valid.Also edit some values if necessary.
- Parameters:
toml_fulldict (dict[str, dict[str, Any]]) – Holds the full configuration.
id_type (Literal["configured_object", "table_entry"], optional) – If
toml_fulldictkeys are name of the object (eg'beam') or of the table entry in the.toml(eg'my_proton_beam'). Do not put the brackets present in theTOMLfile.toml_folder (
Path)
- Returns:
all_is_validated – If the dict is valid or not.
- Return type:
- class SimplestConfSpec(*, beam='beam', files='files', beam_calculator='beam_calculator')[source]
Bases:
ConfSpecHold all the LightWin inputs, their types, allowed values, etc.
Defined for a run without optimization.
- Parameters: