scale_spectrum¶
-
simcado.source.
scale_spectrum
(lam, spec, mag, filter_name='Ks', return_ec=False)[source]¶ Scale a spectrum to be a certain magnitude
- Parameters
- lamnp.ndarray
[um] The wavelength bins for spectrum
- specnp.ndarray
The spectrum to be scaled into [ph/s/m2] for the given broadband filter
- magfloat
magnitude of the source
- filter_namestr, TransmissionCurve, optional
Any filter name from SimCADO or a
TransmissionCurve
object (seeget_filter_set()
)- return_ecbool, optional
If True, a
simcado.spectral.EmissionCurve
object is returned. Default is False
- Returns
- lamnp.ndarray
[um] The centres of the wavelength bins for the new spectrum
- specnp.ndarray
[ph/s/m2] The spectrum scaled to the specified magnitude
- If return_ec == True, a
simcado.spectral.EmissionCurve
is returned
See also
Examples
Scale the spectrum of a G2V star to J=25:
>>> lam, spec = simcado.source.SED("G2V") >>> lam, spec = simcado.source.scale_spectrum(lam, spec, 25, "J")
Scale the spectra for many stars to different H-band magnitudes:
>>> from simcado.source import SED, scale_spectrum >>> >>> star_list = ["A0V", "G2V", "M5V", "B6III", "O9I", "M2IV"] >>> magnitudes = [ 20, 25.5, 29.1, 17, 14.3, 22 ] >>> lam, spec = SED(star_list) >>> lam, spec = scale_spectrum(lam, spec, magnitudes, "H")
Re-scale the above spectra to the same magnitudes in Pa-Beta:
>>> # Find which filters are in the simcado/data directory >>> >>> import simcado.optics as sim_op >>> print(sim_op.get_filter_set()) ['xH1', 'xY2', 'Spec_IJ', 'K-cont', 'I', 'xI2', 'Ks2', 'xY1', 'R', 'Y', 'Br-gamma', 'J-long', 'Pa-beta', 'H', 'I-long', 'H2_1-0S1', 'H-short', 'H-long', 'He-I', 'K-short', 'xJ2', 'J', 'xJ1', 'V', 'FeII', 'xI1', 'xK2', 'K-long', 'K-mid', 'J-short', 'H-cont', 'xK1', 'B', 'U', 'Ks', 'xH2', 'Spec_HK'] >>> >>> lam, spec = scale_spectrum(lam, spec, magnitudes, "Pa-beta")