Processing and analysis code for remote-telescope imaging sessions
The scripts that processed the NGC 5128 session of 2026-07-21 previously lived inside the data directory and addressed it with absolute paths. Code and data are now separated: the code lives here, and a session is located at runtime through the ASTRO_SESSION environment variable. layout.py is what makes that work. It maps a FILENAME to the subdirectory that file belongs in, using the same rules the session directories are organised with, so a script can go on asking for 'master-Red.fit' or '_stars.npz' without any call site knowing the directory structure. Anything unrecognised resolves to the session root, which is visible and correctable rather than silently wrong. restructure.py reorganises a flat session directory into that layout. It is idempotent and dry-run by default. The 50 session scripts are kept as they were run rather than tidied into a library. They were written in sequence as the work went along, several of them by parallel agents, and they show it - but they are the honest provenance of a published set of results, and the productionised pipeline should be able to reproduce those results exactly. Verified before committing: all 51 files compile without warnings, and verify_core.py, closeup.py and triptych.py were run end to end against the reorganised session, correctly finding inputs across calibrated/, stacks/masters/ and final/ and writing outputs back to the right places.
This commit is contained in:
commit
5286a2e81b
53 changed files with 8820 additions and 0 deletions
49
session-scripts/gaia_colours.py
Normal file
49
session-scripts/gaia_colours.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"""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}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue