Skip to main content

bfieldtools


GH-Actions Codecov Zenodo pypi

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 features
  • Discrete calculus on triangle meshes, including the Laplacian, gradient, divergence and curl

  • Mesh operators (matrices) for inductance and resistance

  • Magnetic field as well as scalar and vector potentials of surface-current densities

  • Magnetic field as well as scalar and vector potentials of polyline currents

  • Spherical harmonics (multipole) representation of the magnetic field

  • Surface harmonics (Laplace-Beltrami eigenfunctions) for series expansion of the stream function

  • Coil design using convex optimization

  • Magnetic thermal noise of thin conductors

Dependencies

Requires Python 3.8 or newer, preferably >3.10.

Documentation

Online documentation, including an API reference and examples can be found at https://bfieldtools.github.io/.

Installing bfieldtools

To install bfieldtools using pip, simply run:

pip install bfieldtools

For advanced installation instructions, see the online installation instructions.

Citing bfieldtools

When 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 this preprint in arXiv.

Contributing

bfieldtools is under active development, and contributions are warmly welcome! For new functionality, please write tests to accompany the code! bfieldtools uses Black for code style enforcement, please run Black on any new code.

In general, The MNE-Python project provides an overview of good practices that (when applicable) should be followed in bfieldtools as well.

License

bfieldtools is BSD-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.

Metadata

Release files for bfieldtools 0.11.3

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

Source distribution (sdist)

Source distribution for bfieldtools 0.11.3
File Size Uploaded Provenance
bfieldtools-0.11.3.tar.gz 46.9 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bfieldtools 0.11.3
File Interpreter ABI Platform
bfieldtools-0.11.3-py3-none-any.whl Python 3 none any Details

Total release size: 48.1 MB

Release files / bfieldtools-0.11.3.tar.gz

Download URL bfieldtools-0.11.3.tar.gz
Size 46.9 MB
Tags Source
SHA-256 checksum
How to use checksums
1b54c492e7f8be689f4cdf0fd6a1f51ac0d4c2a060c994dc84214d06edc6f79a
BLAKE2b-256 checksum
How to use checksums
52d6214668135b986952b98ee8fa1f8f0f990a6f6b984e05437eb59af2cf881e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / bfieldtools-0.11.3-py3-none-any.whl

Download URL bfieldtools-0.11.3-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
af4173fe96c788b120e1d3e510c986c8e2a99f89bdda4e633444f79013805bd9
BLAKE2b-256 checksum
How to use checksums
c9c633b2509c714506f2c92023bd1de10c8cc318e9acfcab8de89f41cb112634
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Security for bfieldtools 0.11.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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