Package: bfieldtools
bfieldtools is a software package for magnetic field modeling with an emphasis on magnetic field generated by a continuous surface-current density. The surface-current density is described by a piecewise linear stream function on a triangle mesh.The software currently featuresDiscrete calculus on triangle meshes, including the Laplacian, gradient, divergence and curlMesh operators (matrices) for inductance and resistanceMagnetic field as well as scalar and vector potentials of surface-current densitiesMagnetic field as well as scalar and vector potentials of polyline currentsSpherical harmonics (multipole) representation of the magnetic fieldSurface harmonics (Laplace-Beltrami eigenfunctions) for series expansion of the stream functionCoil design using convex optimizationMagnetic thermal noise of thin conductorsDependenciesRequires Python 3.8 or newer, preferably >3.10.NumpyScipyTrimeshCVXPYMatplotlibPyvistaDocumentationOnline documentation, including an API reference and examples can be found athttps://bfieldtools.github.io/.Installing bfieldtoolsTo install bfieldtools using pip, simply run:pipinstallbfieldtoolsFor advanced installation instructions, see the onlineinstallation instructions.Citing bfieldtoolsWhen using the software package in a publication, please cite the following articles:@article{doi:10.1063/5.0016090,author={Mäkinen, Antti J. and Zetter, Rasmus and Iivanainen, Joonas and Zevenhoven, Koos C. J. and Parkkonen, Lauri and Ilmoniemi, Risto J.},title={Magnetic-field modeling with surface currents. Part I. Physical and computational principles of bfieldtools},journal={Journal of Applied Physics},volume={128},number={6},pages={063906},year={2020},doi={10.1063/5.0016090},URL={https://doi.org/10.1063/5.0016090},eprint={https://doi.org/10.1063/5.0016090}}@article{doi:10.1063/5.0016087,author={Zetter, Rasmus and Mäkinen, Antti J. and Iivanainen, Joonas and Zevenhoven, Koos C. J. and Ilmoniemi, Risto J. and Parkkonen, Lauri},title={Magnetic field modeling with surface currents. Part II. Implementation and usage of bfieldtools},journal={Journal of Applied Physics},volume={128},number={6},pages={063905},year={2020},doi={10.1063/5.0016087},URL={https://doi.org/10.1063/5.0016087},eprint={https://doi.org/10.1063/5.0016087}}When using the thermal noise computations, please cite thispreprintin arXiv.Contributingbfieldtools is under active development, and contributions are warmly welcome! For new functionality, please write tests to accompany the code! bfieldtools usesBlackfor code style enforcement, please run Black on any new code.In general, The MNE-Python project providesan overview of good practicesthat (when applicable) should be followed in bfieldtools as well.Licensebfieldtools isBSD-licenced(3 clause):Copyright (c) 2019, authors of bfieldtools.
All rights reserved.Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.Neither the names of bfieldtools authors nor the names of any
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.This software is provided by the copyright holders and contributors
“as is” and any express or implied warranties, including, but not
limited to, the implied warranties of merchantability and fitness for
a particular purpose are disclaimed. In no event shall the copyright
owner or contributors be liable for any direct, indirect, incidental,
special, exemplary, or consequential damages (including, but not
limited to, procurement of substitute goods or services; loss of use,
data, or profits; or business interruption) however caused and on any
theory of liability, whether in contract, strict liability, or tort
(including negligence or otherwise) arising in any way out of the use
of this software, even if advised of the possibility of such
damage.