PyFinitDiff 2.3.0__tar.gz → 2.3.2__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 (88) hide show
  1. pyfinitdiff-2.3.2/PKG-INFO +213 -0
  2. pyfinitdiff-2.3.2/PyFinitDiff/_version.py +5 -0
  3. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/coefficients/backward.py +12 -1
  4. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/coefficients/central.py +2 -2
  5. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/coefficients/forward.py +12 -1
  6. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_2D/boundaries.py +0 -1
  7. pyfinitdiff-2.3.2/PyFinitDiff.egg-info/PKG-INFO +213 -0
  8. pyfinitdiff-2.3.2/PyFinitDiff.egg-info/SOURCES.txt +35 -0
  9. pyfinitdiff-2.3.2/PyFinitDiff.egg-info/requires.txt +23 -0
  10. pyfinitdiff-2.3.2/README.rst +171 -0
  11. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/pyproject.toml +27 -51
  12. pyfinitdiff-2.3.2/tests/test_eighth_order_first_derivative.py +27 -0
  13. pyfinitdiff-2.3.0/.flake8 +0 -11
  14. pyfinitdiff-2.3.0/.github/dependabot.yml +0 -11
  15. pyfinitdiff-2.3.0/.github/workflows/deploy_PyPi.yml +0 -20
  16. pyfinitdiff-2.3.0/.github/workflows/deploy_anaconda.yml +0 -21
  17. pyfinitdiff-2.3.0/.github/workflows/deploy_coverage.yml +0 -25
  18. pyfinitdiff-2.3.0/.github/workflows/deploy_documentation.yml +0 -24
  19. pyfinitdiff-2.3.0/.gitignore +0 -28
  20. pyfinitdiff-2.3.0/PKG-INFO +0 -208
  21. pyfinitdiff-2.3.0/PyFinitDiff/_version.py +0 -34
  22. pyfinitdiff-2.3.0/PyFinitDiff.egg-info/PKG-INFO +0 -208
  23. pyfinitdiff-2.3.0/PyFinitDiff.egg-info/SOURCES.txt +0 -79
  24. pyfinitdiff-2.3.0/PyFinitDiff.egg-info/requires.txt +0 -21
  25. pyfinitdiff-2.3.0/README.rst +0 -145
  26. pyfinitdiff-2.3.0/docs/Makefile +0 -19
  27. pyfinitdiff-2.3.0/docs/examples/README.rst +0 -6
  28. pyfinitdiff-2.3.0/docs/examples/eigenmodes_1d/README.rst +0 -2
  29. pyfinitdiff-2.3.0/docs/examples/eigenmodes_1d/example_0.py +0 -93
  30. pyfinitdiff-2.3.0/docs/examples/eigenmodes_1d/example_1.py +0 -92
  31. pyfinitdiff-2.3.0/docs/examples/eigenmodes_1d/example_2.py +0 -91
  32. pyfinitdiff-2.3.0/docs/examples/eigenmodes_1d/example_3.py +0 -91
  33. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/README.rst +0 -2
  34. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/example_0.py +0 -94
  35. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/example_1.py +0 -94
  36. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/example_2.py +0 -96
  37. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/example_3.py +0 -94
  38. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/example_4.py +0 -90
  39. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/example_5.py +0 -94
  40. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/example_6.py +0 -94
  41. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/example_8.py +0 -95
  42. pyfinitdiff-2.3.0/docs/examples/eigenmodes_2d/examples_7.py +0 -94
  43. pyfinitdiff-2.3.0/docs/examples/extras/README.rst +0 -2
  44. pyfinitdiff-2.3.0/docs/examples/extras/gradient.py +0 -63
  45. pyfinitdiff-2.3.0/docs/examples/extras/plot_WM_field.py +0 -72
  46. pyfinitdiff-2.3.0/docs/examples/triplets/README.rst +0 -2
  47. pyfinitdiff-2.3.0/docs/examples/triplets/plot_triplets_0.py +0 -50
  48. pyfinitdiff-2.3.0/docs/examples/triplets/plot_triplets_1.py +0 -50
  49. pyfinitdiff-2.3.0/docs/examples/triplets/plot_triplets_2.py +0 -51
  50. pyfinitdiff-2.3.0/docs/examples/triplets/plot_triplets_3.py +0 -51
  51. pyfinitdiff-2.3.0/docs/images/logo.png +0 -0
  52. pyfinitdiff-2.3.0/docs/images/triplet_example_0.png +0 -0
  53. pyfinitdiff-2.3.0/docs/make.bat +0 -35
  54. pyfinitdiff-2.3.0/docs/source/_static/default.css +0 -19
  55. pyfinitdiff-2.3.0/docs/source/code.rst +0 -55
  56. pyfinitdiff-2.3.0/docs/source/conf.py +0 -169
  57. pyfinitdiff-2.3.0/docs/source/gallery/index.rst +0 -12
  58. pyfinitdiff-2.3.0/docs/source/index.rst +0 -14
  59. pyfinitdiff-2.3.0/docs/source/references.rst +0 -8
  60. pyfinitdiff-2.3.0/docs/source/sg_execution_times.rst +0 -91
  61. pyfinitdiff-2.3.0/docs/source/theory.rst +0 -7
  62. pyfinitdiff-2.3.0/meta.yaml +0 -62
  63. pyfinitdiff-2.3.0/tests/__init__.py +0 -0
  64. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/LICENSE +0 -0
  65. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/__init__.py +0 -0
  66. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/boundary_values.py +0 -0
  67. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/coefficients/__init__.py +0 -0
  68. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/diagonal.py +0 -0
  69. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/directories.py +0 -0
  70. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_1D/__init__.py +0 -0
  71. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_1D/boundaries.py +0 -0
  72. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_1D/derivative.py +0 -0
  73. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_1D/finite_difference.py +0 -0
  74. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_1D/utils.py +0 -0
  75. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_2D/__init__.py +0 -0
  76. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_2D/derivative.py +0 -0
  77. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_2D/finite_difference.py +0 -0
  78. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/finite_difference_2D/utils.py +0 -0
  79. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff/triplet.py +0 -0
  80. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff.egg-info/dependency_links.txt +0 -0
  81. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/PyFinitDiff.egg-info/top_level.txt +0 -0
  82. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/setup.cfg +0 -0
  83. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/tests/test_1D_api.py +0 -0
  84. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/tests/test_1D_derivative.py +0 -0
  85. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/tests/test_2D_api.py +0 -0
  86. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/tests/test_2D_derivative.py +0 -0
  87. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/tests/test_2D_eigen.py +0 -0
  88. {pyfinitdiff-2.3.0 → pyfinitdiff-2.3.2}/tests/test_triplet.py +0 -0
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyFinitDiff
3
+ Version: 2.3.2
4
+ Summary: A package for generating finite-difference matrices, particularly suited for physics and engineering applications.
5
+ Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/MartinPdeS/PyFinitDiff
8
+ Project-URL: Documentation, https://martinpdes.github.io/PyFinitDiff/
9
+ Project-URL: Repository, https://github.com/MartinPdeS/PyFinitDiff.git
10
+ Keywords: finite-difference,solving,linear algebra,physics,matrix,engineering
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: Implementation :: CPython
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Topic :: Scientific/Engineering :: Physics
18
+ Classifier: Intended Audience :: Science/Research
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/x-rst
21
+ License-File: LICENSE
22
+ Requires-Dist: scipy>=1.14
23
+ Requires-Dist: pydantic<3,>=2
24
+ Requires-Dist: numpy
25
+ Requires-Dist: MPSPlots
26
+ Requires-Dist: tabulate
27
+ Provides-Extra: release
28
+ Requires-Dist: martinpdes-maintenance==0.2.3; extra == "release"
29
+ Provides-Extra: dev
30
+ Requires-Dist: martinpdes-maintenance[quality]==0.2.3; extra == "dev"
31
+ Requires-Dist: twine<7,>=6; extra == "dev"
32
+ Requires-Dist: flake8==7.3.0; extra == "dev"
33
+ Provides-Extra: testing
34
+ Requires-Dist: martinpdes-maintenance[testing]==0.2.3; extra == "testing"
35
+ Requires-Dist: pytest<9,>=7.4; extra == "testing"
36
+ Requires-Dist: pytest-cov<8; extra == "testing"
37
+ Requires-Dist: pytest-json-report~=1.5; extra == "testing"
38
+ Requires-Dist: coverage~=7.6; extra == "testing"
39
+ Provides-Extra: documentation
40
+ Requires-Dist: MartinPdeS-docs<0.5,>=0.4.0; extra == "documentation"
41
+ Dynamic: license-file
42
+
43
+ PyFinitDiff
44
+ ===========
45
+
46
+ .. image:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/HEAD/docs/images/logo.png
47
+ :alt: PyFinitDiff logo
48
+ :width: 100%
49
+
50
+ .. list-table::
51
+ :width: 100%
52
+ :widths: 35 65
53
+ :header-rows: 1
54
+
55
+ * - Badge
56
+ - Status
57
+ * - Python versions
58
+ - |mps-python|
59
+ * - Documentation
60
+ - |mps-docs|
61
+ * - Tests
62
+ - |mps-ci| |mps-coverage|
63
+ * - PyPI
64
+ - |mps-pypi| |mps-downloads|
65
+ * - Conda
66
+ - |mps-conda| |mps-conda-downloads| |mps-conda-release|
67
+
68
+ A package for generating finite-difference matrices, particularly suited for physics and engineering applications.
69
+
70
+ Construct sparse derivative operators from the mesh spacing, derivative order,
71
+ accuracy, and boundary conditions. Inspect the matrix entries before combining the
72
+ operator with a potential or solving an eigenvalue problem.
73
+
74
+ Installation
75
+ ------------
76
+
77
+ Requires Python ``>=3.10``.
78
+
79
+ .. code-block:: console
80
+
81
+ $ python -m pip install PyFinitDiff
82
+
83
+ Install from the ``martinpdes`` Conda channel:
84
+
85
+ .. code-block:: console
86
+
87
+ $ conda install -c martinpdes pyfinitdiff
88
+
89
+ For an editable source installation:
90
+
91
+ .. code-block:: console
92
+
93
+ $ git clone https://github.com/MartinPdeS/PyFinitDiff.git
94
+ $ cd PyFinitDiff
95
+ $ python -m pip install -e .
96
+
97
+ Inspect a two-dimensional finite-difference stencil
98
+ ---------------------------------------------------
99
+
100
+ .. code-block:: python
101
+
102
+ """
103
+ Example: triplets 0
104
+ ===================
105
+
106
+ In this example, we generate a finite difference instance and visualize the resulting triplets.
107
+ The boundary conditions, derivative, and accuracy settings are specified for demonstration purposes.
108
+ """
109
+
110
+ # %%
111
+ # .. list-table:: Finite-difference parameters
112
+ # :widths: 25
113
+ # :header-rows: 1
114
+ #
115
+ # * - boundaries: {left: 0, right: 0, top: 0, bottom: 0}
116
+ # * - derivative: 2
117
+ # * - accuracy: 4
118
+
119
+ # %%
120
+ # Importing required packages
121
+ # ---------------------------
122
+ # Here we import the necessary libraries for numerical computations and finite difference operations.
123
+
124
+ from PyFinitDiff.finite_difference_2D import FiniteDifference, Boundaries
125
+ import matplotlib.pyplot as plt
126
+
127
+ # %%
128
+ # Setting up the finite difference instance and boundaries
129
+ # ---------------------------------------------------------
130
+ # We define the grid size and set up the finite difference instance with specified boundary conditions.
131
+
132
+ sparse_instance = FiniteDifference(
133
+ n_x=20,
134
+ n_y=20,
135
+ dx=1,
136
+ dy=1,
137
+ derivative=2,
138
+ accuracy=2,
139
+ boundaries=Boundaries()
140
+ )
141
+
142
+ # %%
143
+ # Visualizing the triplets with matplotlib
144
+ # -----------------------------------------
145
+ # We plot the triplets using matplotlib to visualize the finite difference operator.
146
+
147
+ sparse_instance.triplet.plot()
148
+
149
+ plt.show()
150
+
151
+ # -
152
+
153
+ .. figure:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/HEAD/docs/images/triplet_example_0.png
154
+
155
+ Triplet representation of the finite-difference operator.
156
+
157
+ Documentation
158
+ -------------
159
+
160
+ Use the `PyFinitDiff documentation <https://martinpdes.github.io/PyFinitDiff/>`__ to work through
161
+ examples and look up the inputs and return values of individual functions.
162
+
163
+ Contributing
164
+ ------------
165
+
166
+ Bug reports, worked examples, and documentation corrections are welcome.
167
+ To set up a development checkout and run the tests, follow the `contributing guide <https://github.com/MartinPdeS/PyFinitDiff/blob/HEAD/CONTRIBUTING.md>`__.
168
+
169
+ Contact
170
+ -------
171
+
172
+ For questions, contact `Martin Poinsinet de Sivry-Houle <mailto:martin.poinsinet.de.sivry@gmail.com?subject=PyFinitDiff>`__.
173
+
174
+ License
175
+ -------
176
+
177
+ PyFinitDiff is licensed under `MIT <https://github.com/MartinPdeS/PyFinitDiff/blob/HEAD/LICENSE>`__.
178
+
179
+ .. |mps-python| image:: https://img.shields.io/pypi/pyversions/pyfinitdiff.svg
180
+ :alt: Supported Python versions
181
+ :target: https://pypi.org/project/pyfinitdiff/
182
+
183
+ .. |mps-pypi| image:: https://img.shields.io/pypi/v/pyfinitdiff.svg
184
+ :alt: PyPI version
185
+ :target: https://pypi.org/project/pyfinitdiff/
186
+
187
+ .. |mps-downloads| image:: https://img.shields.io/pypi/dm/pyfinitdiff.svg
188
+ :alt: Monthly PyPI downloads
189
+ :target: https://pypistats.org/packages/pyfinitdiff
190
+
191
+ .. |mps-docs| image:: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/deploy_documentation.yml/badge.svg
192
+ :alt: Documentation
193
+ :target: https://martinpdes.github.io/PyFinitDiff/
194
+
195
+ .. |mps-ci| image:: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/tests.yml/badge.svg
196
+ :alt: Tests
197
+ :target: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/tests.yml
198
+
199
+ .. |mps-coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/python-coverage-comment-action-data/badge.svg
200
+ :alt: Test coverage
201
+ :target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyFinitDiff/blob/python-coverage-comment-action-data/htmlcov/index.html
202
+
203
+ .. |mps-conda| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/version.svg
204
+ :alt: Anaconda version
205
+ :target: https://anaconda.org/martinpdes/pyfinitdiff
206
+
207
+ .. |mps-conda-downloads| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/downloads.svg
208
+ :alt: Anaconda downloads
209
+ :target: https://anaconda.org/martinpdes/pyfinitdiff
210
+
211
+ .. |mps-conda-release| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/latest_release_relative_date.svg
212
+ :alt: Latest Anaconda release
213
+ :target: https://anaconda.org/martinpdes/pyfinitdiff
@@ -0,0 +1,5 @@
1
+ """Release version maintained by martinpdes-maintenance."""
2
+
3
+ __version__ = version = "2.3.2"
4
+ __version_tuple__ = version_tuple = tuple(int(part) for part in version.split("."))
5
+ __commit_id__ = commit_id = None
@@ -1,5 +1,5 @@
1
1
 
