OGRePy 1.3.0__tar.gz → 1.3.1__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.
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy/__init__.py +10 -5
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy/_core.py +70 -39
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy/abc.py +10 -5
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy/docs/OGRePy_Documentation.html +366 -351
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy/docs/OGRePy_Documentation.ipynb +1103 -1084
- ogrepy-1.3.1/OGRePy/docs/OGRePy_Documentation.pdf +0 -0
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy.egg-info/PKG-INFO +30 -10
- {ogrepy-1.3.0 → ogrepy-1.3.1}/PKG-INFO +30 -10
- {ogrepy-1.3.0 → ogrepy-1.3.1}/README.md +27 -8
- {ogrepy-1.3.0 → ogrepy-1.3.1}/pyproject.toml +5 -4
- ogrepy-1.3.0/OGRePy/docs/OGRePy_Documentation.pdf +0 -0
- {ogrepy-1.3.0 → ogrepy-1.3.1}/LICENSE.txt +0 -0
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy/py.typed +0 -0
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy.egg-info/SOURCES.txt +0 -0
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy.egg-info/dependency_links.txt +0 -0
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy.egg-info/requires.txt +0 -0
- {ogrepy-1.3.0 → ogrepy-1.3.1}/OGRePy.egg-info/top_level.txt +0 -0
- {ogrepy-1.3.0 → ogrepy-1.3.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
r"""
|
|
2
2
|
# OGRePy: An Object-Oriented General Relativity Package for Python
|
|
3
|
-
v1.3.
|
|
3
|
+
v1.3.1 (2025-08-03)
|
|
4
4
|
|
|
5
5
|
By **Barak Shoshany**\
|
|
6
6
|
Email: <baraksh@gmail.com>\
|
|
@@ -18,18 +18,23 @@ If you use this package in software of any kind, please provide a link to [the G
|
|
|
18
18
|
|
|
19
19
|
If you use this package in published research, please cite it as follows:
|
|
20
20
|
|
|
21
|
-
* Barak Shoshany, *"OGRePy: An Object-Oriented General Relativity Package for Python"*, [doi:10.
|
|
21
|
+
* Barak Shoshany, *"OGRePy: An Object-Oriented General Relativity Package for Python"*, [Journal of Open Research Software 13: 9](https://openresearchsoftware.metajnl.com/articles/10.5334/jors.558), [doi:10.5334/jors.558](https://doi.org/10.5334/jors.558), [arXiv:2409.03803](https://arxiv.org/abs/2409.03803) (July 2025)
|
|
22
22
|
|
|
23
23
|
You can use the following BibTeX entry:
|
|
24
24
|
|
|
25
25
|
```bibtex
|
|
26
|
-
@article{
|
|
26
|
+
@article{ShoshanyOGRePy,
|
|
27
27
|
archiveprefix = {arXiv},
|
|
28
28
|
author = {Barak Shoshany},
|
|
29
|
-
doi = {10.
|
|
29
|
+
doi = {10.5334/jors.558},
|
|
30
30
|
eprint = {2409.03803},
|
|
31
|
+
issn = {2049-9647},
|
|
32
|
+
journal = {Journal of Open Research Software},
|
|
33
|
+
pages = {9},
|
|
34
|
+
publisher = {Ubiquity Press, Ltd.},
|
|
31
35
|
title = {{OGRePy: An Object-Oriented General Relativity Package for Python}},
|
|
32
|
-
|
|
36
|
+
volume = {13},
|
|
37
|
+
year = {2025},
|
|
33
38
|
}
|
|
34
39
|
```
|
|
35
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
r"""
|
|
2
2
|
# OGRePy: An Object-Oriented General Relativity Package for Python
|
|
3
|
-
v1.3.
|
|
3
|
+
v1.3.1 (2025-08-03)
|
|
4
4
|
|
|
5
5
|
By **Barak Shoshany**\
|
|
6
6
|
Email: <baraksh@gmail.com>\
|
|
@@ -18,18 +18,23 @@ If you use this package in software of any kind, please provide a link to [the G
|
|
|
18
18
|
|
|
19
19
|
If you use this package in published research, please cite it as follows:
|
|
20
20
|
|
|
21
|
-
* Barak Shoshany, *"OGRePy: An Object-Oriented General Relativity Package for Python"*, [doi:10.
|
|
21
|
+
* Barak Shoshany, *"OGRePy: An Object-Oriented General Relativity Package for Python"*, [Journal of Open Research Software 13: 9](https://openresearchsoftware.metajnl.com/articles/10.5334/jors.558), [doi:10.5334/jors.558](https://doi.org/10.5334/jors.558), [arXiv:2409.03803](https://arxiv.org/abs/2409.03803) (July 2025)
|
|
22
22
|
|
|
23
23
|
You can use the following BibTeX entry:
|
|
24
24
|
|
|
25
25
|
```bibtex
|
|
26
|
-
@article{
|
|
26
|
+
@article{ShoshanyOGRePy,
|
|
27
27
|
archiveprefix = {arXiv},
|
|
28
28
|
author = {Barak Shoshany},
|
|
29
|
-
doi = {10.
|
|
29
|
+
doi = {10.5334/jors.558},
|
|
30
30
|
eprint = {2409.03803},
|
|
31
|
+
issn = {2049-9647},
|
|
32
|
+
journal = {Journal of Open Research Software},
|
|
33
|
+
pages = {9},
|
|
34
|
+
publisher = {Ubiquity Press, Ltd.},
|
|
31
35
|
title = {{OGRePy: An Object-Oriented General Relativity Package for Python}},
|
|
32
|
-
|
|
36
|
+
volume = {13},
|
|
37
|
+
year = {2025},
|
|
33
38
|
}
|
|
34
39
|
```
|
|
35
40
|
|
|
@@ -107,8 +112,8 @@ class OGRePyError(Exception):
|
|
|
107
112
|
####################
|
|
108
113
|
|
|
109
114
|
|
|
110
|
-
__version__: str = "1.3.
|
|
111
|
-
release_date: str = "2025-
|
|
115
|
+
__version__: str = "1.3.1"
|
|
116
|
+
release_date: str = "2025-08-03"
|
|
112
117
|
|
|
113
118
|
|
|
114
119
|
####################
|
|
@@ -149,18 +154,21 @@ def cite() -> None:
|
|
|
149
154
|
inspect.cleandoc("""
|
|
150
155
|
If you use this package in published research, please cite it as follows:
|
|
151
156
|
|
|
152
|
-
* Barak Shoshany, *"OGRePy: An Object-Oriented General Relativity Package for Python"*, [doi:10.
|
|
157
|
+
* Barak Shoshany, *"OGRePy: An Object-Oriented General Relativity Package for Python"*, [Journal of Open Research Software 13: 9](https://openresearchsoftware.metajnl.com/articles/10.5334/jors.558), [doi:10.5334/jors.558](https://doi.org/10.5334/jors.558), [arXiv:2409.03803](https://arxiv.org/abs/2409.03803) (July 2025)
|
|
153
158
|
|
|
154
159
|
You can use the following BibTeX entry:
|
|
155
160
|
|
|
156
161
|
```bibtex
|
|
157
|
-
@article{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
@article{Shoshany2025_OGRePy,
|
|
163
|
+
author = {Barak Shoshany},
|
|
164
|
+
doi = {10.5334/jors.558},
|
|
165
|
+
issn = {2049-9647},
|
|
166
|
+
journal = {Journal of Open Research Software},
|
|
167
|
+
publisher = {Ubiquity Press, Ltd.},
|
|
168
|
+
title = {{OGRePy: An Object-Oriented General Relativity Package for Python}},
|
|
169
|
+
url = {http://dx.doi.org/10.5334/jors.558},
|
|
170
|
+
volume = {13},
|
|
171
|
+
year = {2025},
|
|
164
172
|
}
|
|
165
173
|
```
|
|
166
174
|
|
|
@@ -378,27 +386,50 @@ def welcome() -> None:
|
|
|
378
386
|
"""
|
|
379
387
|
Print the welcome message.
|
|
380
388
|
"""
|
|
381
|
-
|
|
382
|
-
|
|
389
|
+
ipynb_filename: str = ""
|
|
390
|
+
pdf_filename: str = ""
|
|
391
|
+
html_filename: str = ""
|
|
392
|
+
if "pyodide" not in sys.modules:
|
|
393
|
+
# The documentation files are bundled with the package so that they can be viewed offline. We make sure they exist and get their paths.
|
|
394
|
+
with importlib.resources.as_file(importlib.resources.files().joinpath("docs/OGRePy_Documentation")) as file:
|
|
395
|
+
ipynb_file: pathlib.Path = file.with_suffix(".ipynb")
|
|
396
|
+
if ipynb_file.exists():
|
|
397
|
+
ipynb_filename = ipynb_file.as_posix()
|
|
398
|
+
pdf_file: pathlib.Path = file.with_suffix(".pdf")
|
|
399
|
+
if pdf_file.exists():
|
|
400
|
+
pdf_filename = pdf_file.as_posix()
|
|
401
|
+
html_file: pathlib.Path = file.with_suffix(".html")
|
|
402
|
+
if html_file.exists():
|
|
403
|
+
html_filename = html_file.as_uri()
|
|
404
|
+
else:
|
|
405
|
+
# If we're running in a JupyterLite notebook, we will not be able to access the documentation files directly. However, if using OGRePyLive, the files should be available in the same folder as the notebook, so we check for that.
|
|
406
|
+
file = pathlib.Path("./OGRePy_Documentation")
|
|
383
407
|
ipynb_file: pathlib.Path = file.with_suffix(".ipynb")
|
|
384
|
-
|
|
408
|
+
if ipynb_file.exists():
|
|
409
|
+
ipynb_filename = ipynb_file.as_posix()
|
|
385
410
|
pdf_file: pathlib.Path = file.with_suffix(".pdf")
|
|
386
|
-
|
|
411
|
+
if pdf_file.exists():
|
|
412
|
+
pdf_filename = pdf_file.as_posix()
|
|
387
413
|
html_file: pathlib.Path = file.with_suffix(".html")
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
)
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
414
|
+
if html_file.exists():
|
|
415
|
+
html_filename = html_file.as_posix()
|
|
416
|
+
ipynb_link: str = f"""<a href="{ipynb_filename if ipynb_filename != "" else "https://github.com/bshoshany/OGRePy/blob/master/OGRePy/docs/OGRePy_Documentation.ipynb"}">.ipynb</a>"""
|
|
417
|
+
pdf_link: str = f"""<a href="{pdf_filename if pdf_filename != "" else "https://github.com/bshoshany/OGRePy/blob/master/OGRePy/docs/OGRePy_Documentation.pdf"}">.pdf</a>"""
|
|
418
|
+
html_url: str = html_filename if html_filename != "" else "https://raw.githack.com/bshoshany/OGRePy/master/OGRePy/docs/OGRePy_Documentation.html"
|
|
419
|
+
html_link: str = f"""<a href="#" onclick="window.open('{html_url}', '_blank')">.html</a>""" if "pyodide" not in sys.modules else f"""<a href="{html_url}">.html</a>"""
|
|
420
|
+
# Display the welcome message.
|
|
421
|
+
_display_markdown(
|
|
422
|
+
inspect.cleandoc(rf"""
|
|
423
|
+
**OGRePy: An <u>O</u>bject-Oriented <u>G</u>eneral <u>Re</u>lativity Package for <u>Py</u>thon\
|
|
424
|
+
By [Barak Shoshany](https://github.com/bshoshany) ([baraksh@gmail.com](mailto:baraksh@gmail.com)) ([baraksh.com](https://baraksh.com/))\
|
|
425
|
+
v{__version__} ({release_date})\
|
|
426
|
+
GitHub repository: <https://github.com/bshoshany/OGRePy>\
|
|
427
|
+
Documentation: {ipynb_link}, {pdf_link}, {html_link}**
|
|
428
|
+
"""),
|
|
429
|
+
)
|
|
430
|
+
# If we're not in a notebook, warn that the package should be used inside a notebook.
|
|
431
|
+
if not _in_notebook:
|
|
432
|
+
_display_markdown("WARNING: No notebook interface detected! This package was designed to be used inside a Jupyter notebook in Visual Studio Code or JupyterLab.")
|
|
402
433
|
|
|
403
434
|
|
|
404
435
|
##################
|
|
@@ -841,7 +872,7 @@ class CovariantD:
|
|
|
841
872
|
dummy_christoffel: str = _to_tex(s.Dummy())
|
|
842
873
|
for pos, (index_letter, index_type) in enumerate(zip(tensor_letters, use_indices, strict=True)):
|
|
843
874
|
# Replace the current index with the dummy index in the tensor's index specification.
|
|
844
|
-
index_replaced: IndexSpecification = tensor_letters[0:pos]
|
|
875
|
+
index_replaced: IndexSpecification = [*tensor_letters[0:pos], dummy_christoffel, *tensor_letters[pos + 1 : rank]]
|
|
845
876
|
if index_type == 1:
|
|
846
877
|
# For an upper index, add the Christoffel symbols with their third index contracted with the tensor.
|
|
847
878
|
out_tensor += other(*index_replaced) @ use_christoffel(index_letter, dummy_covariant, dummy_christoffel)
|
|
@@ -1042,7 +1073,7 @@ class Tensor:
|
|
|
1042
1073
|
output_tensor._symbol = self._symbol + sign + other_symbol
|
|
1043
1074
|
return output_tensor
|
|
1044
1075
|
|
|
1045
|
-
def __call__(
|
|
1076
|
+
def __call__( # noqa: RET503
|
|
1046
1077
|
self: Self,
|
|
1047
1078
|
*letters: str | s.Symbol,
|
|
1048
1079
|
) -> Self | Tensor:
|
|
@@ -1064,7 +1095,7 @@ class Tensor:
|
|
|
1064
1095
|
if max_duplicates > 2:
|
|
1065
1096
|
# We can't have more than 2 instances of the same index.
|
|
1066
1097
|
invalid_indices: IndexSpecification = [letter for letter, count in tally.items() if count > 2]
|
|
1067
|
-
_handle_error(f"The index specification\n${''.join(calc_letters)}$\nis invalid, as it contains more than two instances of the {'index' if len(invalid_indices) == 1 else 'indices'} \n${', '.join(invalid_indices)}$\n.")
|
|
1098
|
+
_handle_error(f"The index specification\n${''.join(calc_letters)}$\nis invalid, as it contains more than two instances of the {'index' if len(invalid_indices) == 1 else 'indices'} \n${', '.join(invalid_indices)}$\n.")
|
|
1068
1099
|
elif max_duplicates == 2:
|
|
1069
1100
|
# If any indices appear exactly twice, we need to trace them.
|
|
1070
1101
|
trace_letters: IndexSpecification = [letter for letter, count in tally.items() if count == 2]
|
|
@@ -2266,7 +2297,7 @@ class Einstein(Tensor, FixedDefaultIndices):
|
|
|
2266
2297
|
#### Returns:
|
|
2267
2298
|
The calculated components.
|
|
2268
2299
|
"""
|
|
2269
|
-
return (metric.ricci_tensor("mu nu") - s.Rational(1, 2) * metric.ricci_scalar() @ metric("mu nu"))._calc_representation(indices=(-1, -1), coords=coords)
|
|
2300
|
+
return cast(s.Array, (metric.ricci_tensor("mu nu") - s.Rational(1, 2) * metric.ricci_scalar() @ metric("mu nu"))._calc_representation(indices=(-1, -1), coords=coords))
|
|
2270
2301
|
|
|
2271
2302
|
|
|
2272
2303
|
class GeodesicFromChristoffel(Tensor, CleanupCurveParameter, FixedDefaultIndices):
|
|
@@ -2481,9 +2512,9 @@ class GeodesicTimeParam(Tensor, CleanupTimeParameter, FixedDefaultIndices):
|
|
|
2481
2512
|
# Use the first coordinate as the curve parameter.
|
|
2482
2513
|
time: s.Symbol = cast(s.Symbol, coords.components()[0])
|
|
2483
2514
|
# Create a tangent vector whose components are the first derivatives of the coordinates with respect to t (thus the first component will be equal to 1).
|
|
2484
|
-
tangent: s.Array = s.Array([1
|
|
2515
|
+
tangent: s.Array = s.Array([1, *coords.of_param_dot(time)[1:]])
|
|
2485
2516
|
# Create an acceleration vector whose components are the second derivatives of the coordinates with respect to t (thus the first component will be equal to 0).
|
|
2486
|
-
accel: s.Array = s.Array([0
|
|
2517
|
+
accel: s.Array = s.Array([0, *coords.of_param_ddot(time)[1:]])
|
|
2487
2518
|
# Obtain the Christoffel symbols, and replace any instance of the spatial coordinate symbols with coordinate functions of time.
|
|
2488
2519
|
param_dict: dict[s.Symbol, AppliedUndef] = coords.of_param_dict(time)
|
|
2489
2520
|
del param_dict[time]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
r"""
|
|
2
2
|
# OGRePy: An Object-Oriented General Relativity Package for Python
|
|
3
|
-
v1.3.
|
|
3
|
+
v1.3.1 (2025-08-03)
|
|
4
4
|
|
|
5
5
|
By **Barak Shoshany**\
|
|
6
6
|
Email: <baraksh@gmail.com>\
|
|
@@ -18,18 +18,23 @@ If you use this package in software of any kind, please provide a link to [the G
|
|
|
18
18
|
|
|
19
19
|
If you use this package in published research, please cite it as follows:
|
|
20
20
|
|
|
21
|
-
* Barak Shoshany, *"OGRePy: An Object-Oriented General Relativity Package for Python"*, [doi:10.
|
|
21
|
+
* Barak Shoshany, *"OGRePy: An Object-Oriented General Relativity Package for Python"*, [Journal of Open Research Software 13: 9](https://openresearchsoftware.metajnl.com/articles/10.5334/jors.558), [doi:10.5334/jors.558](https://doi.org/10.5334/jors.558), [arXiv:2409.03803](https://arxiv.org/abs/2409.03803) (July 2025)
|
|
22
22
|
|
|
23
23
|
You can use the following BibTeX entry:
|
|
24
24
|
|
|
25
25
|
```bibtex
|
|
26
|
-
@article{
|
|
26
|
+
@article{ShoshanyOGRePy,
|
|
27
27
|
archiveprefix = {arXiv},
|
|
28
28
|
author = {Barak Shoshany},
|
|
29
|
-
doi = {10.
|
|
29
|
+
doi = {10.5334/jors.558},
|
|
30
30
|
eprint = {2409.03803},
|
|
31
|
+
issn = {2049-9647},
|
|
32
|
+
journal = {Journal of Open Research Software},
|
|
33
|
+
pages = {9},
|
|
34
|
+
publisher = {Ubiquity Press, Ltd.},
|
|
31
35
|
title = {{OGRePy: An Object-Oriented General Relativity Package for Python}},
|
|
32
|
-
|
|
36
|
+
volume = {13},
|
|
37
|
+
year = {2025},
|
|
33
38
|
}
|
|
34
39
|
```
|
|
35
40
|
|