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 known model_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 have dtype=[('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 have dtype=[('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. Has dtype=[('wave', '<f8'), ('throughput', '<f8')]

  • outzp (float) – The synthetic zeropoint of the passband pb such that the source with spectrum spec will have apparent magnitude model_mag through pb. With the synthetic zeropoint computed, the synthetic magnitude of any source can be converted into an apparent magnitude and can be passed to WDmodel.passband.synphot().

WDmodel.passband.get_model_synmags(model_spec, pbs, mu=0.0)[source]

Computes the synthetic magnitudes of spectrum model_spec through the passbands pbs, and optionally applies a common offset, mu

Wrapper around WDmodel.passband.synphot().

Parameters
  • spec (numpy.recarray) – The spectrum. Must have dtype=[('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

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 to pysynphot obsmode strings in pbfile.

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 an obsmode for pysynphot. If the entry cannot be treated as an obsmode, 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 and pysynphot obsmode string, as well as the standard that has 0 magnitude in the system (either ‘’Vega’’ or ‘’AB’‘). The obsmode may also be the fullpath to a file that is readable by pysynphot

  • 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 in pbfile, that overrides this option. Must be the same for all passbands listed in pbname that do not have magsys specified in pbfile If pbnames require multiple mag_type, concatentate the output.

  • mag_zero (float, optional) – Magnitude of the standard in the passband If magzero is specified in pbfile, that overrides this option. Must be the same for all passbands listed in pbname that do not have magzero specified in pbfile If pbnames require multiple mag_zero, concatentate the output.

Returns

out – Output passband model dictionary. Has passband name pb from pbnames as key.

Return type

dict

Raises

RuntimeError – If a bandpass cannot be loaded

Notes

Each item of out is a tuple with
  • pb : (numpy.recarray) The passband transmission with zero throughput entries trimmed. Has dtype=[('wave', '<f8'), ('throughput', '<f8')]

  • transmission : (array-like) The non-zero passband transmission interpolated onto overlapping model wavelengths

  • ind : (array-like) Indices of model wavelength that overlap with this passband

  • zp : (float) mag_type zeropoint of this passband

  • avgwave : (float) Passband average/reference wavelength

pbfile must be readable by WDmodel.io.read_pbmap() and must return a numpy.recarray with``dtype=[(‘pb’, ‘str’),(‘obsmode’, ‘str’)]``

If there is no entry in pbfile for a passband, then we attempt to use the passband name pb as obsmode 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 gives mag_Vega/AB=mag_zero in all passbands.

WDmodel.passband.interp_passband(wave, pb, model)[source]

Find the indices of the wavelength array wave, that overlap with the passband pb and interpolates the passband onto the wavelengths.

Parameters
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 passband pb. Produced by WDmodel.WDmodel.WDmodel._get_indices_in_range() Satisfies transmission.shape == wave[ind].shape

Notes

The passband pb is interpolated on to the wavelength arrray wave. wave is typically the wavelengths of a spectrum, and have much better sampling than passband transmission curves. Only the wavelengths wave that overlap the passband are taken, and the passband transmission is then linearly interpolated on to these wavelengths. This prescription has been checked against pysynphot to return synthetic magnitudes that agree to be < 1E-6, while WDmodel.passband.synphot() is very significantly faster than pysynphot.observation.Observation.effstim().

WDmodel.passband.synflux(spec, ind, pb)[source]

Compute the synthetic flux of spectrum spec through passband pb

Parameters
  • spec (numpy.recarray) – The spectrum. Must have dtype=[('wave', '<f8'), ('flux', '<f8')]

  • ind (array-like) – Indices of spectrum spec that overlap with the passband pb. Can be produced by WDmodel.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

float

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.

WDmodel.passband.synphot(spec, ind, pb, zp=0.0)[source]

Compute the synthetic magnitude of spectrum spec through passband pb

Parameters
  • spec (numpy.recarray) – The spectrum. Must have dtype=[('wave', '<f8'), ('flux', '<f8')]

  • ind (array-like) – Indices of spectrum spec that overlap with the passband pb. Can be produced by WDmodel.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

float