FITS output and WCS
The SimulatedField object
simulate_field() returns a SimulatedField
dataclass:
Attribute |
Contents |
|---|---|
|
Digitized image [ADU], float32 — what a real frame looks like. |
|
The same realization in electrons, before gain/bias/clipping. |
|
Noiseless expectation image [e-] (sources + sky + dark). |
|
Boolean per pixel: full-well or ADC saturated. |
|
astropy TAN WCS of the frame. |
|
The injected catalog with |
|
Every input parameter plus derived quantities (plate scale, gain, read noise, sky/dark rates, well depth, number of sources, …). |
field.write(path) (or output= on simulate_field) writes the FITS
file; field.to_hdulist() returns the HDUList without touching disk.
FITS layout
EXT |
Type |
Contents |
|---|---|---|
|
Primary image, float32 |
The ADU image, with the full WCS + parameter header. |
|
Image, uint8 |
1 where the pixel saturated (full well or ADC). |
|
Binary table |
The injected catalog. |
|
Image, float32 |
Noiseless expectation [e-]; omitted with |
Header cards
Beyond the WCS keywords, the SCI header records the full provenance:
RA_PNT, DEC_PNT, PA (pointing), SENSORF, FOCUS, EXPTIME, NREADS,
JITTER, MAGLIM, SEED, GAIARAD (inputs), NSRC, PLTSCL, GAIN, RDNOISE,
DARK, SKYRATE, WELLDEP (derived), plus WCCSIMV / WCCETCV (software
versions) and DATE (creation time, UTC).
The WCS
build_wcs() constructs a gnomonic (RA---TAN /
DEC--TAN) WCS centered on the pointing, with no distortion terms:
CRPIXis the array center (FITS 1-based convention);the CD matrix encodes the plate scale and the position angle
pa(degrees E of N), with the conventional east-left parity (RA increases to the left atpa=0);parotates the field on the detector.
Round-trip accuracy of catalog positions through the WCS is at the floating-point level — the tutorials include an astrometric closure check.
Reading it back
from astropy.io import fits
from astropy.table import Table
from astropy.wcs import WCS
with fits.open("field_1wave.fits") as hdul:
sci = hdul["SCI"].data
hdr = hdul["SCI"].header
wcs = WCS(hdr)
sat = hdul["SATMASK"].data.astype(bool)
cat = Table.read(hdul["CAT"])
clean = hdul["CLEAN"].data # if written
print(hdr["SENSORF"], hdr["EXPTIME"], hdr["WCCSIMV"])