scopesim.effects.ter_curves_utils.scale_spectrum#
- scopesim.effects.ter_curves_utils.scale_spectrum(spectrum, filter_name, amplitude)#
Scale a SourceSpectrum to a value in a filter.
- Parameters:
spectrum (synphot.SourceSpectrum)
filter_name (str) – Name of a filter from - a local instrument package (available in
rc.__search_path__) - a generic filter name (seeter_curves_utils.FILTER_DEFAULTS) - a spanish-vo filter service reference (e.g. “Paranal/HAWKI.Ks”)amplitude (astropy.Quantity, float) – The value that the spectrum should have in the given filter. Acceptable astropy quantities are: - u.mag : Vega magnitudes - u.ABmag : AB magnitudes - u.STmag : HST magnitudes - u.Jy : Jansky per filter bandpass Additionally the “FLAM” and “FNU” units from
synphot.unitscan be used when passing the quantity for amplitude.
- Returns:
spectrum – Input spectrum scaled to the given amplitude in the given filter.
- Return type:
synphot.SourceSpectrum
Examples
>>> from scopesim.source.source_templates import vega_spectrum >>> from scopesim.effects.ter_curves_utils as ter_utils >>> >>> spec = vega_spectrum() >>> vega_185 = ter_utils.scale_spectrum(spec, "Ks", -1.85 * u.mag) >>> ab_0 = ter_utils.scale_spectrum(spec, "Ks", 0 * u.ABmag) >>> jy_3630 = ter_utils.scale_spectrum(spec, "Ks", 3630 * u.Jy)