piegy.data_tools¶
This section documents the data saving and reading tools.
- data_tools.save(mod, dirs='', print_msg=True)¶
- Saves parameters and data of a model.Direcotries will be created if does not exist.
- Parameters:
mod (
piegy.simulation.modelobject) – where the parameters of the model and data are stored.dirs (str) – where to save data, should be the path of a folder. If
''or'.'is given, will save in root directory./will be added if not at the end ofdirs.print_msg (bool) – whether to print a message after data is saved.
- data_tools.load(dirs)¶
- Reads and returns a model from a directory.
- Parameters:
dirs (str) – where the data is saved, should be path of the parent folder of data.
/will be added if not at the end ofdirs.- Returns:
a model with its parameters and data.
- Return type:
piegy.simulation.modelobject
Examples¶
piegy.data_tools functions.piegy.data_tools.save and piegy.data_tools.load functions:from piegy.data_tools import save, load
Assume you ran simulation on sim variable (piegy.simulation.model object). Then save sim at some_directory directory by:
save(mod, 'some_directory')
some_directory will be created if it does not exist.
You can read data by:
sim2 = load('some_directory')
Please pass in the same directory name as the one you used to save sim.
Note that the data size can be very large. You can reduce size at the expense of losing accuracy by calling compress_data method of piegy.simulation.model