Metadata#
Parameters#
- class respace.Parameter(name: str, default: ~collections.abc.Hashable, values: list[collections.abc.Hashable] = <factory>)[source]#
Represent a parameter with a mandatory default value.
- Attributes:
- namestr
Name of the parameter.
- defaultHashable
Default value for this parameter.
- valueslist[Hashable]
List of possible values for the parameter. Will contain the default in first position even if it was not supplied thus at initialization.
- class respace.ParameterSet(parameters: Parameter | Iterable[Parameter] | Mapping[str, Hashable | Sequence[Hashable]])[source]#
Hold a list of
Parameterinstances and facilitate iteration over them.The
Parameterinstances will be sorted according to their name attribute.- Parameters:
- parametersParameter | list[Parameter] | ParamsArgType
Input
respace.Parameteror list of Parameter instances, or dictionary whose keys are parameter names, and whose values are either a single value, which will be the default, or a sequence of values, the first of which will be the default.
- Attributes:
- parameterslist[Parameter]
Sorted list of Parameter instances.
Results#
- class respace.ResultMetadata(name: str, compute_fun: ~typing.Callable[[...], ~typing.Any], save_fun: ~typing.Callable[[~typing.Any, ~pathlib.Path | str], ~typing.Any] = <function save_pickle>, load_fun: ~typing.Callable[[~pathlib.Path | str], ~typing.Any] = <function load_pickle>, save_suffix: str = '.pickle', save_path_fmt: str | None = None)[source]#
Represent a result with a mandatory name and computing function.
- Attributes:
- namestr
Name of the result.
- compute_funComputeFunType
Function to call to compute the result.
save_funSaveFunType, defaultrespace.save_pickle()Save object to pickle format at save_path.
- save_suffixstr
Suffix of the file where the result would be saved. Should be set to match what’s expected by to save_fun. Default is “.pickle”
- save_path_fmtstr, optional
Default format for the path where to save the result. Will be formatted with the
str.format()method. If not set,respace.ResultSet’s default will be used. Good practice is to include the name of the result and the parameters’ with format fields for their values.
- class respace.ResultSetMetadata(results: ResultMetadata | List[ResultMetadata] | Mapping[str, Callable[[...], Any] | ResultSetDict])[source]#
Represent a set of results with a mandatory name and computing function.
- Parameters:
- resultsResultSetMetadataInput
Input
respace.Parameteror list ofrespace.Parameterinstances, or dictionary whose keys are result names, and whose values are either a computing function, or a dictionary matching the keys ofrespace.ResultMetadata.
- Attributes:
- resultslist[ResultMetadata]
List of
respace.ResultMetadatainstances.