micromagnetic post processing library
Project description
pyzfn
Pyzfn is a Python library for post-processing micromagnetic simulation data generated by amumax, a fork of mumax3. It is designed for use with Zarr-backed datasets and supports spatially resolved frequency-domain analysis, visualization, and export of magnetization dynamics.
Features
- 🧊 Zarr-native API for reading/writing simulation results
- ⚡ FFT-based mode analysis across 5D datasets (
(t, z, y, x, c)) - 📈 Interactive spectrum visualization with peak-picking
- 🌈 Mode visualization in amplitude and phase
- 🖼️ Snapshot tools for spatial magnetization structure
- 💾 OVF (OOMMF Vector Field) export for simulation interoperability
- 📚 Predefined theoretical dispersion models (Kittel, Kalinikos-Slavin, DMI-included...)
Installation
pip install pyzfn
Usage
Loading a Zarr Dataset
from pyzfn import Pyzfn
zfn = Pyzfn("my_simulation.zarr")
zfn.p # Show tree structure
Calculate Modes
zfn.calc_modes(dset_in_str="m", dset_out_str="modes")
Performs time-FFT over magnetization and stores spatially resolved modes in modes/....
Visualize Frequency Spectrum + Modes
zfn.ispec(dset_str="modes")
- Left: Spectral line plot
- Right: Mode amplitude, phase, and composite maps
- Click to explore frequency slices interactively
Visualize a Snapshot
zfn.snapshot(dset_str="m", t=-1, z=0)
Visualizes the magnetization vector field at a given time and layer.
Dispersion Models
You can compute theoretical resonance frequencies for comparison:
from pyzfn.equations import kittel_1948
f_res = kittel_1948(B=0.23, Ms=1.15e6, Ku=0.938e6)
print(f_res, "Hz")
Other supported models:
kalinikos_1986,kalinikos_1986_no_approxbottcher_2021kim_2016(DMI included)cortes_ortuno_2013
OVF Support
Save to OVF
from pyzfn.ovf import save_ovf
save_ovf("mode.ovf", array, dx=1e-9, dy=1e-9, dz=1e-9)
Load from OVF
from pyzfn.ovf import load_ovf
arr = load_ovf("mode.ovf")
Development
Run Tests
pytest
Run Type Checks
mypy pyzfn
Format & Lint
We use pre-commit hooks:
pre-commit install
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 pyzfn-1.0.5.tar.gz.
File metadata
- Download URL: pyzfn-1.0.5.tar.gz
- Upload date:
- Size: 38.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa20401be1af92e732b12f40ad58569019ea45ad5aa606ea1b16a7b1b1be5bb4
|
|
| MD5 |
d952495e60e8647b60885cdb4643fac1
|
|
| BLAKE2b-256 |
1acbe35634257058bb7b08059cdf56db67fed7d66f2b13deb96193e43c030f0e
|
Provenance
The following attestation bundles were made for pyzfn-1.0.5.tar.gz:
Publisher:
ci-cd.yml on MathieuMoalic/pyzfn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyzfn-1.0.5.tar.gz -
Subject digest:
fa20401be1af92e732b12f40ad58569019ea45ad5aa606ea1b16a7b1b1be5bb4 - Sigstore transparency entry: 243809684
- Sigstore integration time:
-
Permalink:
MathieuMoalic/pyzfn@3709ee4f8e4154ec75d961cf527de7cbc784cc65 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MathieuMoalic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@3709ee4f8e4154ec75d961cf527de7cbc784cc65 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyzfn-1.0.5-py3-none-any.whl.
File metadata
- Download URL: pyzfn-1.0.5-py3-none-any.whl
- Upload date:
- Size: 42.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a6cc91645fafa6eda1800821e031cd8f034bc127eac4554d97e2dda5bc26aef
|
|
| MD5 |
ec7a659646b6b04a410682c952ebe20c
|
|
| BLAKE2b-256 |
517f9e1f5cbf2f4761d0f8702120e10d1fe89562dcf478316c295d6913eddbbe
|
Provenance
The following attestation bundles were made for pyzfn-1.0.5-py3-none-any.whl:
Publisher:
ci-cd.yml on MathieuMoalic/pyzfn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyzfn-1.0.5-py3-none-any.whl -
Subject digest:
3a6cc91645fafa6eda1800821e031cd8f034bc127eac4554d97e2dda5bc26aef - Sigstore transparency entry: 243809685
- Sigstore integration time:
-
Permalink:
MathieuMoalic/pyzfn@3709ee4f8e4154ec75d961cf527de7cbc784cc65 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MathieuMoalic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@3709ee4f8e4154ec75d961cf527de7cbc784cc65 -
Trigger Event:
push
-
Statement type: