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) ResultMetadata or dictionary describing the results to add. See ResultSetMetadata for more information on the dictionary format.

paramsParamsType, optional

ParameterSet, (list of) Parameter or dictionary describing the parameters the results depend on. See ParameterSet for more information on the dictionary format. They will be used as the coordinates of a xarray.Dataset to 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 on pandas.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_fmtstr

Return 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_with_defaults()

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

attrs

Return the attributes dictionary of the ResultSet.

coords

Return the coordinates of the parameter space.

param_space

Parameter space within which the results are computed.

parameters

Return the data describing the parameters of the set and their values.

params_defaults

Return a dictionary with the default values of all parameters.

params_values

Return a dictionary with the possible values of all parameters.

populated_mask

populated_space

results

Return the metadata describing the results of the set.

save_path_fmt

Return the default format for the path where to save the results.