pypesto.store
Storage
Saving and loading traces and results objects.
- class pypesto.store.OptimizationResultHDF5Reader[source]
Bases:
object
Reader of the HDF5 result files written by OptimizationResultHDF5Writer.
- storage_filename
HDF5 result file name
- class pypesto.store.OptimizationResultHDF5Writer[source]
Bases:
object
Writer of the HDF5 result files.
- storage_filename
HDF5 result file name
- class pypesto.store.ProblemHDF5Reader[source]
Bases:
object
Reader of the HDF5 problem files written by ProblemHDF5Writer.
- storage_filename
HDF5 problem file name
- read(objective=None)[source]
Read HDF5 problem file and return pyPESTO problem object.
- Parameters:
objective (
ObjectiveBase
) – Objective function which is currently not saved to storage.- Return type:
- Returns:
problem – A problem instance with all attributes read in.
- class pypesto.store.ProblemHDF5Writer[source]
Bases:
object
Writer of the HDF5 problem files.
- storage_filename
HDF5 result file name
- class pypesto.store.ProfileResultHDF5Reader[source]
Bases:
object
Reader of the HDF5 result files written by OptimizationResultHDF5Writer.
- storage_filename
HDF5 result file name
- class pypesto.store.ProfileResultHDF5Writer[source]
Bases:
object
Writer of the HDF5 result files.
- storage_filename
HDF5 result file name
- class pypesto.store.SamplingResultHDF5Reader[source]
Bases:
object
Reader of the HDF5 result files written by SamplingResultHDF5Writer.
- storage_filename
HDF5 result file name
- class pypesto.store.SamplingResultHDF5Writer[source]
Bases:
object
Writer of the HDF5 sampling files.
- storage_filename
HDF5 result file name
- pypesto.store.autosave(filename, result, store_type, overwrite=False)[source]
Save the result of optimization, profiling or sampling automatically.
- Parameters:
filename (
Union
[Path
,str
,Callable
,None
]) – Either the filename to save to or “Auto”, in which case it will automatically generate a file named year_month_day_{type}_result.hdf5. A method can also be provided. All input to the autosave method will be passed to the filename method. The output should be the filename (str).result (
Result
) – The result to be saved.store_type (
str
) – Either optimize, sample or profile. Depending on the method the function is called in.overwrite (
bool
) – Whether to overwrite the currently existing results.
- pypesto.store.read_result(filename, problem=True, optimize=False, profile=False, sample=False)[source]
Save the whole pypesto.Result object in an HDF5 file.
By default, loads everything. If any of optimize, profile, sample is explicitly set to true, loads only this one.
- Parameters:
- Return type:
- Returns:
result – Result object containing the results stored in HDF5 file.
- pypesto.store.write_array(f, path, values)[source]
Write array to hdf5.
- Parameters:
f (
Group
) – h5py.Group where dataset should be createdpath (
str
) – path of the dataset to createvalues (
Collection
) – array to write
- Return type:
- pypesto.store.write_result(result, filename, overwrite=False, problem=True, optimize=False, profile=False, sample=False)[source]
Save whole pypesto.Result to hdf5 file.
Boolean indicators allow specifying what to save.
- Parameters:
result (
Result
) – Thepypesto.Result
object to be saved.overwrite (
bool
) – Boolean, whether already existing results should be overwritten.problem (
bool
) – Read the problem.optimize (
bool
) – Read the optimize result.profile (
bool
) – Read the profile result.sample (
bool
) – Read the sample result.