cfsem 2.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. cfsem-2.0.4/.cargo/config.toml +2 -0
  2. cfsem-2.0.4/.github/workflows/CI.yml +119 -0
  3. cfsem-2.0.4/.github/workflows/actions.yml +64 -0
  4. cfsem-2.0.4/.gitignore +81 -0
  5. cfsem-2.0.4/.readthedocs.yml +23 -0
  6. cfsem-2.0.4/CHANGELOG.md +59 -0
  7. cfsem-2.0.4/CONTRIBUTING.md +5 -0
  8. cfsem-2.0.4/Cargo.lock +542 -0
  9. cfsem-2.0.4/Cargo.toml +27 -0
  10. cfsem-2.0.4/LICENSE +21 -0
  11. cfsem-2.0.4/PKG-INFO +103 -0
  12. cfsem-2.0.4/README.md +77 -0
  13. cfsem-2.0.4/build_docs.sh +11 -0
  14. cfsem-2.0.4/cfsem/__init__.py +536 -0
  15. cfsem-2.0.4/cfsem/bindings.py +362 -0
  16. cfsem-2.0.4/cfsem/py.typed +0 -0
  17. cfsem-2.0.4/cfsem/types.py +7 -0
  18. cfsem-2.0.4/docs/index.md +9 -0
  19. cfsem-2.0.4/docs/javascripts/mathjax.js +19 -0
  20. cfsem-2.0.4/docs/python/example_outputs/.placeholder +0 -0
  21. cfsem-2.0.4/docs/python/examples.md +30 -0
  22. cfsem-2.0.4/docs/python/filament.md +7 -0
  23. cfsem-2.0.4/docs/python/flux_density.md +9 -0
  24. cfsem-2.0.4/docs/python/grad_shafranov.md +5 -0
  25. cfsem-2.0.4/docs/python/inductance.md +25 -0
  26. cfsem-2.0.4/docs/python/math.md +7 -0
  27. cfsem-2.0.4/docs/python/types.md +5 -0
  28. cfsem-2.0.4/docs/requirements.txt +1 -0
  29. cfsem-2.0.4/examples/helmholtz.py +107 -0
  30. cfsem-2.0.4/examples/inductance.py +79 -0
  31. cfsem-2.0.4/mkdocs.yml +53 -0
  32. cfsem-2.0.4/pyproject.toml +47 -0
  33. cfsem-2.0.4/src/lib.rs +445 -0
  34. cfsem-2.0.4/test/__init__.py +0 -0
  35. cfsem-2.0.4/test/test_electromagnetics.py +507 -0
  36. cfsem-2.0.4/test/test_examples.py +21 -0
  37. cfsem-2.0.4/test/test_filaments.py +97 -0
  38. cfsem-2.0.4/test/test_funcs.py +196 -0
  39. cfsem-2.0.4/test/test_gradshafranov.py +51 -0
  40. cfsem-2.0.4/test/test_math.py +18 -0
