The Magpylib Documentation

The Magpylib Documentation#

Magpylib is an open-source Python package for calculating static magnetic fields of magnets, currents and other sources. It uses explicit expressions, solutions to the macroscopic magnetostatic problems, implemented in vectorized form which makes the computation extremely fast. Make use of the open-source Python ecosystem for spectacular visualization.

How it works#

In Magpylib, sources (magnets, currents, …) and observers (sensors, position grids, …) are created as Python objects with position and orientation attributes. These objects can be grouped and moved around. The system can be viewed graphically through various backends. The magnetic field is computed in the observer reference frame. Magpylib collects all inputs, and vectorizes the computation for maximal performance.