flat_normalize¶
Divide ctx.image by a master flat normalised to unity.
| Category | Preprocessing (2-D image) |
| Backend | numpy - implemented here on top of numpy primitives |
| Version | 1.0.1 |
| Reads | ctx.image (an ImageFrame) |
| Writes | image |
Normalisation is by ONE global median of the master flat — not per row and not along the dispersion axis — so the flat lamp's spectral shape remains in the normalised flat and is divided into the science frame. This removes pixel-to-pixel response but also imprints the inverse lamp continuum; the catalogue has no equivalent of IRAF's response (dispersion-direction fit of the lamp) yet, so for spectrophotometry derive the instrumental response afterwards with response_from_standard. Low-response pixels (normalised flat < min_response, or non-finite result) are NOT masked: the original science value is substituted, i.e. those pixels stay un-flattened.
Parameters¶
| Parameter | Default | Required | Description |
|---|---|---|---|
flat_key |
'master_flat' |
- | Key in ctx.extras where the master flat is stored. |
min_response |
0.05 |
- | Below this normalised flat value the science pixel is left unchanged (not divided, not masked). |
Use it¶
The CLI loads a single 1-D spectrum with --input; this algorithm needs
ctx.image (an ImageFrame). Run it from Python or as a step of a pipeline preset.
References¶
- Howell 2006 — Handbook of CCD Astronomy, ch. 4 (flat fielding).
Related algorithms¶
correct_slant_affine- Make monochromatic lines parallel to the rows by a horizontal shear.correct_smile_polynomial- Undo smile curvature via the Schroeder even-order expansion.correct_tilt_affine- Re-align the slit with the detector columns by a vertical shear.dark_subtract- Subtract a master dark fromctx.image.denoise_gaussian_2d- Separable isotropic Gaussian smoothing ofctx.image.denoise_median_2d- Square median filter overctx.image, optionally banded by rows.flat_normalize_easyspec- Flat-field correct a science frame viacleaning.flatten.outlier_rejection_mad_adaptive- Replace pixels whose deviation from a local median exceedsthreshold·MAD.subtract_bias_easyspec- Subtract a master bias from a single science frame viacleaning.debias.subtract_dark_easyspec- Subtract a master dark from a science frame viacleaning.sub_dark.subtract_sky_2d- Subtract a per-column sky model fitted from off-trace rows ofctx.image.