Skip to content

Add ovf functions and tests#142

Merged
ilateur merged 8 commits intodevfrom
ovf
Apr 17, 2026
Merged

Add ovf functions and tests#142
ilateur merged 8 commits intodevfrom
ovf

Conversation

@DiegoDeGusem
Copy link
Copy Markdown
Contributor

This PR adds save_ovf and load_ovf methods to FieldQuantities. This allows users to save and load FieldQuantities via OVF files.
The save_ovf method uses pyovf and provides it with all available metadata. However, some metadata appears to be ignored (e.g. simulation time) and some fields are hard-coded in pyovf (e.g. units).
pyovf expects arrays with shape (nz, ny, nx, ncomp), while mumax⁺ uses (ncomp, nz, ny, nx). The save function reorders the axis, while the load function reverses this. To notify users of this reordering, the save function has a warning in the docstring.

@DiegoDeGusem DiegoDeGusem self-assigned this Apr 10, 2026
@DiegoDeGusem DiegoDeGusem added the enhancement New feature or request label Apr 10, 2026
Comment thread mumaxplus/fieldquantity.py Outdated
Comment thread mumaxplus/fieldquantity.py Outdated
Comment thread mumaxplus/fieldquantity.py Outdated
Comment thread src/bindings/wrap_system.cpp Outdated
Comment thread test/test_ovf.py Outdated
Comment thread test/test_ovf.py Outdated
Comment thread test/test_ovf.py Outdated
Comment thread test/test_ovf.py Outdated
Comment thread test/test_ovf.py Outdated
Comment thread test/test_ovf.py
Comment thread mumaxplus/fieldquantity.py Outdated
Comment thread mumaxplus/fieldquantity.py Outdated
Comment thread mumaxplus/fieldquantity.py
Comment thread test/test_ovf.py
@ilateur ilateur added this to the v1.2.0 milestone Apr 15, 2026
Comment thread mumaxplus/fieldquantity.py Outdated
@DiegoDeGusem DiegoDeGusem requested a review from ilateur April 15, 2026 12:39
Comment thread mumaxplus/fieldquantity.py Outdated
Comment thread mumaxplus/fieldquantity.py Outdated
Copy link
Copy Markdown
Collaborator

@ilateur ilateur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit funny and sad that we now have nice functionality to save and load ovf files... but not npy files. Would it be nice to also have a save_npy() function? Or make it one save() function and decide the type based on the given string (or default if not given)? Or is this useless (just call np.save(field_quantity.eval())) or outside the scope of this pull request?

Comment thread mumaxplus/fieldquantity.py
Comment thread mumaxplus/fieldquantity.py
Comment thread mumaxplus/fieldquantity.py
@ilateur ilateur merged commit e81d41a into dev Apr 17, 2026
@ilateur ilateur deleted the ovf branch April 17, 2026 09:04
@ilateur ilateur mentioned this pull request Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants