xarray engine to load ovf files from mumax simulations into xarray
Project description
mumaxXR contains an engine for xarray to read output directories of mumax directly, lazily into xarray. Therefore, the class OvfEngine needs to be imported from mumaxXR. Simply pass the directory, or an ovf file (e.g. m000000.ovf) as the filename_or_obj argument to the method. If only the directory is specified, the engine tries to find magnetization ovf files. If no magnetization ovf files are found the engine tries to load displacement ovf files. If neither magnetization nor displacement ovf files are found the engine just loads the first appearing type of ovf files. The engine has to be passed to xarray as engine=OvfEngine. Set chunks=’auto’ in order to parallelize loading of the ovf-files. If you want to set chunks to something else, keep in mind, that each ovf file has to be accessed multiple times, if the chunks for the dimensions x, y, z and comp are not set the default values.
from mumaxXR import OvfEngine
dataset = xr.open_dataset(example_mumax_output_dir, chunks='auto', engine=OvfEngine)
If multiple kinds of ovf files have been stored in the same time steps, another argument ‘wavetype’ can be passed to open_dataset, containing a list of the other short names, e.g.,
dataset = xr.open_dataset(path_to_example_mumax_output_dir, chunks='auto', engine=OvfEngine, wavetype=['m', 'u'])
Keep in mind that the names passed to wavetype have to be exactly like the prefix of ovf files.
If multiple simulation directories are supposed to be concatenated, multiple mumax simulation directories can be passed to the engine. If the number of ovf-files in the directories is not the same, the data is going to be interpolated lineariliy towards the time scaling, of the major mumax-directory. Please notice that this only makes sense, if the simulations did not crash or were interrupted in another way. This is meant for concatenating simulations of parameter sweeps. For 1D concatenation simply pass the parameter values inside a list to the engine.
dataset = xr.open_dataset(example_mumax_output_dir_0, chunks='auto', engine=OvfEngine, dirListToConcat=[path_to_example_mumax_output_dir_1, path_to_example_mumax_output_dir_2], sweepName='name_of_changed_parameter', sweepParam=[value_0_of_parameter, value_1_of_parameter, value_2_of_parameter])
For ND concatenation pass a list of names to sweepNames and a list of tuples to sweepParams
dataset = xr.open_dataset(example_mumax_output_dir_1, chunks='auto', engine=OvfEngine, dirListToConcat=[path_to_example_mumax_output_dir_2, path_to_example_mumax_output_dir_3, path_to_example_mumax_output_dir_4], sweepName=['name_of_changed_parameter_1', 'name_of_changed_parameter_2'], sweepParam=[(value_1_1_of_parameter, value_2_1_of_parameter), (value_1_2_of_parameter, value_2_1_of_parameter), (value_1_1_of_parameter, value_2_2_of_parameter), (value_1_2_of_parameter, value_2_2_of_parameter)])
If you want the ovf-files to be deleted after reading, set removeOvfFiles=True. This only works, if the ovf-files don’t have to be accessed multiple times. If you want to use ovf-files periodically, set useEachNthOvfFile=N. N has to be larger than one. Otherwise it is ignored. Using this flag, only each nth ovf file is used for the dataset. The singleLoad option allows you to not load all of the ovf-files but only one specific one.
Of course the wavetype option and the mumax directory concatenation can be used simultaneously.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mumaxxr-0.0.21.tar.gz.
File metadata
- Download URL: mumaxxr-0.0.21.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9eaec841cb40195492c22791ca3627fc59e4c2fde731aa15a6503f906e94c50c
|
|
| MD5 |
53d98d01021ecae4b9d78545912c6cac
|
|
| BLAKE2b-256 |
b52744b1f904e211544956bf4f7a45cbbc89894f078a4247eaf3c24140814d0a
|
Provenance
The following attestation bundles were made for mumaxxr-0.0.21.tar.gz:
Publisher:
publish.yml on timvgl/mumaxXR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mumaxxr-0.0.21.tar.gz -
Subject digest:
9eaec841cb40195492c22791ca3627fc59e4c2fde731aa15a6503f906e94c50c - Sigstore transparency entry: 153273662
- Sigstore integration time:
-
Permalink:
timvgl/mumaxXR@ae1f2ab678ef6b6a3269932b5b88c826e696b65d -
Branch / Tag:
refs/tags/v0.0.21 - Owner: https://github.com/timvgl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae1f2ab678ef6b6a3269932b5b88c826e696b65d -
Trigger Event:
release
-
Statement type:
File details
Details for the file mumaxxr-0.0.21-py3-none-any.whl.
File metadata
- Download URL: mumaxxr-0.0.21-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e434875c09391479d9bc8ff4e7dd5154152632018c39baf7605d0f44d9150c8b
|
|
| MD5 |
4778649b9e1d0b727a9a9138039c4f10
|
|
| BLAKE2b-256 |
c1d5af8510aa368e445f4cd5122be23ecf61a183a433713fdfda1dd31cc87df8
|
Provenance
The following attestation bundles were made for mumaxxr-0.0.21-py3-none-any.whl:
Publisher:
publish.yml on timvgl/mumaxXR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mumaxxr-0.0.21-py3-none-any.whl -
Subject digest:
e434875c09391479d9bc8ff4e7dd5154152632018c39baf7605d0f44d9150c8b - Sigstore transparency entry: 153273663
- Sigstore integration time:
-
Permalink:
timvgl/mumaxXR@ae1f2ab678ef6b6a3269932b5b88c826e696b65d -
Branch / Tag:
refs/tags/v0.0.21 - Owner: https://github.com/timvgl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae1f2ab678ef6b6a3269932b5b88c826e696b65d -
Trigger Event:
release
-
Statement type: