convert_flux_to_rayleigh¶
Response-corrected counts of a slit spectrograph to rayleigh per nm.
| Category | Flux calibration |
| Backend | numpy - implemented here on top of numpy primitives |
| Version | 1.0.0 |
| Reads | ctx.spectrum (a Spectrum1D) |
| Writes | spectrum, metrics.applied, metrics.solid_angle_sr, metrics.response_abs, metrics.exptime_s |
Per sample: I_λ [R/nm] = (norm / (EXPTIME · dispersion · scale · Ω)) · (λ[cm] / hc) · 4π · 1e-6 · 10, where norm is meta['normalization_factor'] (1 when the spectrum was not normalised ; a normalize_to_region step is undone), dispersion is the median wavelength step times samples_per_pixel (Å per native pixel), scale is the absolute response read from the header of ctx.extras[response_key] under response_scale_keyword (ADU s⁻¹ Å⁻¹ per erg s⁻¹ cm⁻² Å⁻¹, a convention of whoever built the response, hence no default keyword) and EXPTIME is read from the spectrum header, else from the image header. A missing reference, scale or exposure time goes to on_missing: 'fail' or 'skip' (applied = 0, spectrum untouched). The uncertainty is scaled like the flux ; flux_unit becomes 'R/nm' ; meta drops normalized_to_region and normalization_factor, sets flux_calibrated = True, relative_window (window_lo / window_hi, else the normalisation window) and absolute_flux = {unit, solid_angle_sr, response_abs}. Metrics: applied, solid_angle_sr, response_abs, exptime_s. Companions: response_from_standard and flux_calibrate_easyspec give erg s⁻¹ cm⁻² Å⁻¹ for point sources ; this brick is for an extended source filling the slit, through a solid angle.
Parameters¶
| Parameter | Default | Required | Description |
|---|---|---|---|
slit_width_um |
None |
yes | Width of the slit (µm). Required, > 0. |
focal_mm |
None |
yes | Focal length of the objective imaging the sky on the slit (mm). Required. |
aperture_rows |
None |
yes | Number of detector rows summed by the extraction. Required, > 0. |
pixel_um |
None |
yes | Detector pixel size (µm). Required, > 0. |
magnification |
1.0 |
- | Slit-to-detector magnification along the slit. |
samples_per_pixel |
1.0 |
- | Output samples per native detector pixel (the oversampling of the wavelength grid) ; 1 when the spectrum is on its native sampling. |
response_key |
'reference_spectrum' |
- | ctx.extras key of the response spectrum whose header holds the scale. |
response_scale_keyword |
None |
yes | Header keyword of the response spectrum holding its absolute scale (ADU s⁻¹ Å⁻¹ per erg s⁻¹ cm⁻² Å⁻¹). Required. |
exptime_keyword |
'EXPTIME' |
- | Header keyword of the exposure time (s). |
window_lo |
None |
- | Reference window of a relative view (Å), recorded in meta. |
window_hi |
None |
- | Upper bound of that window (Å). |
on_missing |
'fail' |
- | 'fail' (default) or 'skip' when the scale or the exposure time is missing. |
Use it¶
from spectro_kernel import run_algorithm
output = run_algorithm("convert_flux_to_rayleigh", ctx, {
"slit_width_um": "<value>",
"focal_mm": "<value>",
"aperture_rows": "<value>",
"pixel_um": "<value>",
"magnification": 1.0,
"samples_per_pixel": 1.0,
"response_key": "reference_spectrum",
"response_scale_keyword": "<value>",
"exptime_keyword": "EXPTIME",
"window_lo": None,
"window_hi": None,
"on_missing": "fail"
})
spectro run convert_flux_to_rayleigh --input spectrum.fits \
--param slit_width_um=<value> \
--param focal_mm=<value> \
--param aperture_rows=<value> \
--param pixel_um=<value> \
--param magnification=1.0 \
--param samples_per_pixel=1.0 \
--param response_key=reference_spectrum \
--param response_scale_keyword=<value> \
--param exptime_keyword=EXPTIME \
--param window_lo=none \
--param window_hi=none \
--param on_missing=fail
{
"tool": "convert_flux_to_rayleigh",
"arguments": {
"session_id": "<session_id>",
"params": {
"slit_width_um": "<value>",
"focal_mm": "<value>",
"aperture_rows": "<value>",
"pixel_um": "<value>",
"magnification": 1.0,
"samples_per_pixel": 1.0,
"response_key": "reference_spectrum",
"response_scale_keyword": "<value>",
"exptime_keyword": "EXPTIME",
"window_lo": null,
"window_hi": null,
"on_missing": "fail"
}
}
}
Every algorithm is an MCP tool of the same name; describe_algorithm returns
this page's metadata as JSON.
References¶
- Hunten, Roach & Chamberlain 1956, J. Atmos. Terr. Phys. 8, 345–346, DOI 10.1016/0021-9169(56)90111-8 — the rayleigh, a photometric unit for the airglow and aurora.
- Baker 1974, Appl. Opt. 13(9), 2160–2163, DOI 10.1364/AO.13.002160 — Rayleigh, the unit for light radiance.
- Baker & Romick 1976, Appl. Opt. 15(8), 1966, DOI 10.1364/AO.15.001966 — the rayleigh: interpretation of the unit in terms of column emission rate.
Related algorithms¶
flux_calibrate_easyspec- Flux-calibratectx.spectrumvia a standard-star observation.response_from_standard- Derive the instrumental response curve from a standard-star observation.