gaia-catalog 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.

Potentially problematic release.


This version of gaia-catalog might be problematic. Click here for more details.

@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: gaia-catalog
3
+ Version: 0.1.0
4
+ Summary: Bundled Gaia DR3 + Hipparcos merged star catalog in binary format
5
+ Author: Steven Michael
6
+ License-Expression: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+
14
+ # gaia-catalog
15
+
16
+ Bundled [Gaia DR3](https://www.cosmos.esa.int/web/gaia/dr3) + Hipparcos merged star catalog in a compact binary format for Python.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install gaia-catalog
22
+ ```
23
+
24
+ ## Creating the binary catalog
25
+
26
+ The binary data file is not included in the repository. To create it from a `gaia_merged.csv` (produced by tetra3rs's download script):
27
+
28
+ ```bash
29
+ python -c "from gaia_catalog import convert_csv_to_binary; convert_csv_to_binary('path/to/gaia_merged.csv')"
30
+ ```
31
+
32
+ This writes `gaia_merged.bin` into the package's `data/` directory.
33
+
34
+ ## Usage
35
+
36
+ ```python
37
+ from gaia_catalog import catalog_path
38
+
39
+ path = catalog_path()
40
+ ```
41
+
42
+ ## Binary format
43
+
44
+ ```
45
+ Header: b'GDR3' (4 bytes) + version (u32 LE) + num_stars (u64 LE)
46
+ Per star: source_id (i64 LE) + ra (f64 LE) + dec (f64 LE)
47
+ + mag (f32 LE) + pmra (f32 LE) + pmdec (f32 LE)
48
+ ```
49
+
50
+ 36 bytes per star, little-endian throughout.
51
+
52
+ ## Data license
53
+
54
+ Gaia DR3 data is published by ESA/Gaia/DPAC under [CC BY-NC 3.0 IGO](https://creativecommons.org/licenses/by-nc/3.0/igo/). If you use this catalog, please cite Gaia DR3 appropriately. The code in this package is MIT-licensed.
@@ -0,0 +1,41 @@
1
+ # gaia-catalog
2
+
3
+ Bundled [Gaia DR3](https://www.cosmos.esa.int/web/gaia/dr3) + Hipparcos merged star catalog in a compact binary format for Python.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install gaia-catalog
9
+ ```
10
+
11
+ ## Creating the binary catalog
12
+
13
+ The binary data file is not included in the repository. To create it from a `gaia_merged.csv` (produced by tetra3rs's download script):
14
+
15
+ ```bash
16
+ python -c "from gaia_catalog import convert_csv_to_binary; convert_csv_to_binary('path/to/gaia_merged.csv')"
17
+ ```
18
+
19
+ This writes `gaia_merged.bin` into the package's `data/` directory.
20
+
21
+ ## Usage
22
+
23
+ ```python
24
+ from gaia_catalog import catalog_path
25
+
26
+ path = catalog_path()
27
+ ```
28
+
29
+ ## Binary format
30
+
31
+ ```
32
+ Header: b'GDR3' (4 bytes) + version (u32 LE) + num_stars (u64 LE)
33
+ Per star: source_id (i64 LE) + ra (f64 LE) + dec (f64 LE)
34
+ + mag (f32 LE) + pmra (f32 LE) + pmdec (f32 LE)
35
+ ```
36
+
37
+ 36 bytes per star, little-endian throughout.
38
+
39
+ ## Data license
40
+
41
+ Gaia DR3 data is published by ESA/Gaia/DPAC under [CC BY-NC 3.0 IGO](https://creativecommons.org/licenses/by-nc/3.0/igo/). If you use this catalog, please cite Gaia DR3 appropriately. The code in this package is MIT-licensed.
@@ -0,0 +1,67 @@
1
+ """Bundled Gaia DR3 + Hipparcos merged star catalog in binary format."""
2
+
3
+ import csv
4
+ import math
5
+ import struct
6
+ from pathlib import Path
7
+
8
+ __version__ = "0.1.0"
9
+
10
+ _DATA_DIR = Path(__file__).parent / "data"
11
+
12
+
13
+ def catalog_path() -> Path:
14
+ """Return the path to the bundled gaia_merged.bin file."""
15
+ return _DATA_DIR / "gaia_merged.bin"
16
+
17
+
18
+ def convert_csv_to_binary(csv_path: str, output_path: str | None = None) -> None:
19
+ """Convert a gaia_merged.csv file to the compact binary format.
20
+
21
+ CSV columns: source_id,ra,dec,phot_g_mean_mag,pmra,pmdec
22
+
23
+ Binary format:
24
+ Header: b'GDR3' + version (u32 LE, 1) + num_stars (u64 LE)
25
+ Per star: source_id (i64 LE) + ra (f64 LE) + dec (f64 LE)
26
+ + mag (f32 LE) + pmra (f32 LE) + pmdec (f32 LE)
27
+ = 36 bytes per star
28
+
29
+ Args:
30
+ csv_path: Path to gaia_merged.csv.
31
+ output_path: Destination for the binary file. Defaults to the
32
+ package's data/gaia_merged.bin.
33
+ """
34
+ if output_path is None:
35
+ output_path = str(_DATA_DIR / "gaia_merged.bin")
36
+
37
+ # First pass: read all rows into memory so we know num_stars for the header.
38
+ stars: list[tuple[int, float, float, float, float, float]] = []
39
+ with open(csv_path, newline="") as f:
40
+ reader = csv.reader(f)
41
+ header = next(reader) # skip header row
42
+ for row in reader:
43
+ source_id = int(row[0])
44
+ ra = float(row[1])
45
+ dec = float(row[2])
46
+ mag = float(row[3])
47
+ pmra_val = float(row[4]) if row[4] else 0.0
48
+ pmdec_val = float(row[5]) if row[5] else 0.0
49
+ if math.isnan(pmra_val):
50
+ pmra_val = 0.0
51
+ if math.isnan(pmdec_val):
52
+ pmdec_val = 0.0
53
+ stars.append((source_id, ra, dec, mag, pmra_val, pmdec_val))
54
+
55
+ num_stars = len(stars)
56
+
57
+ with open(output_path, "wb") as out:
58
+ # Header: magic + version + num_stars
59
+ out.write(b"GDR3")
60
+ out.write(struct.pack("<I", 1))
61
+ out.write(struct.pack("<Q", num_stars))
62
+
63
+ # Star records
64
+ for source_id, ra, dec, mag, pmra_val, pmdec_val in stars:
65
+ out.write(struct.pack("<qddfff", source_id, ra, dec, mag, pmra_val, pmdec_val))
66
+
67
+ print(f"Wrote {num_stars} stars to {output_path}")
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: gaia-catalog
3
+ Version: 0.1.0
4
+ Summary: Bundled Gaia DR3 + Hipparcos merged star catalog in binary format
5
+ Author: Steven Michael
6
+ License-Expression: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+
14
+ # gaia-catalog
15
+
16
+ Bundled [Gaia DR3](https://www.cosmos.esa.int/web/gaia/dr3) + Hipparcos merged star catalog in a compact binary format for Python.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install gaia-catalog
22
+ ```
23
+
24
+ ## Creating the binary catalog
25
+
26
+ The binary data file is not included in the repository. To create it from a `gaia_merged.csv` (produced by tetra3rs's download script):
27
+
28
+ ```bash
29
+ python -c "from gaia_catalog import convert_csv_to_binary; convert_csv_to_binary('path/to/gaia_merged.csv')"
30
+ ```
31
+
32
+ This writes `gaia_merged.bin` into the package's `data/` directory.
33
+
34
+ ## Usage
35
+
36
+ ```python
37
+ from gaia_catalog import catalog_path
38
+
39
+ path = catalog_path()
40
+ ```
41
+
42
+ ## Binary format
43
+
44
+ ```
45
+ Header: b'GDR3' (4 bytes) + version (u32 LE) + num_stars (u64 LE)
46
+ Per star: source_id (i64 LE) + ra (f64 LE) + dec (f64 LE)
47
+ + mag (f32 LE) + pmra (f32 LE) + pmdec (f32 LE)
48
+ ```
49
+
50
+ 36 bytes per star, little-endian throughout.
51
+
52
+ ## Data license
53
+
54
+ Gaia DR3 data is published by ESA/Gaia/DPAC under [CC BY-NC 3.0 IGO](https://creativecommons.org/licenses/by-nc/3.0/igo/). If you use this catalog, please cite Gaia DR3 appropriately. The code in this package is MIT-licensed.
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ gaia_catalog/__init__.py
4
+ gaia_catalog.egg-info/PKG-INFO
5
+ gaia_catalog.egg-info/SOURCES.txt
6
+ gaia_catalog.egg-info/dependency_links.txt
7
+ gaia_catalog.egg-info/top_level.txt
8
+ gaia_catalog/data/gaia_merged.bin
@@ -0,0 +1 @@
1
+ gaia_catalog
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "gaia-catalog"
7
+ version = "0.1.0"
8
+ description = "Bundled Gaia DR3 + Hipparcos merged star catalog in binary format"
9
+ requires-python = ">=3.10"
10
+ authors = [{ name = "Steven Michael" }]
11
+ license = "MIT"
12
+ readme = "README.md"
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Science/Research",
16
+ "Programming Language :: Python :: 3",
17
+ "Topic :: Scientific/Engineering :: Astronomy",
18
+ ]
19
+
20
+ [tool.setuptools.packages.find]
21
+ include = ["gaia_catalog*"]
22
+
23
+ [tool.setuptools.package-data]
24
+ gaia_catalog = ["data/*.bin"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+