pagaia 0.0.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.
- pagaia-0.0.0/PKG-INFO +39 -0
- pagaia-0.0.0/README.md +20 -0
- pagaia-0.0.0/pagaia/__init__.py +11 -0
- pagaia-0.0.0/pagaia/_resolve.py +77 -0
- pagaia-0.0.0/pagaia/nss.py +9 -0
- pagaia-0.0.0/pagaia.egg-info/PKG-INFO +39 -0
- pagaia-0.0.0/pagaia.egg-info/SOURCES.txt +10 -0
- pagaia-0.0.0/pagaia.egg-info/dependency_links.txt +1 -0
- pagaia-0.0.0/pagaia.egg-info/requires.txt +7 -0
- pagaia-0.0.0/pagaia.egg-info/top_level.txt +1 -0
- pagaia-0.0.0/pyproject.toml +35 -0
- pagaia-0.0.0/setup.cfg +4 -0
pagaia-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pagaia
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Python tools for the analysis of Gaia data
|
|
5
|
+
Author-email: João Faria <joao.faria@unige.ch>
|
|
6
|
+
Project-URL: homepage, https://pagaia.org/
|
|
7
|
+
Project-URL: documentation, https://github.com/j-faria/pagaia/docs
|
|
8
|
+
Project-URL: repository, https://github.com/j-faria/pagaia
|
|
9
|
+
Project-URL: changelog, https://github.com/j-faria/pagaia/blob/main/CHANGES.md
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: astropy
|
|
16
|
+
Requires-Dist: astroquery
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest; extra == "dev"
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img src="docs/assets/logo.png"
|
|
22
|
+
alt="Pagaia — Python tools for Gaia data"
|
|
23
|
+
width="320">
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
To install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install pagaia
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To use
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from pagaia import DR3_4472832130942575872 as barnard
|
|
37
|
+
|
|
38
|
+
from pagaia.nss import DR3_1712614124767394816 as gaia3
|
|
39
|
+
```
|
pagaia-0.0.0/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/logo.png"
|
|
3
|
+
alt="Pagaia — Python tools for Gaia data"
|
|
4
|
+
width="320">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
To install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install pagaia
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
To use
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from pagaia import DR3_4472832130942575872 as barnard
|
|
18
|
+
|
|
19
|
+
from pagaia.nss import DR3_1712614124767394816 as gaia3
|
|
20
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from functools import lru_cache
|
|
6
|
+
from typing import Any, Callable
|
|
7
|
+
|
|
8
|
+
_NAME_RE = re.compile(r"^(?P<release>DR\d+)_(?P<source_id>\d+)$")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class TableSpec:
|
|
13
|
+
"""Where to look for a given release in a given module."""
|
|
14
|
+
table: str # e.g. "gaiadr3.gaia_source"
|
|
15
|
+
id_column: str = "source_id"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class Target:
|
|
20
|
+
"""Information about a single Gaia source in one table."""
|
|
21
|
+
release: str
|
|
22
|
+
source_id: int
|
|
23
|
+
table: str
|
|
24
|
+
data: Any # astropy.table.Row
|
|
25
|
+
meta: dict = field(default_factory=dict)
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def columns(self):
|
|
29
|
+
return self.data.colnames
|
|
30
|
+
|
|
31
|
+
def __getitem__(self, key: str):
|
|
32
|
+
return self.data[key]
|
|
33
|
+
|
|
34
|
+
def __repr__(self) -> str:
|
|
35
|
+
return f"<Target {self.release}_{self.source_id} ({self.table})>"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@lru_cache(maxsize=256)
|
|
39
|
+
def _fetch(table: str, id_column: str, source_id: int):
|
|
40
|
+
# Imported lazily so `import pagaia` stays fast and offline-safe.
|
|
41
|
+
from astroquery.gaia import Gaia
|
|
42
|
+
|
|
43
|
+
# source_id is an int (validated by the regex), so no injection risk.
|
|
44
|
+
query = f"SELECT * FROM {table} WHERE {id_column} = {source_id}"
|
|
45
|
+
result = Gaia.launch_job_async(query).get_results()
|
|
46
|
+
if len(result) == 0:
|
|
47
|
+
raise LookupError(f"source_id {source_id} not found in {table}") from None
|
|
48
|
+
return result[0]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def make_getattr(
|
|
52
|
+
module_name: str,
|
|
53
|
+
specs: dict[str, TableSpec],
|
|
54
|
+
fetch: Callable[[str, str, int], Any] = _fetch,
|
|
55
|
+
) -> Callable[[str], Target]:
|
|
56
|
+
"""Build a module-level ``__getattr__`` for names like ``DR3_123456789``"""
|
|
57
|
+
|
|
58
|
+
def __getattr__(name: str) -> Target:
|
|
59
|
+
m = _NAME_RE.match(name)
|
|
60
|
+
if m is None:
|
|
61
|
+
# Must be AttributeError so that `from pagaia import nss`
|
|
62
|
+
# (submodule import), hasattr(), copy/pickle probes, etc. still work.
|
|
63
|
+
raise AttributeError(f"module {module_name!r} has no attribute {name!r}")
|
|
64
|
+
|
|
65
|
+
release, source_id = m["release"], int(m["source_id"])
|
|
66
|
+
try:
|
|
67
|
+
spec = specs[release]
|
|
68
|
+
except KeyError:
|
|
69
|
+
raise AttributeError(
|
|
70
|
+
f"module {module_name!r} has no data for release {release!r}; "
|
|
71
|
+
f"available: {', '.join(sorted(specs))}"
|
|
72
|
+
) from None
|
|
73
|
+
|
|
74
|
+
row = fetch(spec.table, spec.id_column, source_id)
|
|
75
|
+
return Target(release, source_id, spec.table, row)
|
|
76
|
+
|
|
77
|
+
return __getattr__
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pagaia
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Python tools for the analysis of Gaia data
|
|
5
|
+
Author-email: João Faria <joao.faria@unige.ch>
|
|
6
|
+
Project-URL: homepage, https://pagaia.org/
|
|
7
|
+
Project-URL: documentation, https://github.com/j-faria/pagaia/docs
|
|
8
|
+
Project-URL: repository, https://github.com/j-faria/pagaia
|
|
9
|
+
Project-URL: changelog, https://github.com/j-faria/pagaia/blob/main/CHANGES.md
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: astropy
|
|
16
|
+
Requires-Dist: astroquery
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest; extra == "dev"
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img src="docs/assets/logo.png"
|
|
22
|
+
alt="Pagaia — Python tools for Gaia data"
|
|
23
|
+
width="320">
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
To install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install pagaia
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To use
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from pagaia import DR3_4472832130942575872 as barnard
|
|
37
|
+
|
|
38
|
+
from pagaia.nss import DR3_1712614124767394816 as gaia3
|
|
39
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pagaia
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ['setuptools', 'wheel']
|
|
3
|
+
build-backend = 'setuptools.build_meta'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "pagaia"
|
|
8
|
+
readme = { "file" = "README.md", "content-type" = "text/markdown" }
|
|
9
|
+
license-files = ["LICEN[CS]E*"]
|
|
10
|
+
authors = [{ name = "João Faria", email = "joao.faria@unige.ch" }]
|
|
11
|
+
description = "Python tools for the analysis of Gaia data"
|
|
12
|
+
requires-python = ">=3.12"
|
|
13
|
+
classifiers = ["Programming Language :: Python :: 3"]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"numpy",
|
|
16
|
+
"scipy",
|
|
17
|
+
"astropy",
|
|
18
|
+
"astroquery",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
dynamic = ["version"]
|
|
22
|
+
|
|
23
|
+
[tool.setuptools.packages.find]
|
|
24
|
+
where = [".", "pagaia"]
|
|
25
|
+
include = ["pagaia*"]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = ["pytest"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
homepage = "https://pagaia.org/"
|
|
33
|
+
documentation = "https://github.com/j-faria/pagaia/docs"
|
|
34
|
+
repository = "https://github.com/j-faria/pagaia"
|
|
35
|
+
changelog = "https://github.com/j-faria/pagaia/blob/main/CHANGES.md"
|
pagaia-0.0.0/setup.cfg
ADDED