Synthetic photometry

Filters and responses

Filter loads a packaged response curve plus effective wavelength, bandwidth, flux zeropoint, and zeropoint uncertainty. The response is a dimensionless Spectrum tabulated in Å. Accepted names include 2MASS J/H/Ks, Bessell UBVRI, Gaia G/G_BP/G_RP, Kepler, Spitzer channels 1–4, and TESS; use the exact names stored in the filter table.

Filter.resample(wavelength) mutates filter.response in place. This is important when reusing one Filter instance with spectra on different axes.

Applying a response

apply_filter() multiplies spectrum flux density by the response, integrates over the spectrum wavelength samples, and divides by the tabulated filter bandwidth. If array shapes differ, it first resamples the response onto the spectrum wavelength axis (with tapering) and therefore mutates the filter object. The result is one flux-density quantity in the input spectrum’s flux unit.

The spectrum should cover the response band. The function does not check coverage, propagate spectrum uncertainty, or implement detector-specific photon-counting conventions; validate those choices for precision work.

SEDs and magnitude conversion

SED applies a sequence of filters to a supplied spectrum and stores effective wavelength, bandwidth, and flux arrays. SED.from_grid first loads one model with speclib.Spectrum.from_grid(). Use metallicity= for the library’s native coordinate, or its native alias (feh for PHOENIX-ACES, mh for [M/H] grids). Additional loader keywords are forwarded, including required SPHINX co_ratio and NewEra alpha. SED.meta preserves the selected spectrum’s coordinate and native type; SpecLib does not convert between [Fe/H] and [M/H].

SEDGrid precomputes and trilinearly interpolates SEDs. It currently accepts PHOENIX only and always interpolates; it cannot select the nearest model instead. Its metallicity bounds use metallicity_bds (native [Fe/H]). get_SED uses metallicity or native feh.

mag_to_flux() converts a magnitude using the filter zeropoint and returns (mean, standard_deviation) from Monte Carlo samples of both magnitude and zeropoint uncertainty. mag_err is interpreted in magnitudes. The function currently uses NumPy’s process-wide random generator and has no seed argument; set numpy.random.seed immediately before the call when an exactly reproducible draw is required.

See Synthetic photometry for an offline workflow.