Skip to main content

pyCoilGen

GitHub license PyPI - Python Version semver GitHub tag (latest SemVer) Code style: autopep8

pyCoilGen logo

The pyCoilGen project is an open source tool for generating coil winding layouts, such as gradient field coils, within the MRI and NMR environments. pyCoilGen is based on a boundary element method and generates interconnected non-overlapping wire-tracks on 3D support structures.

This Python project is a port of the MATLAB CoilGen code developed by Philipp Amrein.

For detailed documentation, refer to the pyCoilGen Documentation.

Installation

Refer to the Installation Guide for detailed instructions on how to install and set up pyCoilGen.

Compatibility

Release 0.3.0 and later require Python >= 3.11. If you are bound to an older Python, pip installs the newest release that supports it, or name a release, for example pip install pycoilgen==0.2.4.

Release Python numpy scipy
0.0.8 to 0.1.1 3.7 to 3.10 (declared >= 3.6) ==1.21.6 ==1.7.3
0.1.2 to 0.2.4 3.6 to 3.12 (declared >= 3.6) 1.* 1.*
0.3.0 to 0.6.0 >= 3.11, tested on 3.11 and 3.13 >= 1.26, < 3 >= 1.11, < 2

See Compatibility for details, including the tested environments.

From release 0.6.0, the optional fast extra (pip install pycoilgen[fast]) compiles the largest calculations with Numba and uses all CPU cores, which makes designs up to 90 times faster than release 0.4.0 (6 to 28 times with numpy alone, from the vectorised steps), with identical results. See Install Fast Extras.

Known Issues and Bug Fixes

Release 0.4.0 corrects the units of ohmian_resistance: it was computed as L / (A * value) with the copper resistivity (0.018e-6 Ohm·m) as specific_conductivity_conductor, giving about 1e12 Ohm. It is now R = rho * L / A. The parameter is also renamed specific_resistivity_conductor; the old name is deprecated. Results of 0.3.0 and earlier should be recomputed. See Bug fixes.

Examples

The examples directory contains several examples for how to use pyCoilGen. These examples demonstrate different scenarios and configurations for generating coil layouts.

Acknowledgements

The porting of the code from MATLAB to Python was facilitated by ChatGPT, May 24 through August 3 Version with manual corrections.

Additional cross-checking was done using MATLAB Online provided by MathWorks.

The performance improvements of release 0.6.0 (the vectorised pipeline steps and the optional Numba kernels) were developed with Claude Sonnet from Anthropic, using Claude Code. The results were checked against the previous implementations and the regression harness.

The circular bi-planar mesh builder, the Gerber and groove plate exporters and the independent field verification (release 0.3.0) are based on ideas from pull request #82 by Sairam Geethanath, re-implemented to fit the existing pipeline.

Contributing

If you'd like to contribute to pyCoilGen, follow the guidelines outlined in the Contributing Guide.

License

See LICENSE.txt for more information.

Contact

For inquiries and discussion, use pyCoilGen Discussions.

Issues

For issues related to this Python implementation, visit the Issues page.

Citation

Use the following publication, if you need to cite this work:

Metadata

Release files for pycoilgen 0.6.0

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

Source distribution (sdist)

Source distribution for pycoilgen 0.6.0
File Size Uploaded Provenance Actions
pycoilgen-0.6.0.tar.gz 178.0 kB Without provenance Details for pycoilgen-0.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 380.8 kB

Release files / pycoilgen-0.6.0.tar.gz

Download URL pycoilgen-0.6.0.tar.gz
Size 178.0 kB
Tags Source
SHA-256 checksum
How to use checksums
614e89eb4817976e31ab91dcf7c713c86cfb2bf0722838d58594f393916a129e
BLAKE2b-256 checksum
How to use checksums
46838e67c0cc077106cb7923eaab2d588561170c6ea30d2bd2e1188ec4669355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / pycoilgen-0.6.0-py3-none-any.whl

Download URL pycoilgen-0.6.0-py3-none-any.whl
Size 202.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b14ac3c2ddc8561073e623341fe48bdeb73cab3609078df3a4bf983c345e8120
BLAKE2b-256 checksum
How to use checksums
11de81713f7c7820f1b2a232248b5a452e3c09ce7a9de000a2641e3faa463f28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Security for pycoilgen 0.6.0

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