Gaia catalogs

On-disk cache

Pass cache_dir= to cache query results as ECSV files keyed by (ra, dec, radius, mag_limit):

gaia_cache/gaia_291.000000_+44.500000_107.0_21.00.ecsv

The pointing in the key is rounded to 1 arcsec, so the frames of a dithered series (sub-pixel to a few arcsec apart) share one query. Repeat calls with identical parameters read the file instead of hitting the Gaia archive, so simulations become fully offline and reproducible. A cache file written before the astrometry columns existed is ignored with a warning and the archive is queried again. The repository’s notebooks/gaia_cache/ ships with the cached queries used by the tutorials.

Bright stars Gaia does not have

Gaia’s brightest source is G = 1.7, so the naked-eye stars whose halos drive the stray-light requirements are missing from a DR3 query. The optional wcc_sim.brightcat module fills that end from XHIP (Hipparcos plus radial velocities, VizieR V/137D): query_bright() fetches and caches the rows, to_gaia_like() converts them to the Gaia-shaped table (G from V and B-V, a template from the spectral type), and merge() propagates both catalogs to one epoch, cross-matches them, and lets the Hipparcos row win for stars brighter than G = 6 (where DR3’s saturation systematics live). The merged table is sorted brightest first, so row 0, the row the PSF report decomposes, is the brightest star in the field. It is not part of the default pipeline; pass the merged table as catalog=.

Bringing your own catalog

Any astropy Table with the six photometric Gaia columns (the astrometry columns are optional) can be passed straight to simulate_field() via catalog=, and the Gaia query is skipped entirely. This is how the test suite runs without network, and it is the easiest way to inject synthetic grids of stars:

import numpy as np
from astropy.table import Table
from wcc_sim import simulate_field

n = 25
cat = Table({
    "source_id": np.arange(n),
    "ra": 150.1 + np.random.uniform(-0.02, 0.02, n),
    "dec": 2.2 + np.random.uniform(-0.02, 0.02, n),
    "phot_g_mean_mag": np.random.uniform(10, 18, n),
    "phot_bp_mean_mag": np.full(n, np.nan),   # NaN color -> G2V
    "phot_rp_mean_mag": np.full(n, np.nan),
})
field = simulate_field(150.1, 2.2, catalog=cat, shape=(2048, 2048), seed=1)

A spt column, when present, pins the template of a star instead of deriving it from BP-RP. Rows without a finite G magnitude, or that do not project onto the tangent plane, are dropped with a warning.

The output catalog

simulate_field() returns the catalog with eight added columns (also written to the FITS CAT extension):

Column

Meaning

x, y

0-based pixel position from the WCS (may be off-array).

spt

Assigned Pickles dwarf spectral type (see From Gaia photometry to count rates).

spt_fallback

True when the star had no usable BP-RP and got the G2V fallback.

rate_e_s

Total point-source count rate [e-/s].

psf_wavelength_nm

Wavelength of the star’s in-focus Airy core (its template’s effective wavelength through the band, or the wavelength_nm override; see PSFs and defocus).

in_image

True if the star center falls on the array.

saturated

True if any saturated pixel lies within 32 px of the star (window sized to cover the 2-wave defocus ring; see Noise and saturation).