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. A
diagnostic, not what photometry reads: |
|
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, saturation ceiling, wing and halo settings, number of sources, …); the header cards below are written from it. |
|
The PSF ingredients the render used (stamp, wing model, halo), kept
for |
field.write(path) (or output= on simulate_field) writes the FITS
file; field.to_hdulist() returns the HDUList without touching disk.
field.plot() and its siblings draw the images (see Plotting).
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.
Cards whose value is None for a run (no halo, single-mode detector) are
left out.
Group |
Cards |
|---|---|
Pointing |
|
Inputs |
|
Geometry |
|
Detector |
|
PSF |
|
Scattered light |
|
Extended sources |
|
Software |
|
The CLEAN extension carries BUNIT = 'electron'; the CAT
extension is the output catalog of Gaia catalogs.
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"])