respace.ResultSet#
- class respace.ResultSet(results_metadata: ResultSetMetadata | ResultMetadata | List[ResultMetadata] | Mapping[str, Callable[[...], Any] | ResultSetDict] | None = None, params: Parameter | List[Parameter] | Mapping[str, Hashable | Sequence[Hashable]] | ParameterSet | None = None, attrs: dict[str, Any] | None = None, save_path_fmt: str | Path | None = None, verbose: bool = False)[source]#
Hold a set of results within their parameter space.
- Parameters:
- results_metadataResultSetMetadata | ResultSetMetadataInput, optional
ResultSetMetadata, (list of)ResultMetadataor dictionary describing the results to add. SeeResultSetMetadatafor more information on the dictionary format.- paramsParamsType, optional
ParameterSet, (list of)Parameteror dictionary describing the parameters the results depend on. SeeParameterSetfor more information on the dictionary format. They will be used as the coordinates of axarray.Datasetto keep track of the results’ computed values. By definition then, each parameter should have a consistent type and be Hashable, because Dataset coordinates are based onpandas.Index.- attrsdict, optional
Global attributes to save on this result set.
- save_path_fmtstr | Path, optional
Default format for the path where to save the results. Will be formatted with the
str.format()method, with a dictionary mapping “res_name” and the names of all parameters in the set to respectively the name of the result being saved and the value of the parameters. The default is"{res_name}_parameter1={parameter1}_ ...".- verbosebool
Whether to print whenever a result is computed or saved.
- Attributes:
save_path_fmtstrReturn the default format for the path where to save the results.
- __init__(results_metadata: ResultSetMetadata | ResultMetadata | List[ResultMetadata] | Mapping[str, Callable[[...], Any] | ResultSetDict] | None = None, params: Parameter | List[Parameter] | Mapping[str, Hashable | Sequence[Hashable]] | ParameterSet | None = None, attrs: dict[str, Any] | None = None, save_path_fmt: str | Path | None = None, verbose: bool = False) None[source]#
Methods
__init__([results_metadata, params, attrs, ...])add_param_values(params_values)Add new values to existing parameters.
add_params(params)Add new parameters to the set.
add_results(results_metadata)Add new results to the set.
compute(res_name, params, **add_kwargs)Compute result res_name for set of parameters params.
Fill params with the default values of the unspecified parameters.
get(res_name, params, **add_kwargs)Get the value of result res_name for set of parameters params.
get_all_computed_values(res_name)Get a dictionary giving all computed values and their parameters.
get_nth_last_params(res_name[, n])Get the dictionary of parameters for the nth last computation of res_name.
get_nth_last_result(res_name[, n])Get the nth last computed value of result res_name.
get_nth_last_time(res_name[, n])Get the computing time for the nth last computation of result res_name.
get_save_path(res_name, params[, save_path_fmt])Get the path at which to save a result for a set of parameter values.
get_subspace_res(subspace_params[, ...])Return the subset of the result set for the given parameter values.
get_time(res_name, params)Get the computing time of result res_name for parameters params.
get_timing_stats([res_names])Get the summary statistics of the distirbutions of computing times for results.
is_computed(res_name, params)load(res_name[, params, save_path, ...])Load the value of result res_name for set of parameters params.
rank_longest_to_compute(res_name[, ...])Return the ranking of parameters from longest to compute to shortest.
save(res_name, params[, save_path_fmt])Save the value of result res_name for set of parameters params.
set(res_name, value, params[, compute_time])Set value value for result res_name for set of parameters params.
set_compute_fun(res_name, compute_fun)Set the computing funtion for res_name.
set_save_fun(res_name, save_fun)Set the computing funtion for res_name.
Attributes
Return the attributes dictionary of the ResultSet.
Return the coordinates of the parameter space.
Parameter space within which the results are computed.
Return the data describing the parameters of the set and their values.
Return a dictionary with the default values of all parameters.
Return a dictionary with the possible values of all parameters.
Return the metadata describing the results of the set.
Return the default format for the path where to save the results.