Preparing to merge this repository into a combined astrophotography repo. session-scripts/ becomes pipeline/ because the scripts import layout.py from their own directory and must stay together, and because 'pipeline' says what it is rather than how it came about. observing/ stays at the top level: observing plans are not processing code.
32 lines
1.4 KiB
Python
32 lines
1.4 KiB
Python
"""Gaia DR3 astrometry via the VizieR mirror I/355/gaiadr3 (the ESA Gaia archive
|
|
was down for maintenance). Same rationale as gc-gaia-astrom.py."""
|
|
import os, numpy as np
|
|
from astroquery.vizier import Vizier
|
|
from astropy.coordinates import SkyCoord
|
|
import astropy.units as u
|
|
|
|
import layout
|
|
|
|
S = layout.SESSION
|
|
c = SkyCoord(201.36404, -43.01969, unit="deg")
|
|
|
|
cols = ["RA_ICRS", "DE_ICRS", "Source", "Gmag", "BPmag", "RPmag", "BP-RP",
|
|
"Plx", "e_Plx", "pmRA", "e_pmRA", "pmDE", "e_pmDE", "RUWE"]
|
|
v = Vizier(columns=cols, row_limit=-1, column_filters={"Gmag": "<21.0"})
|
|
t = v.query_region(c, radius=0.42 * u.deg, catalog="I/355/gaiadr3")[0]
|
|
print("rows:", len(t), t.colnames)
|
|
|
|
d = {}
|
|
for k, name in [("ra", "RA_ICRS"), ("dec", "DE_ICRS"), ("g", "Gmag"),
|
|
("bp", "BPmag"), ("rp", "RPmag"), ("bprp", "BP-RP"),
|
|
("plx", "Plx"), ("eplx", "e_Plx"), ("pmra", "pmRA"),
|
|
("epmra", "e_pmRA"), ("pmdec", "pmDE"), ("epmdec", "e_pmDE"),
|
|
("ruwe", "RUWE")]:
|
|
if name in t.colnames:
|
|
col = t[name]
|
|
d[k] = np.array(col.filled(np.nan) if hasattr(col, "filled") else col, dtype=float)
|
|
np.savez(layout.path("_gaia_astrom.npz"), **d)
|
|
g = d["g"]
|
|
print("saved. G<18 %d | 18-20 %d | >=20 %d" %
|
|
((g < 18).sum(), ((g >= 18) & (g < 20)).sum(), (g >= 20).sum()))
|
|
print("finite plx %d, finite pm %d" % (np.isfinite(d["plx"]).sum(), np.isfinite(d["pmra"]).sum()))
|