llg3d.post.extract¶
Extract scalar values from .npz result files.
Use the llg3d.extract command line tool to extract scalar values from .npz result
files:
$ llg3d.extract --help
usage: llg3d.extract [-h] filename keys [keys ...]
Extract scalar values from .npz result files.
positional arguments:
filename Path to the .npz result file
keys Key(s) of the scalar value(s) to extract (slash-separated for
nested keys)
options:
-h, --help show this help message and exit
Extract the total execution time from a run.npz file:
$ llg3d.extract run.npz results/metrics/total_time
1.1824582910630852
Extract both the total execution time and the time per iteration:
$ llg3d.extract run.npz results/metrics/total_time results/metrics/time_per_ite
1.1824582910630852 0.011824582910630852
Functions
|
Extract scalar values from a .npz file. |
|
Parse command line arguments and print simulation info. |
Recursively navigate through nested structures using keys.
Tries subscript access (dicts/arrays) first, then attribute access (objects).
- Parameters:
value (object) – The current value to navigate.
levels (list[str]) – List of keys/attributes to navigate through.
- Returns:
The final value after navigating through all levels.
- extract_values(npz_file, *keys)[source]¶
Extract scalar values from a .npz file.
- Parameters:
npz_file (Path) – Path to the .npz result file
*keys (str) – tuple of keys of the scalar values to extract (slash-separated for nested keys)
- Returns:
The list of extracted scalar values
- Raises:
ValueError – If one of the extracted values is not a scalar
- Return type:
list[float | int | str | bool | integer | floating]