Quick introduction to the MagOptLib library
The Magoptlib python library was created with the purpose of using it for the optimization of placing permanent magnets to create a homogeneous magnetic field for low-field MRIs. Although theoretical permanent magnet arrays promise ideal homogeneity, the achieved homogeneity often differs. This is due the fact, that the real magnetization of a permanent magnet depends on multiple factors, such as temperature, and also strength and angular errors often appear due to manufacturing defects.
Simulations overestimate what can be achieved in real life, unless these irregularities are modeled. The Magoptlib library uses a novel idea of using the magnets’ real magnetic field properties for the optimization process. This is done by mapping measurement data to spherical harmonics, which is then used to predict the field at points other than the measurement set.
Although the library was desinged for low-field MRI applications, the idea behind using spherical harmonics for the better modelling of real magnetic fields could be also beneficial for different purposes.
The optimization workflow is the following:
Measure the magnetic field around each permanent magnet. To test the library synthetic datasets can be also generated using the Magpylib library, for this please check the example code.
The measurement datasets get mapped to spherical harmonics, which gives a set of coefficients for each permanent magnet.
For the optimization, the positions and orientations of the magnets have to be given. Magoptlib offers helper functions to place magnets on a ring. Furthermore, the points where the field has to be evaluated for the optimization (field of interest) has to be determined.
After giving all required parameters, the optimization get started.