Skip to main content

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_approx
  • bottcher_2021
  • kim_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyzfn-1.0.6.tar.gz (42.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyzfn-1.0.6-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file pyzfn-1.0.6.tar.gz.

File metadata

  • Download URL: pyzfn-1.0.6.tar.gz
  • Upload date:
  • Size: 42.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyzfn-1.0.6.tar.gz
Algorithm Hash digest
SHA256 d88eee88c5b0b8cc42df27a81a632c6c828c9444691cd2b512565d53eb742740
MD5 c871204669cba5fbc5d113f7ab7fdac6
BLAKE2b-256 1db33f71849aa9c00f01dbb47f7d7564f2c3e237757e4671b70b69396bc10be4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyzfn-1.0.6.tar.gz:

Publisher: ci-cd.yml on MathieuMoalic/pyzfn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyzfn-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyzfn-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyzfn-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 aa27ba0056586f25a9894cf87a966694b203fbe822d013d1fa6f49988e77d55e
MD5 4fa090644ca9f7803499c1058104712e
BLAKE2b-256 a780c20bd79d9e03f5de4b81e8ac2628a214fe023fc272b43a583291701478bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyzfn-1.0.6-py3-none-any.whl:

Publisher: ci-cd.yml on MathieuMoalic/pyzfn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page