WDmodel.passband module¶
Instrumental throughput models and calibration and synthetic photometry routines
-
WDmodel.passband.
chop_syn_spec_pb
(spec, model_mag, pb, model)[source]¶ Trims the pysynphot bandpass pb to non-zero throughput, computes the zeropoint of the passband given the SED spec, and model magnitude of spec in the passband
Parameters: - spec (
numpy.recarray
) – The spectrum. Typically a standard which has a knownmodel_mag
. This can be a real source such as Vega, BD+174708, or one of the three CALSPEC standards, or an idealized synthetic source such as AB. Must havedtype=[('wave', '<f8'), ('flux', '<f8')]
- model_mag (float) – The apparent magnitude of the spectrum through the passband. The difference between the apparent magnitude and the synthetic magnitude is the synthetic zeropoint.
- pb (
numpy.recarray
) – The passband transmission. Must havedtype=[('wave', '<f8'), ('throughput', '<f8')]
- model (
WDmodel.WDmodel.WDmodel
instance) – The DA White Dwarf SED model generator
Returns: - outpb (
numpy.recarray
) – The passband transmission with zero throughput entries trimmed. Hasdtype=[('wave', '<f8'), ('throughput', '<f8')]
- outzp (float) – The synthetic zeropoint of the passband
pb
such that the source with spectrumspec
will have apparent magnitudemodel_mag
throughpb
. With the synthetic zeropoint computed, the synthetic magnitude of any source can be converted into an apparent magnitude and can be passed toWDmodel.passband.synphot()
.
- spec (
-
WDmodel.passband.
get_model_synmags
(model_spec, pbs, mu=0.0)[source]¶ Computes the synthetic magnitudes of spectrum
model_spec
through the passbandspbs
, and optionally applies a common offset,mu
Wrapper around
WDmodel.passband.synphot()
.Parameters: - spec (
numpy.recarray
) – The spectrum. Must havedtype=[('wave', '<f8'), ('flux', '<f8')]
- pbs (dict) – Passband dictionary containing the passbands corresponding to
phot.pb` and generated by
WDmodel.passband.get_pbmodel()
. - mu (float, optional) – Common achromatic photometric offset to apply to the synthetic
magnitudes in al the passbands. Would be equal to the distance modulus
if
model_spec
were normalized to return the true absolute magnitude of the source.
Returns: model_mags – The model magnitudes. Has
dtype=[('pb', 'str'), ('mag', '<f8')]
Return type: None or
numpy.recarray
- spec (
-
WDmodel.passband.
get_pbmodel
(pbnames, model, pbfile=None, mag_type=None, mag_zero=0.0)[source]¶ Converts passband names
pbnames
into passband models based on the mapping of name topysynphot
obsmode
strings inpbfile
.Parameters: - pbnames (array-like) – List of passband names to get throughput models for Each name is
resolved by first looking in
pbfile
(if provided) If an entry is found, that entry is treated as anobsmode
for pysynphot. If the entry cannot be treated as anobsmode,
we attempt to treat as an ASCII file. If neither is possible, an error is raised. - model (
WDmodel.WDmodel.WDmodel
instance) – The DA White Dwarf SED model generator All the passbands are interpolated onto the wavelengths of the SED model. - pbfile (str, optional) – Filename containing mapping between
pbnames
andpysynphot
obsmode
string, as well as the standard that has 0 magnitude in the system (either ‘’Vega’’ or ‘’AB’‘). Theobsmode
may also be the fullpath to a file that is readable bypysynphot
- mag_type (str, optional) – One of ‘’vegamag’’ or ‘’abmag’’
Used to specify the standard that has mag_zero magnitude in the passband.
If
magsys
is specified inpbfile,
that overrides this option. Must be the same for all passbands listed inpbname
that do not havemagsys
specified inpbfile
Ifpbnames
require multiplemag_type
, concatentate the output. - mag_zero (float, optional) – Magnitude of the standard in the passband
If
magzero
is specified inpbfile,
that overrides this option. Must be the same for all passbands listed inpbname
that do not havemagzero
specified inpbfile
Ifpbnames
require multiplemag_zero
, concatentate the output.
Returns: out – Output passband model dictionary. Has passband name
pb
frompbnames
as key.Return type: Raises: RuntimeError
– If a bandpass cannot be loadedNotes
- Each item of
out
is a tuple with pb
: (numpy.recarray
) The passband transmission with zero throughput entries trimmed. Hasdtype=[('wave', '<f8'), ('throughput', '<f8')]
transmission
: (array-like) The non-zero passband transmission interpolated onto overlapping model wavelengthsind
: (array-like) Indices of model wavelength that overlap with this passbandzp
: (float) mag_type zeropoint of this passbandavgwave
: (float) Passband average/reference wavelength
pbfile
must be readable byWDmodel.io.read_pbmap()
and must return anumpy.recarray
with``dtype=[(‘pb’, ‘str’),(‘obsmode’, ‘str’)]``If there is no entry in
pbfile
for a passband, then we attempt to use the passband namepb
asobsmode
string as is.Trims the bandpass to entries with non-zero transmission and determines the
VEGAMAG/ABMAG
zeropoint for the passband - i.e.zp
that givesmag_Vega/AB=mag_zero
in all passbands.- pbnames (array-like) – List of passband names to get throughput models for Each name is
resolved by first looking in
-
WDmodel.passband.
interp_passband
(wave, pb, model)[source]¶ Find the indices of the wavelength array
wave
, that overlap with the passbandpb
and interpolates the passband onto the wavelengths.Parameters: - wave (array-like) – The wavelength array. Must satisfy
WDmodel.WDmodel.WDmodel._wave_test()
- pb (
numpy.recarray
) – The passband transmission. Must havedtype=[('wave', '<f8'), ('throughput', '<f8')]
- model (
WDmodel.WDmodel.WDmodel
instance) – The DA White Dwarf SED model generator
Returns: - transmission (array-like) – The transmission of the passband interpolated on to overlapping
elements of
wave
- ind (array-like) – Indices of wavelength
wave
that overlap with the passbandpb
. Produced byWDmodel.WDmodel.WDmodel._get_indices_in_range()
Satisfiestransmission.shape == wave[ind].shape
Notes
The passband
pb
is interpolated on to the wavelength arrraywave
.wave
is typically the wavelengths of a spectrum, and have much better sampling than passband transmission curves. Only the wavelengthswave
that overlap the passband are taken, and the passband transmission is then linearly interpolated on to these wavelengths. This prescription has been checked againstpysynphot
to return synthetic magnitudes that agree to be< 1E-6
, whileWDmodel.passband.synphot()
is very significantly faster thanpysynphot.observation.Observation.effstim()
.- wave (array-like) – The wavelength array. Must satisfy
-
WDmodel.passband.
synflux
(spec, ind, pb)[source]¶ Compute the synthetic flux of spectrum
spec
through passbandpb
Parameters: - spec (
numpy.recarray
) – The spectrum. Must havedtype=[('wave', '<f8'), ('flux', '<f8')]
- ind (array-like) – Indices of spectrum
spec
that overlap with the passbandpb
. Can be produced byWDmodel.passband.interp_passband()
- pb (array-like) – The passband transmission.
Must satisfy
pb.shape == spec[ind].flux.shape
Returns: flux – The normalized flux of the spectrum through the passband
Return type: Notes
The passband is assumed to be dimensionless photon transmission efficiency.
Routine is intended to be a mch faster implementation of
pysynphot.observation.Observation.effstim()
, since it is called over and over by the samplers as a function of model parameters.Uses
numpy.trapz()
for interpolation.See also
- spec (
-
WDmodel.passband.
synphot
(spec, ind, pb, zp=0.0)[source]¶ Compute the synthetic magnitude of spectrum
spec
through passbandpb
Parameters: - spec (
numpy.recarray
) – The spectrum. Must havedtype=[('wave', '<f8'), ('flux', '<f8')]
- ind (array-like) – Indices of spectrum
spec
that overlap with the passbandpb
. Can be produced byWDmodel.passband.interp_passband()
- pb (array-like) – The passband transmission.
Must satisfy
pb.shape == spec[ind].flux.shape
- zp (float, optional) – The zeropoint to apply to the synthetic flux
Returns: mag – The synthetic magnitude of the spectrum through the passband
Return type: - spec (