Skip to main content

magpylib-material-response

Actions Status Documentation Status

PyPI version PyPI platforms

Coverage

Warning This package is experimental and in development phase, breaking API changes may happen at any time.

Magpylib-Material-Response adds the response of magnetic materials to Magpylib: the demagnetization of hard magnets and the magnetization of soft-magnetic parts. It cuts the magnets into cells and solves for the polarization of every cell at once with the method of moments.

  • apply_demag solves a magpylib Collection for a scalar or anisotropic susceptibility per cell, driven by remanent polarizations, a uniform applied field and the current sources in the collection.
  • Two solvers, two interaction rules: a dense direct solver, or matrix-free GMRES with FFT products on grids of identical cuboids, for meshes too large for a dense matrix; the default solver="auto" picks one from the cells. Cells interact through the field at each other's centroids (default) or averaged over each cell (interaction="newell", cuboid meshes).
  • Meshing helpers cut cuboids, cylinders and, through TetGen, any closed triangular surface into cells.

Installation

pip install magpylib-material-response

Tetrahedral meshing of TriangularMesh magnets requires the optional TetGen dependency:

pip install magpylib-material-response[tetgen]

Minimal example

import magpylib as magpy
from magpylib_material_response.demag import apply_demag
from magpylib_material_response.meshing import mesh_Cuboid

# a magnet with finite susceptibility, SI units (m, T)
magnet = magpy.magnet.Cuboid(polarization=(0, 0, 1), dimension=(1e-3, 1e-3, 1e-3))
magnet.susceptibility = 0.3  # µr = 1.3

# mesh into cells and solve; the result is a field source like any other
mesh_demag = apply_demag(mesh_Cuboid(magnet, target_elems=125))
print(magpy.getB(mesh_demag, (0, 0, 1.5e-3)))

See the documentation for a quickstart, worked examples, and the method description.

Metadata

Release files for magpylib-material-response 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for magpylib-material-response 0.6.0
File Size Uploaded Provenance
magpylib_material_response-0.6.0.tar.gz 354.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for magpylib-material-response 0.6.0
File Interpreter ABI Platform
magpylib_material_response-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 559.3 kB

Release files / magpylib_material_response-0.6.0.tar.gz

Download URL magpylib_material_response-0.6.0.tar.gz
Size 354.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d16fc1d9aca059e7547bf5fe23e49594e626879e342beee5090430e87dcbc55c
BLAKE2b-256 checksum
How to use checksums
a8265b3e0f5e5bde718d93d1c1002016c5978e79cb7d525ebe9fe0073bfda14a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / magpylib_material_response-0.6.0-py3-none-any.whl

Download URL magpylib_material_response-0.6.0-py3-none-any.whl
Size 205.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
865b309e0af0c6d1ef493c3cfa0d1f5f0337e1cc7c4ce0e32b200b9df0468839
BLAKE2b-256 checksum
How to use checksums
e5fd58979bd4402cf36018da166046b4f071f324dcfc47e2d2a5398c4eae7fd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for magpylib-material-response 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for magpylib_material_response-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page