2
- __accuracy_list__ = [2, 4, 6]
2
+ __accuracy_list__ = [2, 4, 6, 8]
3
3
  __derivative_list__ = [1, 2, 3]
4
4
 
5
5
  coefficients = {
@@ -24,6 +24,17 @@ coefficients = {
24
24
  (-4, +15.0 / 4.0),
25
25
  (-5, -6.0 / 5.0),
26
26
  (-6, +1.0 / 6.0)
27
+ ),
28
+ 'a8': (
29
+ (+0, +761.0 / 280.0),
30
+ (-1, -8.0),
31
+ (-2, +14.0),
32
+ (-3, -56.0 / 3.0),
33
+ (-4, +35.0 / 2.0),
34
+ (-5, -56.0 / 5.0),
35
+ (-6, +14.0 / 3.0),
36
+ (-7, -8.0 / 7.0),
37
+ (-8, +1.0 / 8.0),
27
38
  )
28
39
  },
29
40
  'd2': {
@@ -30,9 +30,9 @@ coefficients = {
30
30
  ),
31
31
  'a8': (
32
32
  (-4, +1.0 / 280.0),
33
- (-3, +4.0 / 105.0),
33
+ (-3, -4.0 / 105.0),
34
34
  (-2, +1.0 / 5.0),
35
- (-1, +4.0 / 5.0),
35
+ (-1, -4.0 / 5.0),
36
36
  (+1, +4.0 / 5.0),
37
37
  (+2, -1.0 / 5.0),
38
38
  (+3, +4.0 / 105.0),
@@ -1,4 +1,4 @@
1
- __accuracy_list__ = [2, 4, 6]
1
+ __accuracy_list__ = [2, 4, 6, 8]
2
2
  __derivative_list__ = [1, 2, 3]
3
3
 
4
4
 
@@ -25,6 +25,17 @@ coefficients = {
25
25
  (+4, -15.0 / 4.0),
26
26
  (+5, +6.0 / 5.0),
27
27
  (+6, -1.0 / 6.0)
28
+ ),
29
+ 'a8': (
30
+ (+0, -761.0 / 280.0),
31
+ (+1, +8.0),
32
+ (+2, -14.0),
33
+ (+3, +56.0 / 3.0),
34
+ (+4, -35.0 / 2.0),
35
+ (+5, +56.0 / 5.0),
36
+ (+6, -14.0 / 3.0),
37
+ (+7, +8.0 / 7.0),
38
+ (+8, -1.0 / 8.0),
28
39
  )
29
40
  },
30
41
  'd2': {
@@ -17,7 +17,6 @@ config_dict = ConfigDict(
17
17
  )
18
18
 
19
19
 
20
-
21
20
  class Boundary:
22
21
  """
23
22
  Represents a boundary with a specific name, value, and mesh information.
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyFinitDiff
3
+ Version: 2.3.2
4
+ Summary: A package for generating finite-difference matrices, particularly suited for physics and engineering applications.
5
+ Author-email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/MartinPdeS/PyFinitDiff
8
+ Project-URL: Documentation, https://martinpdes.github.io/PyFinitDiff/
9
+ Project-URL: Repository, https://github.com/MartinPdeS/PyFinitDiff.git
10
+ Keywords: finite-difference,solving,linear algebra,physics,matrix,engineering
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: Implementation :: CPython
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Topic :: Scientific/Engineering :: Physics
18
+ Classifier: Intended Audience :: Science/Research
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/x-rst
21
+ License-File: LICENSE
22
+ Requires-Dist: scipy>=1.14
23
+ Requires-Dist: pydantic<3,>=2
24
+ Requires-Dist: numpy
25
+ Requires-Dist: MPSPlots
26
+ Requires-Dist: tabulate
27
+ Provides-Extra: release
28
+ Requires-Dist: martinpdes-maintenance==0.2.3; extra == "release"
29
+ Provides-Extra: dev
30
+ Requires-Dist: martinpdes-maintenance[quality]==0.2.3; extra == "dev"
31
+ Requires-Dist: twine<7,>=6; extra == "dev"
32
+ Requires-Dist: flake8==7.3.0; extra == "dev"
33
+ Provides-Extra: testing
34
+ Requires-Dist: martinpdes-maintenance[testing]==0.2.3; extra == "testing"
35
+ Requires-Dist: pytest<9,>=7.4; extra == "testing"
36
+ Requires-Dist: pytest-cov<8; extra == "testing"
37
+ Requires-Dist: pytest-json-report~=1.5; extra == "testing"
38
+ Requires-Dist: coverage~=7.6; extra == "testing"
39
+ Provides-Extra: documentation
40
+ Requires-Dist: MartinPdeS-docs<0.5,>=0.4.0; extra == "documentation"
41
+ Dynamic: license-file
42
+
43
+ PyFinitDiff
44
+ ===========
45
+
46
+ .. image:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/HEAD/docs/images/logo.png
47
+ :alt: PyFinitDiff logo
48
+ :width: 100%
49
+
50
+ .. list-table::
51
+ :width: 100%
52
+ :widths: 35 65
53
+ :header-rows: 1
54
+
55
+ * - Badge
56
+ - Status
57
+ * - Python versions
58
+ - |mps-python|
59
+ * - Documentation
60
+ - |mps-docs|
61
+ * - Tests
62
+ - |mps-ci| |mps-coverage|
63
+ * - PyPI
64
+ - |mps-pypi| |mps-downloads|
65
+ * - Conda
66
+ - |mps-conda| |mps-conda-downloads| |mps-conda-release|
67
+
68
+ A package for generating finite-difference matrices, particularly suited for physics and engineering applications.
69
+
70
+ Construct sparse derivative operators from the mesh spacing, derivative order,
71
+ accuracy, and boundary conditions. Inspect the matrix entries before combining the
72
+ operator with a potential or solving an eigenvalue problem.
73
+
74
+ Installation
75
+ ------------
76
+
77
+ Requires Python ``>=3.10``.
78
+
79
+ .. code-block:: console
80
+
81
+ $ python -m pip install PyFinitDiff
82
+
83
+ Install from the ``martinpdes`` Conda channel:
84
+
85
+ .. code-block:: console
86
+
87
+ $ conda install -c martinpdes pyfinitdiff
88
+
89
+ For an editable source installation:
90
+
91
+ .. code-block:: console
92
+
93
+ $ git clone https://github.com/MartinPdeS/PyFinitDiff.git
94
+ $ cd PyFinitDiff
95
+ $ python -m pip install -e .
96
+
97
+ Inspect a two-dimensional finite-difference stencil
98
+ ---------------------------------------------------
99
+
100
+ .. code-block:: python
101
+
102
+ """
103
+ Example: triplets 0
104
+ ===================
105
+
106
+ In this example, we generate a finite difference instance and visualize the resulting triplets.
107
+ The boundary conditions, derivative, and accuracy settings are specified for demonstration purposes.
108
+ """
109
+
110
+ # %%
111
+ # .. list-table:: Finite-difference parameters
112
+ # :widths: 25
113
+ # :header-rows: 1
114
+ #
115
+ # * - boundaries: {left: 0, right: 0, top: 0, bottom: 0}
116
+ # * - derivative: 2
117
+ # * - accuracy: 4
118
+
119
+ # %%
120
+ # Importing required packages
121
+ # ---------------------------
122
+ # Here we import the necessary libraries for numerical computations and finite difference operations.
123
+
124
+ from PyFinitDiff.finite_difference_2D import FiniteDifference, Boundaries
125
+ import matplotlib.pyplot as plt
126
+
127
+ # %%
128
+ # Setting up the finite difference instance and boundaries
129
+ # ---------------------------------------------------------
130
+ # We define the grid size and set up the finite difference instance with specified boundary conditions.
131
+
132
+ sparse_instance = FiniteDifference(
133
+ n_x=20,
134
+ n_y=20,
135
+ dx=1,
136
+ dy=1,
137
+ derivative=2,
138
+ accuracy=2,
139
+ boundaries=Boundaries()
140
+ )
141
+
142
+ # %%
143
+ # Visualizing the triplets with matplotlib
144
+ # -----------------------------------------
145
+ # We plot the triplets using matplotlib to visualize the finite difference operator.
146
+
147
+ sparse_instance.triplet.plot()
148
+
149
+ plt.show()
150
+
151
+ # -
152
+
153
+ .. figure:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/HEAD/docs/images/triplet_example_0.png
154
+
155
+ Triplet representation of the finite-difference operator.
156
+
157
+ Documentation
158
+ -------------
159
+
160
+ Use the `PyFinitDiff documentation <https://martinpdes.github.io/PyFinitDiff/>`__ to work through
161
+ examples and look up the inputs and return values of individual functions.
162
+
163
+ Contributing
164
+ ------------
165
+
166
+ Bug reports, worked examples, and documentation corrections are welcome.
167
+ To set up a development checkout and run the tests, follow the `contributing guide <https://github.com/MartinPdeS/PyFinitDiff/blob/HEAD/CONTRIBUTING.md>`__.
168
+
169
+ Contact
170
+ -------
171
+
172
+ For questions, contact `Martin Poinsinet de Sivry-Houle <mailto:martin.poinsinet.de.sivry@gmail.com?subject=PyFinitDiff>`__.
173
+
174
+ License
175
+ -------
176
+
177
+ PyFinitDiff is licensed under `MIT <https://github.com/MartinPdeS/PyFinitDiff/blob/HEAD/LICENSE>`__.
178
+
179
+ .. |mps-python| image:: https://img.shields.io/pypi/pyversions/pyfinitdiff.svg
180
+ :alt: Supported Python versions
181
+ :target: https://pypi.org/project/pyfinitdiff/
182
+
183
+ .. |mps-pypi| image:: https://img.shields.io/pypi/v/pyfinitdiff.svg
184
+ :alt: PyPI version
185
+ :target: https://pypi.org/project/pyfinitdiff/
186
+
187
+ .. |mps-downloads| image:: https://img.shields.io/pypi/dm/pyfinitdiff.svg
188
+ :alt: Monthly PyPI downloads
189
+ :target: https://pypistats.org/packages/pyfinitdiff
190
+
191
+ .. |mps-docs| image:: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/deploy_documentation.yml/badge.svg
192
+ :alt: Documentation
193
+ :target: https://martinpdes.github.io/PyFinitDiff/
194
+
195
+ .. |mps-ci| image:: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/tests.yml/badge.svg
196
+ :alt: Tests
197
+ :target: https://github.com/MartinPdeS/PyFinitDiff/actions/workflows/tests.yml
198
+
199
+ .. |mps-coverage| image:: https://raw.githubusercontent.com/MartinPdeS/PyFinitDiff/python-coverage-comment-action-data/badge.svg
200
+ :alt: Test coverage
201
+ :target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/PyFinitDiff/blob/python-coverage-comment-action-data/htmlcov/index.html
202
+
203
+ .. |mps-conda| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/version.svg
204
+ :alt: Anaconda version
205
+ :target: https://anaconda.org/martinpdes/pyfinitdiff
206
+
207
+ .. |mps-conda-downloads| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/downloads.svg
208
+ :alt: Anaconda downloads
209
+ :target: https://anaconda.org/martinpdes/pyfinitdiff
210
+
211
+ .. |mps-conda-release| image:: https://anaconda.org/martinpdes/pyfinitdiff/badges/latest_release_relative_date.svg
212
+ :alt: Latest Anaconda release
213
+ :target: https://anaconda.org/martinpdes/pyfinitdiff
@@ -0,0 +1,35 @@
1
+ LICENSE
2
+ README.rst
3
+ pyproject.toml
4
+ PyFinitDiff/__init__.py
5
+ PyFinitDiff/_version.py
6
+ PyFinitDiff/boundary_values.py
7
+ PyFinitDiff/diagonal.py
8
+ PyFinitDiff/directories.py
9
+ PyFinitDiff/triplet.py
10
+ PyFinitDiff.egg-info/PKG-INFO
11
+ PyFinitDiff.egg-info/SOURCES.txt
12
+ PyFinitDiff.egg-info/dependency_links.txt
13
+ PyFinitDiff.egg-info/requires.txt
14
+ PyFinitDiff.egg-info/top_level.txt
15
+ PyFinitDiff/coefficients/__init__.py
16
+ PyFinitDiff/coefficients/backward.py
17
+ PyFinitDiff/coefficients/central.py
18
+ PyFinitDiff/coefficients/forward.py
19
+ PyFinitDiff/finite_difference_1D/__init__.py
20
+ PyFinitDiff/finite_difference_1D/boundaries.py
21
+ PyFinitDiff/finite_difference_1D/derivative.py
22
+ PyFinitDiff/finite_difference_1D/finite_difference.py
23
+ PyFinitDiff/finite_difference_1D/utils.py
24
+ PyFinitDiff/finite_difference_2D/__init__.py
25
+ PyFinitDiff/finite_difference_2D/boundaries.py
26
+ PyFinitDiff/finite_difference_2D/derivative.py
27
+ PyFinitDiff/finite_difference_2D/finite_difference.py
28
+ PyFinitDiff/finite_difference_2D/utils.py
29
+ tests/test_1D_api.py
30
+ tests/test_1D_derivative.py
31
+ tests/test_2D_api.py
32
+ tests/test_2D_derivative.py
33
+ tests/test_2D_eigen.py
34
+ tests/test_eighth_order_first_derivative.py
35
+ tests/test_triplet.py
@@ -0,0 +1,23 @@
1
+ scipy>=1.14
2
+ pydantic<3,>=2
3
+ numpy
4
+ MPSPlots
5
+ tabulate
6
+
7
+ [dev]
8
+ martinpdes-maintenance[quality]==0.2.3
9
+ twine<7,>=6
10
+ flake8==7.3.0
11
+
12
+ [documentation]
13
+ MartinPdeS-docs<0.5,>=0.4.0
14
+
15
+ [release]
16
+ martinpdes-maintenance==0.2.3
17
+
18
+ [testing]
19
+ martinpdes-maintenance[testing]==0.2.3
20
+ pytest<9,>=7.4
21
+ pytest-cov<8
22
+ pytest-json-report~=1.5
23
+ coverage~=7.6