{"id":32175846,"url":"https://github.com/magpylib/magpylib","last_synced_at":"2025-10-21T19:50:11.094Z","repository":{"id":37548544,"uuid":"169390106","full_name":"magpylib/magpylib","owner":"magpylib","description":"Python package for computation of magnetic fields of magnets, currents and moments.","archived":false,"fork":false,"pushed_at":"2025-10-21T14:06:38.000Z","size":44571,"stargazers_count":308,"open_issues_count":64,"forks_count":60,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-10-21T19:49:29.455Z","etag":null,"topics":["analytical-solution","electromagnetic-fields","electromagnetism","magnetism","physics","physics-simulation","scientific"],"latest_commit_sha":null,"homepage":"https://magpylib.readthedocs.io/en/stable/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magpylib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-06T10:39:43.000Z","updated_at":"2025-10-21T10:52:29.000Z","dependencies_parsed_at":"2023-09-24T05:26:18.292Z","dependency_job_id":"91acebae-574b-4cee-ba61-422f56a78041","html_url":"https://github.com/magpylib/magpylib","commit_stats":{"total_commits":1634,"total_committers":19,"mean_commits":86.0,"dds":0.6682986536107711,"last_synced_commit":"a3d748185a97f902d9efc1fa72e80e07624c1214"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"purl":"pkg:github/magpylib/magpylib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magpylib%2Fmagpylib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magpylib%2Fmagpylib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magpylib%2Fmagpylib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magpylib%2Fmagpylib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magpylib","download_url":"https://codeload.github.com/magpylib/magpylib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magpylib%2Fmagpylib/sbom","scorecard":{"id":145362,"data":{"date":"2025-08-11","repo":{"name":"github.com/magpylib/magpylib","commit":"b92025e02b1988317957583f230119b71f81bf5c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":6.5,"checks":[{"name":"Maintained","score":10,"reason":"11 commit(s) and 18 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/cd.yml:41","Warn: no topLevel permission defined: .github/workflows/cd.yml:1","Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cd.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/cd.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cd.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/cd.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cd.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/cd.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cd.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/cd.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cd.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/cd.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/magpylib/magpylib/ci.yml/main?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":2,"reason":"badge detected: InProgress","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/cd.yml:34"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":5,"reason":"SAST tool is not run on all commits -- score normalized to 5","details":["Warn: 15 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T09:17:36.799Z","repository_id":37548544,"created_at":"2025-08-16T09:17:36.800Z","updated_at":"2025-08-16T09:17:36.800Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280325299,"owners_count":26311419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytical-solution","electromagnetic-fields","electromagnetism","magnetism","physics","physics-simulation","scientific"],"created_at":"2025-10-21T19:50:06.237Z","updated_at":"2025-10-21T19:50:11.087Z","avatar_url":"https://github.com/magpylib.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# magpylib\n\n[![Actions Status][actions-badge]][actions-link]\n[![Documentation Status][rtd-badge]][rtd-link]\n\n[![PyPI version][pypi-version]][pypi-link]\n[![Conda-Forge][conda-badge]][conda-link]\n[![PyPI platforms][pypi-platforms]][pypi-link]\n\n[![GitHub Discussion][github-discussions-badge]][github-discussions-link]\n\n\u003c!-- SPHINX-START --\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n[actions-badge]:            https://github.com/magpylib/magpylib/workflows/CI/badge.svg\n[actions-link]:             https://github.com/magpylib/magpylib/actions\n[conda-badge]:              https://img.shields.io/conda/vn/conda-forge/magpylib\n[conda-link]:               https://github.com/conda-forge/magpylib-feedstock\n[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions\u0026message=Ask\u0026color=blue\u0026logo=github\n[github-discussions-link]:  https://github.com/magpylib/magpylib/discussions\n[pypi-link]:                https://pypi.org/project/magpylib/\n[pypi-platforms]:           https://img.shields.io/pypi/pyversions/magpylib\n[pypi-version]:             https://img.shields.io/pypi/v/magpylib\n[rtd-badge]:                https://readthedocs.org/projects/magpylib/badge/?version=latest\n[rtd-link]:                 https://magpylib.readthedocs.io/en/latest/?badge=latest\n\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003e [!WARNING] Version 5 introduces critical breaking changes with, among others,\n\u003e the _move to SI units_. We recommended to pin your dependencies to\n\u003e `magpylib\u003e=4.5\u003c5` until you are ready to migrate to the latest version!\n\u003e ([see details](https://github.com/magpylib/magpylib/discussions/647))\n\n\u003cp align=\"left\"\u003e\u003cimg align=\"center\" src=docs/_static/images/magpylib_flag.png width=35%\u003e\n\u003c/p\u003e\n\nMagpylib is an **open-source Python package** for calculating static **magnetic\nfields** of magnets, currents, and other sources. It uses **analytical\nexpressions**, solutions to macroscopic magnetostatic problems, implemented in\n**vectorized** form which makes the computation **extremely fast** and leverages\nthe open-source Python ecosystem for spectacular visualizations!\n\n# Installation\n\nInstall from PyPI using **pip**\n\n```\npip install magpylib\n```\n\nInstall from conda forge using **conda**\n\n```\nconda install -c conda-forge magpylib\n```\n\nMagpylib supports _Python3.11+_ and relies on common scientific computation\nlibraries _NumPy_, _Scipy_, _Matplotlib_ and _Plotly_. Optionally, _Pyvista_ is\nrecommended as graphical backend.\n\n# Resources\n\n- Check out our **[Documentation](https://magpylib.readthedocs.io/en/stable)**\n  for detailed information about the last stable release, or the\n  **[Dev Docs](https://magpylib.readthedocs.io/en/latest)** to see the\n  unreleased development version features.\n- Please abide by our\n  **[Code of Conduct](https://github.com/magpylib/magpylib/blob/main/CODE_OF_CONDUCT.md)**.\n- Contribute through\n  **[Discussions](https://github.com/magpylib/magpylib/discussions)** and coding\n  by following the\n  **[Contribution Guide](https://github.com/magpylib/magpylib/blob/main/CONTRIBUTING.md)**.\n  The Git project **[Issues](https://github.com/magpylib/magpylib/issues)** give\n  an up-to-date list of potential enhancements and planned milestones. Propose\n  new ones.\n- A **[Youtube video](https://www.youtube.com/watch?v=LeUx6cM1vcs)**\n  introduction to Magpylib v4.0.0 within the\n  **[GSC network](https://www.internationalcollaboration.org/).**\n- An\n  **[open-access paper](https://www.sciencedirect.com/science/article/pii/S2352711020300170)**\n  from the year 2020 describes v2 of this library with most basic concepts still\n  intact in later versions.\n\n# Quickstart\n\nHere is an example on how to use Magpylib.\n\n```python\nimport magpylib as magpy\n\n# Create a Cuboid magnet with sides 1, 2 and 3 cm respectively, and a polarization\n# of 1000 mT pointing in x-direction.\ncube = magpy.magnet.Cuboid(\n    polarization=(1, 0, 0),  # in SI Units (T)\n    dimension=(0.01, 0.02, 0.03),  # in SI Units (m)\n)\n\n# By default, the magnet position is (0, 0, 0) and its orientation is the unit\n# rotation (given by a scipy rotation object), which corresponds to magnet sided\n# parallel to global coordinate axes.\nprint(cube.position)  # --\u003e [0. 0. 0.]\nprint(cube.orientation.as_rotvec())  # --\u003e [0. 0. 0.]\n\n# Manipulate object position and orientation through the respective attributes,\n# or by using the powerful `move()` and `rotate()` methods.\ncube.move((0, 0, -0.02))  # in SI Units (m)\ncube.rotate_from_angax(angle=45, axis=\"z\")\nprint(cube.position)  # --\u003e [0. 0. -0.02]\nprint(cube.orientation.as_rotvec(degrees=True))  # --\u003e [0. 0. 45.]\n\n# Compute the magnetic B-field in units of T at a set of observer positions. Magpylib\n# makes use of vectorized computation. Hand over all field computation instances,\n# e.g. different observer positions, at one function call. Avoid Python loops !!!\nobservers = [(0, 0, 0), (0.01, 0, 0), (0.02, 0, 0)]  # in SI Units (m)\nB = magpy.getB(cube, observers)\nprint(B.round(2))  # --\u003e [[-0.09 -0.09  0.  ]\n#                         [ 0.   -0.04  0.08]\n#                         [ 0.02 -0.01  0.03]]  # in SI Units (T)\n\n# Sensors are observer objects that can have their own position and orientation.\n# Compute the H-field in units of A/m.\nsensor = magpy.Sensor(position=(0, 0, 0))\nsensor.rotate_from_angax(angle=45, axis=(1, 1, 1))\nH = magpy.getH(cube, sensor)\nprint(H.round())  # --\u003e [-94537. -35642. -14085.]  # in SI Units (A/m)\n\n# Position and orientation attributes of Magpylib objects can be vectors of\n# multiple positions/orientations referred to as \"paths\". When computing the\n# magnetic field of an object with a path, it is computed at every path index.\ncube.position = [(0, 0, -0.02), (1, 0, -0.02), (2, 0, -0.02)]  # in SI Units (m)\nB = cube.getB(sensor)\nprint(B.round(2))  # --\u003e [[-0.12 -0.04 -0.02]\n#                         [ 0.   -0.    0.  ]\n#                         [ 0.   -0.    0.  ]] # in SI Units (T)\n\n# When several objects are involved and things are getting complex, make use of\n# the `show()` function to view your system through Matplotlib, Plotly or Pyvista backends.\nmagpy.show(cube, sensor, backend=\"pyvista\")\n```\n\nMore details and other important features are described in detail in the\n**[Documentation](https://magpylib.readthedocs.io/en/stable)**. Key features\nare:\n\n- **Collections**: Group multiple objects for common manipulation\n- **Complex shapes**: Create magnets with arbitrary shapes\n- **Graphics**: Styling options, graphic backends, animations, and 3D models\n- **CustomSource**: Integrate your own field implementation\n- **Direct interface**: Bypass the object oriented interface (max speed)\n\n# How can I cite this library ?\n\nWe would be happy if you give us credit for our efforts. A valid bibtex entry\nfor the\n[2020 open-access paper](https://www.sciencedirect.com/science/article/pii/S2352711020300170)\nwould be\n\n```\n@article{ortner2020magpylib,\n  title={Magpylib: A free Python package for magnetic field computation},\n  author={Ortner, Michael and Bandeira, Lucas Gabriel Coliado},\n  journal={SoftwareX},\n  volume={11},\n  pages={100466},\n  year={2020},\n  publisher={Elsevier}\n}\n```\n\nA valid software citation could be\n\n```\n@software{magpylib,\n    author = {{Michael-Ortner et al.}},\n    title = {magpylib},\n    url = {https://magpylib.readthedocs.io/en/latest/},\n    version = {5.2.1},\n    date = {2023-06-25},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagpylib%2Fmagpylib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagpylib%2Fmagpylib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagpylib%2Fmagpylib/lists"}