@@ -0,0 +1,2 @@
1
+ [target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))']
2
+ rustflags = ["-Ctarget-feature=+fma"]
@@ -0,0 +1,119 @@
1
+ # This file is autogenerated by maturin v1.3.0
2
+ # To update, run
3
+ #
4
+ # maturin generate-ci github
5
+ #
6
+ name: CI
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ - release
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ linux:
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
23
+ python-version: ['3.9', '3.10', '3.11', '3.12']
24
+ steps:
25
+ - uses: actions/checkout@v3
26
+ - uses: actions/setup-python@v4
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+ - name: Build wheels
30
+ uses: PyO3/maturin-action@v1
31
+ with:
32
+ target: ${{ matrix.target }}
33
+ args: --release --out dist --find-interpreter
34
+ sccache: 'true'
35
+ manylinux: auto
36
+ - name: Upload wheels
37
+ uses: actions/upload-artifact@v3
38
+ with:
39
+ name: wheels
40
+ path: dist
41
+
42
+ windows:
43
+ runs-on: windows-latest
44
+ strategy:
45
+ matrix:
46
+ target: [x64, x86]
47
+ python-version: ['3.9', '3.10', '3.11', '3.12']
48
+ steps:
49
+ - uses: actions/checkout@v3
50
+ - uses: actions/setup-python@v4
51
+ with:
52
+ python-version: ${{ matrix.python-version }}
53
+ architecture: ${{ matrix.target }}
54
+ - name: Build wheels
55
+ uses: PyO3/maturin-action@v1
56
+ with:
57
+ target: ${{ matrix.target }}
58
+ args: --release --out dist --find-interpreter
59
+ sccache: 'true'
60
+ - name: Upload wheels
61
+ uses: actions/upload-artifact@v3
62
+ with:
63
+ name: wheels
64
+ path: dist
65
+
66
+ macos:
67
+ runs-on: macos-latest
68
+ strategy:
69
+ matrix:
70
+ target: [x86_64, aarch64]
71
+ python-version: ['3.9', '3.10', '3.11', '3.12']
72
+ steps:
73
+ - uses: actions/checkout@v3
74
+ - uses: actions/setup-python@v4
75
+ with:
76
+ python-version: ${{ matrix.python-version }}
77
+ - name: Build wheels
78
+ uses: PyO3/maturin-action@v1
79
+ with:
80
+ target: ${{ matrix.target }}
81
+ args: --release --out dist --find-interpreter
82
+ sccache: 'true'
83
+ - name: Upload wheels
84
+ uses: actions/upload-artifact@v3
85
+ with:
86
+ name: wheels
87
+ path: dist
88
+
89
+ sdist:
90
+ runs-on: ubuntu-latest
91
+ steps:
92
+ - uses: actions/checkout@v3
93
+ - name: Build sdist
94
+ uses: PyO3/maturin-action@v1
95
+ with:
96
+ command: sdist
97
+ args: --out dist
98
+ - name: Upload sdist
99
+ uses: actions/upload-artifact@v3
100
+ with:
101
+ name: wheels
102
+ path: dist
103
+
104
+ release:
105
+ name: Release
106
+ runs-on: ubuntu-latest
107
+ #if: "startsWith(github.ref, 'refs/tags/')"
108
+ needs: [linux, windows, macos, sdist]
109
+ steps:
110
+ - uses: actions/download-artifact@v3
111
+ with:
112
+ name: wheels
113
+ - name: Publish to PyPI
114
+ uses: PyO3/maturin-action@v1
115
+ env:
116
+ MATURIN_PYPI_TOKEN: ${{ secrets.MATURIN_PASSWORD }}
117
+ with:
118
+ command: upload
119
+ args: --non-interactive --skip-existing *
@@ -0,0 +1,64 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: build_and_test
5
+
6
+ on:
7
+ # push: [] # Save time on actions
8
+ pull_request: []
9
+ workflow_dispatch:
10
+ tag: "Manual Run"
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-22.04
15
+ timeout-minutes: 15
16
+ strategy:
17
+ matrix:
18
+ python-version: ['3.9', '3.10', '3.11', '3.12']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ uses: actions/setup-python@v1
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+ - name: Setup
27
+ run: |
28
+
29
+ # Base setup
30
+ sudo apt update
31
+ sudo apt install build-essential
32
+
33
+ # Install Rust & Cargo
34
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
35
+ rustup component add clippy
36
+
37
+ # Set up pip and a virtualenv (s.t. maturin can run)
38
+ python -m pip install --upgrade pip
39
+ python -m venv ./env
40
+ source ./env/bin/activate
41
+
42
+ # Install with dev deps
43
+ pip install maturin
44
+ maturin develop
45
+ pip install .[dev]
46
+
47
+ - name: Test
48
+ run: |
49
+ source ./env/bin/activate
50
+
51
+ # Python lint, test, and coverage
52
+ ruff check ./cfsem
53
+ pyright ./cfsem --pythonversion 3.11
54
+ coverage run --source=./cfsem -m pytest ./test/
55
+ coverage report
56
+
57
+ # Rust format and lint
58
+
59
+ cargo fmt --check
60
+ cargo clippy
61
+
62
+ # Build docs
63
+
64
+ sh build_docs.sh
cfsem-2.0.4/.gitignore ADDED
@@ -0,0 +1,81 @@
1
+ /target
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ .pytest_cache/
6
+ *.py[cod]
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ .venv/
14
+ env/
15
+ bin/
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ include/
26
+ man/
27
+ venv/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ *.ruff_cache
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+ pip-selfcheck.json
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .coverage
42
+ .cache
43
+ nosetests.xml
44
+ coverage.xml
45
+
46
+ # Translations
47
+ *.mo
48
+
49
+ # Mr Developer
50
+ .mr.developer.cfg
51
+ .project
52
+ .pydevproject
53
+
54
+ # Rope
55
+ .ropeproject
56
+
57
+ # Django stuff:
58
+ *.log
59
+ *.pot
60
+
61
+ .DS_Store
62
+
63
+ # Sphinx documentation
64
+ docs/_build/
65
+
66
+ # PyCharm
67
+ .idea/
68
+
69
+ # VSCode
70
+ .vscode/
71
+
72
+ # Pyenv
73
+ .python-version
74
+
75
+ target
76
+
77
+ # Documentation site generated by mkdocs.
78
+ site
79
+
80
+ examples/*.png
81
+ docs/python/example_outputs/*.png
@@ -0,0 +1,23 @@
1
+ # Read the Docs configuration file for MkDocs projects
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ # Required
5
+ version: 2
6
+
7
+ # Set the version of Python and other tools you might need
8
+ build:
9
+ os: ubuntu-22.04
10
+ tools:
11
+ python: "3.11"
12
+ rust: "1.70"
13
+ jobs:
14
+ pre_build: # Generate plots for docs
15
+ - MPLBACKEND="Agg" sh build_docs.sh
16
+
17
+ mkdocs:
18
+ configuration: mkdocs.yml
19
+
20
+ # Optionally declare the Python requirements required to build your docs
21
+ python:
22
+ install:
23
+ - requirements: docs/requirements.txt
@@ -0,0 +1,59 @@
1
+ # Changelog
2
+
3
+ ## 2.0.4 2024-07-10
4
+
5
+ ### Changed
6
+
7
+ * Use `cfsem` rust dep from crates.io
8
+ * Update docs and license for open-souce release
9
+
10
+ ## 2.0.3 2024-07-09
11
+
12
+ ### Changed
13
+
14
+ * Support python 3.12
15
+
16
+ ## 2.0.2 2024-07-02
17
+
18
+ ### Changed
19
+
20
+ * Update filament_coil function to use np.meshgrid instead of nested comprehension
21
+ * Update test of filament_coil to check against previous version of calc
22
+ * Move filamentization tests to their own test file
23
+ * Update nalgebra dep
24
+ * Update ruff dep
25
+
26
+ ## 2.0.1 2024-06-18
27
+
28
+ ### Changed
29
+
30
+ * Improve docstrings
31
+ * Test building docs in CI
32
+ * Update length checks in `inductance_piecewise_linear_filaments` to allow use when first and second path do not have the same number of segments
33
+
34
+ ## 2.0.0 2024-05-10
35
+
36
+ ### Changed
37
+
38
+ * (!) Transpose filament_helix_path() array inputs and outputs to eliminate some unnecessary copies
39
+ * (!) Transpose array inputs to piecewise linear inductance methods to eliminate some unnecessary copies
40
+ * Remove dep on scipy for release (now dev only)
41
+ * Add more parametrized cases to tests for filament_helix_path
42
+ * Use cubic interpolation method for boundary flux in distributed inductance calc
43
+ * Update flux_density_biot_savart rust function to mutate an input slice instead of allocating locally
44
+ * Parametrize tests of flux_density_biot_savart over parallel and serial implementations
45
+ * Add optional parallel flag to flux_density_biot_savart python bindings
46
+ * Roll forward rust deps on numpy and pyo3
47
+ * Run linting, tests, and coverage directly and remove dep on pre-commit
48
+
49
+ ### Added
50
+
51
+ * Add `mesh` module in rust library
52
+ * Add rust implementation of filament_helix_path()
53
+ * Add rotate_filaments_about_path() via rust bindings
54
+ * Add CHANGELOG.md
55
+ * Add MU_0 from handcalc to eliminate scipy dep
56
+ * Add _filament_helix_path_py to test functions
57
+ * Integrated error over the length of a filament makes this not very useful for testing against new calc
58
+ * Add flux_density_biot_savart_par in rust library
59
+ * Add nalgebra and rayon to rust deps
@@ -0,0 +1,5 @@
1
+ # Contributing
2
+
3
+ Contributions consistent with the goals and anti-goals of the package are welcome.
4
+
5
+ Please make an issue ticket to discuss changes before investing significant time into a branch.