pylamda 0.1.0__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.
- pylamda-0.1.0/LICENSE +21 -0
- pylamda-0.1.0/PKG-INFO +84 -0
- pylamda-0.1.0/README.md +47 -0
- pylamda-0.1.0/pyproject.toml +95 -0
- pylamda-0.1.0/src/pylamda/__init__.py +82 -0
- pylamda-0.1.0/src/pylamda/__main__.py +7 -0
- pylamda-0.1.0/src/pylamda/bib.py +859 -0
- pylamda-0.1.0/src/pylamda/catalogue.py +283 -0
- pylamda-0.1.0/src/pylamda/cli.py +529 -0
- pylamda-0.1.0/src/pylamda/combine.py +318 -0
- pylamda-0.1.0/src/pylamda/compare.py +1014 -0
- pylamda-0.1.0/src/pylamda/data/database_refs.bib +55 -0
- pylamda-0.1.0/src/pylamda/data/references.bib +1079 -0
- pylamda-0.1.0/src/pylamda/data/references.json +1909 -0
- pylamda-0.1.0/src/pylamda/fix.py +838 -0
- pylamda-0.1.0/src/pylamda/formula.py +76 -0
- pylamda-0.1.0/src/pylamda/issues.py +182 -0
- pylamda-0.1.0/src/pylamda/model.py +442 -0
- pylamda-0.1.0/src/pylamda/py.typed +0 -0
- pylamda-0.1.0/src/pylamda/reader.py +351 -0
- pylamda-0.1.0/src/pylamda/references.py +120 -0
- pylamda-0.1.0/src/pylamda/refsearch.py +616 -0
- pylamda-0.1.0/src/pylamda/verify.py +750 -0
- pylamda-0.1.0/src/pylamda/writer.py +138 -0
pylamda-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christian Rab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pylamda-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pylamda
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Work with and work on molecular Line data in the LAMDA format.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: LAMDA,RADEX,EMAA,NLTE,collision rates,Einstein A,molecular data,astrophysics
|
|
8
|
+
Author: Christian Rab
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
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 :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Provides-Extra: plot
|
|
21
|
+
Requires-Dist: matplotlib (>=3.8) ; extra == "dev"
|
|
22
|
+
Requires-Dist: matplotlib (>=3.8) ; extra == "plot"
|
|
23
|
+
Requires-Dist: myst-parser (>=4.0) ; extra == "dev"
|
|
24
|
+
Requires-Dist: numpy (>=1.26)
|
|
25
|
+
Requires-Dist: pytest (>=8) ; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov (>=5) ; extra == "dev"
|
|
27
|
+
Requires-Dist: requests (>=2.31)
|
|
28
|
+
Requires-Dist: ruff (>=0.6) ; extra == "dev"
|
|
29
|
+
Requires-Dist: sphinx (>=8.2) ; extra == "dev"
|
|
30
|
+
Requires-Dist: sphinx-copybutton (>=0.5) ; extra == "dev"
|
|
31
|
+
Requires-Dist: sphinx-rtd-theme (>=3.0) ; extra == "dev"
|
|
32
|
+
Project-URL: Documentation, https://pylamda.readthedocs.io/
|
|
33
|
+
Project-URL: Issues, https://github.com/chrab/pylamda/issues
|
|
34
|
+
Project-URL: Repository, https://github.com/chrab/pylamda
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# pylamda
|
|
38
|
+
|
|
39
|
+
[](https://pylamda.readthedocs.io/)
|
|
40
|
+
[](https://github.com/chrab/pylamda/tree/python-coverage-comment-action-data)
|
|
41
|
+
|
|
42
|
+
Python toolkit for working with and on files in the LAMDA format (the
|
|
43
|
+
[Leiden Atomic and Molecular Database](https://home.strw.leidenuniv.nl/~moldata/)).
|
|
44
|
+
|
|
45
|
+
**Documentation:** <https://pylamda.readthedocs.io/>
|
|
46
|
+
|
|
47
|
+
## Main features
|
|
48
|
+
|
|
49
|
+
- reading, writing and manipulating (i.e. adding collisional partner) LAMDA files
|
|
50
|
+
- validating LAMDA files (i.e. do the follow the LAMDA standard)
|
|
51
|
+
- bibliography support (i.e. get all references for a file in bib format)
|
|
52
|
+
|
|
53
|
+
pylamda follows the [LAMDA standard](https://home.strw.leidenuniv.nl/~moldata/molformat.html)
|
|
54
|
+
strictly: collision partners are identified by their ID only, and deviations are
|
|
55
|
+
reported as issues, never silently interpreted.
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import pylamda
|
|
59
|
+
|
|
60
|
+
data = pylamda.read("co.dat")
|
|
61
|
+
for issue in pylamda.verify(data): # all checks (see docs/checks.rst)
|
|
62
|
+
print(issue)
|
|
63
|
+
pylamda.write(data, "co_normalised.dat")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pylamda check data/*.dat # exit code 1 if there are errors
|
|
68
|
+
pylamda check --statistics data/*.dat
|
|
69
|
+
pylamda compare old.dat new.dat # exit code 1 if they differ
|
|
70
|
+
pylamda bib data/*.dat -o refs.bib --online # SciX needs SCIX_API_TOKEN
|
|
71
|
+
pylamda fix in.dat --in-place --trust id # only the changed lines
|
|
72
|
+
pylamda add-partner o.dat o_chianti.dat e -o o_with_e.dat
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install . # numpy and requests
|
|
79
|
+
pip install ".[plot]" # with matplotlib
|
|
80
|
+
pip install -e ".[dev]" # development: tests, ruff, Sphinx
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Python ≥ 3.11. License: MIT.
|
|
84
|
+
|
pylamda-0.1.0/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# pylamda
|
|
2
|
+
|
|
3
|
+
[](https://pylamda.readthedocs.io/)
|
|
4
|
+
[](https://github.com/chrab/pylamda/tree/python-coverage-comment-action-data)
|
|
5
|
+
|
|
6
|
+
Python toolkit for working with and on files in the LAMDA format (the
|
|
7
|
+
[Leiden Atomic and Molecular Database](https://home.strw.leidenuniv.nl/~moldata/)).
|
|
8
|
+
|
|
9
|
+
**Documentation:** <https://pylamda.readthedocs.io/>
|
|
10
|
+
|
|
11
|
+
## Main features
|
|
12
|
+
|
|
13
|
+
- reading, writing and manipulating (i.e. adding collisional partner) LAMDA files
|
|
14
|
+
- validating LAMDA files (i.e. do the follow the LAMDA standard)
|
|
15
|
+
- bibliography support (i.e. get all references for a file in bib format)
|
|
16
|
+
|
|
17
|
+
pylamda follows the [LAMDA standard](https://home.strw.leidenuniv.nl/~moldata/molformat.html)
|
|
18
|
+
strictly: collision partners are identified by their ID only, and deviations are
|
|
19
|
+
reported as issues, never silently interpreted.
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import pylamda
|
|
23
|
+
|
|
24
|
+
data = pylamda.read("co.dat")
|
|
25
|
+
for issue in pylamda.verify(data): # all checks (see docs/checks.rst)
|
|
26
|
+
print(issue)
|
|
27
|
+
pylamda.write(data, "co_normalised.dat")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pylamda check data/*.dat # exit code 1 if there are errors
|
|
32
|
+
pylamda check --statistics data/*.dat
|
|
33
|
+
pylamda compare old.dat new.dat # exit code 1 if they differ
|
|
34
|
+
pylamda bib data/*.dat -o refs.bib --online # SciX needs SCIX_API_TOKEN
|
|
35
|
+
pylamda fix in.dat --in-place --trust id # only the changed lines
|
|
36
|
+
pylamda add-partner o.dat o_chianti.dat e -o o_with_e.dat
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install . # numpy and requests
|
|
43
|
+
pip install ".[plot]" # with matplotlib
|
|
44
|
+
pip install -e ".[dev]" # development: tests, ruff, Sphinx
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Python ≥ 3.11. License: MIT.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pylamda"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Work with and work on molecular Line data in the LAMDA format."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Christian Rab" }]
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
keywords = ["LAMDA", "RADEX", "EMAA", "NLTE", "collision rates", "Einstein A", "molecular data", "astrophysics"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 4 - Beta",
|
|
13
|
+
"Intended Audience :: Science/Research",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Astronomy",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
21
|
+
]
|
|
22
|
+
dependencies = ["numpy>=1.26", "requests>=2.31"]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Documentation = "https://pylamda.readthedocs.io/"
|
|
26
|
+
Repository = "https://github.com/chrab/pylamda"
|
|
27
|
+
Issues = "https://github.com/chrab/pylamda/issues"
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
plot = ["matplotlib>=3.8"]
|
|
31
|
+
dev = [
|
|
32
|
+
# the extra "plot"
|
|
33
|
+
"matplotlib>=3.8",
|
|
34
|
+
# tests and code style
|
|
35
|
+
"pytest>=8",
|
|
36
|
+
"pytest-cov>=5",
|
|
37
|
+
"ruff>=0.6",
|
|
38
|
+
# documentation (docs/requirements.txt has the exact versions Read the Docs uses)
|
|
39
|
+
"sphinx>=8.2",
|
|
40
|
+
"sphinx-rtd-theme>=3.0",
|
|
41
|
+
"sphinx-copybutton>=0.5",
|
|
42
|
+
"myst-parser>=4.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
pylamda = "pylamda.cli:main"
|
|
47
|
+
|
|
48
|
+
[tool.poetry]
|
|
49
|
+
packages = [{ include = "pylamda", from = "src" }]
|
|
50
|
+
|
|
51
|
+
[build-system]
|
|
52
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
53
|
+
build-backend = "poetry.core.masonry.api"
|
|
54
|
+
|
|
55
|
+
[tool.ruff]
|
|
56
|
+
line-length = 120
|
|
57
|
+
target-version = "py311"
|
|
58
|
+
extend-exclude = ["docs/_build"]
|
|
59
|
+
|
|
60
|
+
[tool.ruff.lint]
|
|
61
|
+
select = [
|
|
62
|
+
"E", # pycodestyle errors
|
|
63
|
+
"W", # pycodestyle warnings
|
|
64
|
+
"F", # pyflakes
|
|
65
|
+
"I", # import order
|
|
66
|
+
"UP", # newer Python syntax
|
|
67
|
+
"B", # likely bugs
|
|
68
|
+
"NPY", # numpy
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
testpaths = ["tests"]
|
|
73
|
+
markers = [
|
|
74
|
+
"corpus: runs on the files given with --corpus (skipped without it)",
|
|
75
|
+
"fortran: needs gfortran on the PATH",
|
|
76
|
+
"online: uses SciX and doi.org (run with --online; SciX needs SCIX_API_TOKEN)",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
# Coverage is opt-in: "pytest --cov" (configuration below).
|
|
80
|
+
[tool.coverage.run]
|
|
81
|
+
source = ["pylamda"]
|
|
82
|
+
branch = true
|
|
83
|
+
relative_files = true # needed by the coverage badge action in CI
|
|
84
|
+
|
|
85
|
+
[tool.coverage.report]
|
|
86
|
+
show_missing = true
|
|
87
|
+
skip_covered = true
|
|
88
|
+
exclude_also = [
|
|
89
|
+
"if TYPE_CHECKING:",
|
|
90
|
+
"if __name__ == .__main__.:",
|
|
91
|
+
"raise NotImplementedError",
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
[tool.coverage.html]
|
|
95
|
+
directory = "htmlcov"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""pylamda: read, write, verify, compare, combine and fix files in the LAMDA format.
|
|
2
|
+
|
|
3
|
+
The format is that of the Leiden Atomic and Molecular Database (LAMDA,
|
|
4
|
+
https://home.strw.leidenuniv.nl/~moldata/molformat.html). pylamda follows the standard
|
|
5
|
+
strictly: collision partners are identified by their ID only, and deviations are
|
|
6
|
+
reported as issues, never silently interpreted.
|
|
7
|
+
|
|
8
|
+
>>> import pylamda
|
|
9
|
+
>>> data = pylamda.read("co.dat") # doctest: +SKIP
|
|
10
|
+
>>> data.issues # doctest: +SKIP
|
|
11
|
+
>>> pylamda.verify(data) # doctest: +SKIP
|
|
12
|
+
>>> pylamda.write(data, "co_normalised.dat") # doctest: +SKIP
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
16
|
+
|
|
17
|
+
from .bib import BibEntry, BibResult, bibtex, collect_references
|
|
18
|
+
from .combine import AddedPartner, CombineError, DroppedPartner, add_partner, drop_partner
|
|
19
|
+
from .compare import LamdaDiff, LevelMatch, PartnerDiff, compare, critical_density, match_levels
|
|
20
|
+
from .fix import FixError, FixRecord, add_reference, fix, patch
|
|
21
|
+
from .issues import CODES, SEVERITIES, Issue, LamdaReadError
|
|
22
|
+
from .model import (
|
|
23
|
+
PARTNER_IDS,
|
|
24
|
+
PARTNERS,
|
|
25
|
+
STANDARD_PARTNERS,
|
|
26
|
+
BlockSource,
|
|
27
|
+
CollisionSet,
|
|
28
|
+
LamdaData,
|
|
29
|
+
SourceMap,
|
|
30
|
+
partner_name,
|
|
31
|
+
split_partner_line,
|
|
32
|
+
)
|
|
33
|
+
from .reader import read
|
|
34
|
+
from .references import find_dois
|
|
35
|
+
from .verify import verify
|
|
36
|
+
from .writer import write
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
__version__ = version("pylamda")
|
|
40
|
+
except PackageNotFoundError: # not installed
|
|
41
|
+
__version__ = "0+unknown"
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
"CODES",
|
|
45
|
+
"PARTNERS",
|
|
46
|
+
"PARTNER_IDS",
|
|
47
|
+
"PartnerDiff",
|
|
48
|
+
"SEVERITIES",
|
|
49
|
+
"STANDARD_PARTNERS",
|
|
50
|
+
"AddedPartner",
|
|
51
|
+
"BibEntry",
|
|
52
|
+
"BibResult",
|
|
53
|
+
"BlockSource",
|
|
54
|
+
"CollisionSet",
|
|
55
|
+
"CombineError",
|
|
56
|
+
"DroppedPartner",
|
|
57
|
+
"FixError",
|
|
58
|
+
"FixRecord",
|
|
59
|
+
"Issue",
|
|
60
|
+
"LevelMatch",
|
|
61
|
+
"LamdaData",
|
|
62
|
+
"LamdaDiff",
|
|
63
|
+
"LamdaReadError",
|
|
64
|
+
"SourceMap",
|
|
65
|
+
"__version__",
|
|
66
|
+
"add_partner",
|
|
67
|
+
"add_reference",
|
|
68
|
+
"bibtex",
|
|
69
|
+
"collect_references",
|
|
70
|
+
"compare",
|
|
71
|
+
"critical_density",
|
|
72
|
+
"drop_partner",
|
|
73
|
+
"find_dois",
|
|
74
|
+
"fix",
|
|
75
|
+
"match_levels",
|
|
76
|
+
"partner_name",
|
|
77
|
+
"patch",
|
|
78
|
+
"read",
|
|
79
|
+
"split_partner_line",
|
|
80
|
+
"verify",
|
|
81
|
+
"write",
|
|
82
|
+
]
|