Skip to main content

FieldSmith

Python 3.11+ PyTorch Version 0.1.4.dev1

FieldSmith is a PyTorch-based framework for designing, optimizing, and evaluating permanent-magnet arrays. It provides differentiable magnetic-field models, reusable geometry and sampling components, gradient-based optimization workflows, and tools for checking designs under realistic physics and manufacturing tolerances.

The package focuses on Halbach rings and multi-ring systems, the ROMA geometry, and open-cap/dome arrays for low-field MRI applications.

Disclaimer

The software is not qualified for use as a medical product or as part thereof. Provided 'as is' without specific verification or validation.

Capabilities

  • Build and optimize geometries such as Halbach rings, multi-ring, ROMA, and dome magnet arrays.
  • Calculate differentiable fields with fast dipole or finite cuboid models.
  • Run gradient-based optimization of magnet orientations, positions, and other parameters within the PyTorch framework.
  • Evaluate field strength, peak-to-peak homogeneity, and RMS deviation.
  • Run Monte Carlo studies of manufacturing tolerances.
  • Move magnets within bounded boxes under a clearance penalty, and export a design as printable plates with seats, lids and fastening rails.

Installation

FieldSmith requires Python 3.11 or newer.

python -m pip install fieldsmith

For a specific CPU or CUDA build, install a compatible version of PyTorch first, then install FieldSmith. See the PyTorch installation guide.

Quick start

Compute the magnetic field at two points outside a single cubic magnet. Positions are in meters, volumes are in cubic meters, and the returned field is in tesla.

import torch

from fieldsmith.configurations import MagnetConfiguration
from fieldsmith.evaluation import field_at_points

magnet_size_m = 0.01
configuration = MagnetConfiguration(
    positions=torch.zeros((1, 3), dtype=torch.float64),
    orientations=torch.tensor([[1.0, 0.0, 0.0]], dtype=torch.float64),
    volumes=torch.tensor([magnet_size_m**3], dtype=torch.float64),
    remanence=1.2,
    metadata={"magnet_size_m": magnet_size_m},
)
points = torch.tensor([[0.03, 0.0, 0.0], [0.0, 0.03, 0.0]], dtype=torch.float64)
field = field_at_points(configuration, points, field_model="cuboid")
print(field)

The kernels preserve PyTorch gradients and support point chunking to control memory use. Field points can come from a Cartesian grid, a masked region of interest, or an arbitrary point cloud. Optimization objectives include exact and smoothed peak-to-peak homogeneity, RMS deviation, field-strength constraints, and collision penalties.

Outputs and checkpoints

TrainLoop stores periodic MagnetConfiguration checkpoints at configurations/epoch_<N>.pt under the configured logger directory, including when W&B logging is disabled.

License

FieldSmith is distributed under the FRAUNHOFER »fieldsmith« LICENSE FOR SCIENTIFIC NON-COMMERCIAL RESEARCH PURPOSES. The full license is included in the package as LICENSE.

Citing

As soon as the paper is published the citing template of the software-related paper will be added here.

Support or contact

For support with regard to the FieldSmith software please contact:

Metadata

Release files for fieldsmith 0.1.4

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

Source distribution (sdist)

Source distribution for fieldsmith 0.1.4
File Size Uploaded Provenance Actions
fieldsmith-0.1.4.tar.gz 124.4 kB Without provenance Details for fieldsmith-0.1.4.tar.gz

Built distribution (wheel)

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

Total release size: 228.5 kB

Release files / fieldsmith-0.1.4.tar.gz

Download URL fieldsmith-0.1.4.tar.gz
Size 124.4 kB
Tags Source
SHA-256 checksum
How to use checksums
73319819106e47b97066b5a552bff397c7cd67c8fc11ee80f49ac4acc50924ec
BLAKE2b-256 checksum
How to use checksums
b020ab7eb6f1a0d90ff257ef6ca96ba782ab3dc936b32b67c063ce8a81b72720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / fieldsmith-0.1.4-py3-none-any.whl

Download URL fieldsmith-0.1.4-py3-none-any.whl
Size 104.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3597e8339878c8f34290ab0a05e1044b1d8b38730c7527eaf0a5c8db67c58161
BLAKE2b-256 checksum
How to use checksums
8ce7197da850d9d5eda9e2f9e7c75af37509942d3baaba28bb0dbf2fd63a7f23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for fieldsmith 0.1.4

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.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files No provenance

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