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.WDmodelinstance) – 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
pbsuch that the source with spectrumspecwill have apparent magnitudemodel_magthroughpb. 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().
-
WDmodel.passband.get_model_synmags(model_spec, pbs, mu=0.0)[source]¶ Computes the synthetic magnitudes of spectrum
model_specthrough the passbandspbs, and optionally applies a common offset,muWrapper 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_specwere 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
-
WDmodel.passband.get_pbmodel(pbnames, model, pbfile=None, mag_type=None, mag_zero=0.0)[source]¶ Converts passband names
pbnamesinto passband models based on the mapping of name topysynphotobsmodestrings 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 anobsmodefor 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.WDmodelinstance) – 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
pbnamesandpysynphotobsmodestring, as well as the standard that has 0 magnitude in the system (either ‘’Vega’’ or ‘’AB’‘). Theobsmodemay also be the fullpath to a file that is readable bypysynphotmag_type (str, optional) – One of ‘’vegamag’’ or ‘’abmag’’ Used to specify the standard that has mag_zero magnitude in the passband. If
magsysis specified inpbfile,that overrides this option. Must be the same for all passbands listed inpbnamethat do not havemagsysspecified inpbfileIfpbnamesrequire multiplemag_type, concatentate the output.mag_zero (float, optional) – Magnitude of the standard in the passband If
magzerois specified inpbfile,that overrides this option. Must be the same for all passbands listed inpbnamethat do not havemagzerospecified inpbfileIfpbnamesrequire multiplemag_zero, concatentate the output.
- Returns
out – Output passband model dictionary. Has passband name
pbfrompbnamesas key.- Return type
- Raises
RuntimeError – If a bandpass cannot be loaded
Notes
- Each item of
outis 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
pbfilemust be readable byWDmodel.io.read_pbmap()and must return anumpy.recarraywith``dtype=[(‘pb’, ‘str’),(‘obsmode’, ‘str’)]``If there is no entry in
pbfilefor a passband, then we attempt to use the passband namepbasobsmodestring as is.Trims the bandpass to entries with non-zero transmission and determines the
VEGAMAG/ABMAGzeropoint for the passband - i.e.zpthat givesmag_Vega/AB=mag_zeroin all passbands.
-
WDmodel.passband.interp_passband(wave, pb, model)[source]¶ Find the indices of the wavelength array
wave, that overlap with the passbandpband 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.WDmodelinstance) – The DA White Dwarf SED model generator
- Returns
transmission (array-like) – The transmission of the passband interpolated on to overlapping elements of
waveind (array-like) – Indices of wavelength
wavethat overlap with the passbandpb. Produced byWDmodel.WDmodel.WDmodel._get_indices_in_range()Satisfiestransmission.shape == wave[ind].shape
Notes
The passband
pbis interpolated on to the wavelength arrraywave.waveis typically the wavelengths of a spectrum, and have much better sampling than passband transmission curves. Only the wavelengthswavethat overlap the passband are taken, and the passband transmission is then linearly interpolated on to these wavelengths. This prescription has been checked againstpysynphotto return synthetic magnitudes that agree to be< 1E-6, whileWDmodel.passband.synphot()is very significantly faster thanpysynphot.observation.Observation.effstim().
-
WDmodel.passband.synflux(spec, ind, pb)[source]¶ Compute the synthetic flux of spectrum
specthrough passbandpb- Parameters
spec (
numpy.recarray) – The spectrum. Must havedtype=[('wave', '<f8'), ('flux', '<f8')]ind (array-like) – Indices of spectrum
specthat 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
-
WDmodel.passband.synphot(spec, ind, pb, zp=0.0)[source]¶ Compute the synthetic magnitude of spectrum
specthrough passbandpb- Parameters
spec (
numpy.recarray) – The spectrum. Must havedtype=[('wave', '<f8'), ('flux', '<f8')]ind (array-like) – Indices of spectrum
specthat overlap with the passbandpb. Can be produced byWDmodel.passband.interp_passband()pb (array-like) – The passband transmission. Must satisfy
pb.shape == spec[ind].flux.shapezp (float, optional) – The zeropoint to apply to the synthetic flux
- Returns
mag – The synthetic magnitude of the spectrum through the passband
- Return type