qiu_classical_simulation.wave_optics.storage
¶
Storage of lens experiments, one folder per run.
A run folder holds initial_parameters.json, the parameters together with the scalar
results, and results.npz, the snapshots. Runs are stored as <results_dir>/<uuid>;
older ones as <results_dir>/<timestamp>, which reads the same way.
Functions:
-
save_experiment–Store a run in the folder
<results_dir>/<uuid>, and return the folder. -
load_stored_values–Return the stored parameters and scalar results of a run.
-
load_parameters–Load the parameters of a run, see
ExperimentParameters.from_dict. -
load_result–Load the result of a run.
-
load_experiment–Load the parameters and the result of a run.
-
run_folders–Return the run folders in a results directory, sorted by name.
Attributes:
save_experiment
¶
save_experiment(results_dir: str | Path, parameters: ExperimentParameters, result: ExperimentResult) -> Path
Store a run in the folder <results_dir>/<uuid>, and return the folder.
Returns:
-
Path–The folder of the run,
<results_dir>/<uuid>.
Raises:
-
FileExistsError–If a run of the same uuid is stored already, e.g. of parameters copied with
dataclasses.replace, which keeps the uuid; give the copy a new one, e.g.replace(parameters, ..., uuid=uuid.uuid4().hex).
Source code in packages/qiu-classical-simulation/src/qiu_classical_simulation/wave_optics/storage.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
load_stored_values
¶
Return the stored parameters and scalar results of a run.
Source code in packages/qiu-classical-simulation/src/qiu_classical_simulation/wave_optics/storage.py
43 44 45 46 | |
load_parameters
¶
Load the parameters of a run, see ExperimentParameters.from_dict.
Source code in packages/qiu-classical-simulation/src/qiu_classical_simulation/wave_optics/storage.py
49 50 51 52 53 | |
load_result
¶
load_result(folder: str | Path) -> ExperimentResult
Load the result of a run.
Source code in packages/qiu-classical-simulation/src/qiu_classical_simulation/wave_optics/storage.py
56 57 58 59 60 61 62 63 64 65 66 | |
load_experiment
¶
load_experiment(folder: str | Path, defaults: dict[str, Any] | None = None) -> tuple[ExperimentParameters, ExperimentResult]
Load the parameters and the result of a run.
Source code in packages/qiu-classical-simulation/src/qiu_classical_simulation/wave_optics/storage.py
69 70 71 72 73 | |
run_folders
¶
Return the run folders in a results directory, sorted by name.
Source code in packages/qiu-classical-simulation/src/qiu_classical_simulation/wave_optics/storage.py
76 77 78 79 80 81 82 | |