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.
49 lines
1.9 KiB
Python
49 lines
1.9 KiB
Python
"""Fetch Gaia DR3 BP-RP colours for the field, cached for colour calibration.
|
|
|
|
The first composite balanced colour on "the average field star is grey", which
|
|
is a workable fudge but is biased by whatever mix of spectral types the field
|
|
happens to contain. With real colours available, a much better anchor exists:
|
|
pick the stars that actually ARE solar-coloured (BP-RP near 0.82) and force
|
|
those to neutral. That is the same principle as a photometric colour
|
|
calibration, without needing the filters' response curves.
|
|
|
|
ESA's archive was down during this work, so this uses the VizieR mirror of the
|
|
identical catalogue.
|
|
"""
|
|
import os
|
|
|
|
import numpy as np
|
|
from astropy import units as u
|
|
from astropy.coordinates import SkyCoord
|
|
|
|
import layout
|
|
|
|
OUT = layout.SESSION
|
|
CACHE = layout.path("_gaia_colours.npz")
|
|
CENTRE = SkyCoord("13h25m27.37s", "-43d01m10.9s")
|
|
|
|
if os.path.exists(CACHE):
|
|
z = np.load(CACHE)
|
|
print(f"cached: {len(z['ra'])} stars with colours")
|
|
else:
|
|
from astroquery.vizier import Vizier
|
|
v = Vizier(columns=["RA_ICRS", "DE_ICRS", "Gmag", "BP-RP"],
|
|
column_filters={"Gmag": "<18", "BP-RP": ">-1"},
|
|
row_limit=50000)
|
|
res = v.query_region(CENTRE, radius=0.45 * u.deg, catalog="I/355/gaiadr3")
|
|
t = res[0]
|
|
ok = ~np.isnan(np.asarray(t["BP-RP"], float))
|
|
ra = np.asarray(t["RA_ICRS"], float)[ok]
|
|
dec = np.asarray(t["DE_ICRS"], float)[ok]
|
|
g = np.asarray(t["Gmag"], float)[ok]
|
|
bprp = np.asarray(t["BP-RP"], float)[ok]
|
|
np.savez_compressed(CACHE, ra=ra, dec=dec, g=g, bprp=bprp)
|
|
print(f"fetched {len(ra)} stars with BP-RP")
|
|
z = dict(ra=ra, dec=dec, g=g, bprp=bprp)
|
|
|
|
bprp = z["bprp"]
|
|
solar = np.abs(bprp - 0.82) < 0.15
|
|
print(f"BP-RP range {bprp.min():.2f} to {bprp.max():.2f}, "
|
|
f"median {np.median(bprp):.2f}")
|
|
print(f"solar-coloured stars (BP-RP 0.67-0.97): {solar.sum()}")
|
|
print(f"G range {z['g'].min():.1f} to {z['g'].max():.1f}")
|