Pymagnet is a collection of routines to calculate and plot the magnetic field due to arbitrary 2D and 3D objects, like cubes or cylinders, as well as complex non-convex structures stored in STL files.
The library can also calculate the magnetic forces and torques on one magnet due to all other magnets in the system.
**UPDATE:** Bug fixes
The approach assumes the magnets are uniformly magnetised, and fully transparent to magnetic fields. There are some drawbacks to this compared to Finite Element Methods (FEM), but with the advantage of significantly faster calculations.
The current version is written in Python with some speed up using [Numpy](https://numpy.org/) and [Numba](https://numba.pydata.org/), but the backend is being ported to [Rust](https://github.com/pdunne/magnet_rs) for improved performance.