BandpassDict¶
- class rubin_sim.phot_utils.BandpassDict(bandpass_list, bandpass_name_list)¶
Bases:
object
This class will wrap an OrderedDict of Bandpass instantiations.
Upon instantiation, this class’s constructor will resample the input Bandpasses to be on the same wavelength grid (defined by the first input Bandpass). The constructor will then calculate the 2-D phi_array for quick calculation of magnitudes in all Bandpasses simultaneously (see the member methods mag_list_for_sed, mag_list_for_sed_list, flux_list_for_sed, flux_list_for_sed_list).
Note: when re-sampling the wavelength grid, it is assumed that the first bandpass is sampled on a uniform grid (i.e. all bandpasses are resampled to a grid with wavlen_min, wavelen_max determined by the bounds of the first bandpasses grid and with wavelen_step defined to be the difference between the 0th and 1st element of the first bandpass’ wavelength grid).
The class methods load_bandpasses_from_files and load_total_bandpasses_from_files can be used to easily read throughput files in from disk and conver them into BandpassDict objects.
Attributes Summary
A 2-D numpy array storing the values of phi (see eqn 2.3 of the science book) for all of the bandpasses in this dict.
The wavelength grid (in nm) on which all of the bandpass throughputs have been sampled.
The step size of the wavelength grid for all of the bandpasses stored in this dict.
Methods Summary
flux_array_for_sed_list
(sed_list[, indices])Return a dtyped numpy array of fluxes from a SedList.
flux_dict_for_sed
(sedobj[, indices])Return an OrderedDict of fluxes for a single Sed object.
flux_list_for_sed
(sedobj[, indices])Return a list of Fluxes for a single Sed object.
flux_list_for_sed_list
(sed_list[, indices])Return a 2-D array of fluxes from a SedList.
keys
()Returns a list of the BandpassDict's keys.
load_bandpasses_from_files
([bandpass_names, ...])Load bandpass information from files into BandpassDicts.
This will take the list of band passes named by bandpass_names and load them into a BandpassDict
mag_array_for_sed_list
(sed_list[, indices])Return a dtyped numpy array of magnitudes from a SedList.
mag_dict_for_sed
(sedobj[, indices])Return an OrderedDict of magnitudes for a single Sed object.
mag_list_for_sed
(sedobj[, indices])Return a list of magnitudes for a single Sed object.
mag_list_for_sed_list
(sed_list[, indices])Return a 2-D array of magnitudes from a SedList.
values
()Returns a list of the BandpassDict's values.
Attributes Documentation
- phi_array¶
A 2-D numpy array storing the values of phi (see eqn 2.3 of the science book) for all of the bandpasses in this dict.
- wavelen_match¶
The wavelength grid (in nm) on which all of the bandpass throughputs have been sampled.
- wavelen_step¶
The step size of the wavelength grid for all of the bandpasses stored in this dict.
Methods Documentation
- flux_array_for_sed_list(sed_list, indices=None)¶
Return a dtyped numpy array of fluxes from a SedList. The array will be keyed to the keys of this BandpassDict, i.e. in the case of
flux = myBandpassDict.fluxArrayForSedList(mySedList)
flux[‘u’][0] will be the flux of the 0th Sed in the ‘u’ bandpass flux[‘u’][1] will be the flux of the 1st Sed in the ‘u’ bandpass flux[‘z’] will be a numpy array of every Sed’s flux in the ‘z’ bandpass etc.
For maximum efficiency, use the wavelen_match keyword when loading SEDs into your SedList and make sure that wavelen_match = myBandpassDict.wavelen_match. That way, this method will not have to waste time resampling the Seds onto the wavelength grid of the BandpassDict.
@param [in] sed_list is a SedList containing the Seds whose fluxes are desired.
@param [in] indices is an optional list of indices indicating which bandpasses to actually calculate fluxes for. Other fluxes will be listed as numpy.NaN (i.e. this method will return as many fluxes as were loaded with the loadBandpassesFromFiles methods; it will just return numpy.NaN for fluxes you did not actually ask for)
@param [out] output_list is a 2-D numpy array containing the fluxes of each Sed (the rows) in each bandpass contained in this BandpassDict (the columns)
Note on units: Fluxes calculated this way will be the flux density integrated over the weighted response curve of the bandpass. See equaiton 2.1 of the LSST Science Book
- flux_dict_for_sed(sedobj, indices=None)¶
Return an OrderedDict of fluxes for a single Sed object.
The OrderedDict will be keyed off of the keys for this BandpassDict
@param [in] sedobj is an Sed object. Its wavelength grid can be arbitrary. If necessary, a copy will be created and resampled onto the wavelength grid of the Bandpasses before fluxes are calculated. The original Sed will be unchanged.
@param [in] indices is an optional list of indices indicating which bandpasses to actually calculate fluxes for. Other fluxes will be listed as numpy.NaN (i.e. this method will return as many fluxes as were loaded with the loadBandpassesFromFiles methods; it will just return numpy.NaN for fluxes you did not actually ask for)
@param [out] flux_list is a list of fluxes in the bandpasses stored in this BandpassDict
Note on units: Fluxes calculated this way will be the flux density integrated over the weighted response curve of the bandpass. See equaiton 2.1 of the LSST Science Book
- flux_list_for_sed(sedobj, indices=None)¶
Return a list of Fluxes for a single Sed object.
@param [in] sedobj is an Sed object. Its wavelength grid can be arbitrary. If necessary, a copy will be created and resampled onto the wavelength grid of the Bandpasses before fluxes are calculated. The original Sed will be unchanged.
@param [in] indices is an optional list of indices indicating which bandpasses to actually calculate fluxes for. Other fluxes will be listed as numpy.NaN (i.e. this method will return as many fluxes as were loaded with the loadBandpassesFromFiles methods; it will just return numpy.NaN for fluxes you did not actually ask for)
@param [out] fluxList is a list of fluxes in the bandpasses stored in this BandpassDict
Note on units: Fluxes calculated this way will be the flux density integrated over the weighted response curve of the bandpass. See equaiton 2.1 of the LSST Science Book
- flux_list_for_sed_list(sed_list, indices=None)¶
Return a 2-D array of fluxes from a SedList. Each row will correspond to a different Sed, each column will correspond to a different bandpass, i.e. in the case of
flux = myBandpassDict.fluxListForSedList(mySedList)
flux[0][0] will be the flux of the 0th Sed in the 0th bandpass flux[0][1] will be the flux of the 0th Sed in the 1st bandpass flux[1][1] will be the flux of the 1st Sed in the 1st bandpass etc.
For maximum efficiency, use the wavelen_match keyword when loading SEDs into your SedList and make sure that wavelen_match = myBandpassDict.wavelen_match. That way, this method will not have to waste time resampling the Seds onto the wavelength grid of the BandpassDict.
@param [in] sed_list is a SedList containing the Seds whose fluxes are desired.
@param [in] indices is an optional list of indices indicating which bandpasses to actually calculate fluxes for. Other fluxes will be listed as numpy.NaN (i.e. this method will return as many fluxes as were loaded with the loadBandpassesFromFiles methods; it will just return numpy.NaN for fluxes you did not actually ask for)
@param [out] output_list is a 2-D numpy array containing the fluxes of each Sed (the rows) in each bandpass contained in this BandpassDict (the columns)
Note on units: Fluxes calculated this way will be the flux density integrated over the weighted response curve of the bandpass. See equaiton 2.1 of the LSST Science Book
- keys()¶
Returns a list of the BandpassDict’s keys.
- classmethod load_bandpasses_from_files(bandpass_names=['u', 'g', 'r', 'i', 'z', 'y'], filedir='/home/runner/work/rubin_sim/rubin_sim/throughputs/baseline', bandpass_root='filter_', component_list=['detector.dat', 'm1.dat', 'm2.dat', 'm3.dat', 'lens1.dat', 'lens2.dat', 'lens3.dat'], atmo_transmission='/home/runner/work/rubin_sim/rubin_sim/throughputs/baseline/atmos_std.dat')¶
Load bandpass information from files into BandpassDicts. This method will separate the bandpasses into contributions due to instrumentations and contributions due to the atmosphere.
@param [in] bandpass_names is a list of strings labeling the bandpasses (e.g. [‘u’, ‘g’, ‘r’, ‘i’, ‘z’, ‘y’])
@param [in] filedir is a string indicating the name of the directory containing the bandpass files
@param [in] bandpass_root is the root of the names of the files associated with the bandpasses. This method assumes that bandpasses are stored in filedir/bandpassRoot_bandpass_names[i].dat
@param [in] component_list lists the files associated with bandpasses representing hardware components shared by all filters (defaults to [‘detector.dat’, ‘m1.dat’, ‘m2.dat’, ‘m3.dat’, ‘lens1.dat’, ‘lens2.dat’, ‘lens3.dat’] for LSST). These files are also expected to be stored in filedir
@param [in] atmo_transmission is the absolute path to the file representing the transmissivity of the atmosphere (defaults to baseline/atmos_std.dat in the LSST ‘throughputs’ package).
@param [out] bandpass_dict is a BandpassDict containing the total throughput (instrumentation + atmosphere)
@param [out] hardware_bandpass_dict is a BandpassDict containing the throughput due to instrumentation only
- classmethod load_total_bandpasses_from_files(bandpass_names=['u', 'g', 'r', 'i', 'z', 'y'], bandpass_dir='/home/runner/work/rubin_sim/rubin_sim/throughputs/baseline', bandpass_root='total_')¶
This will take the list of band passes named by bandpass_names and load them into a BandpassDict
The bandpasses loaded this way are total bandpasses: they account for instrumental and atmospheric transmission.
@param [in] bandpass_names is a list of names identifying each filter. Defaults to [‘u’, ‘g’, ‘r’, ‘i’, ‘z’, ‘y’]
@param [in] bandpass_dir is the name of the directory where the bandpass files are stored
@param [in] bandpass_root contains the first part of the bandpass file name, i.e., it is assumed that the bandpasses are stored in files of the type
bandpass_dir/bandpassRoot_bandpass_names[i].dat
if we want to load bandpasses for a telescope other than LSST, we would do so by altering bandpass_dir and bandpass_root
@param [out] bandpassDict is a BandpassDict containing the loaded throughputs
- mag_array_for_sed_list(sed_list, indices=None)¶
Return a dtyped numpy array of magnitudes from a SedList. The array will be keyed to the keys of this BandpassDict, i.e. in the case of
mag = myBandpassDict.magArrayForSedList(mySedList)
mag[‘u’][0] will be the magnitude of the 0th Sed in the ‘u’ bandpass mag[‘u’][1] will be the magnitude of the 1st Sed in the ‘u’ bandpass mag[‘z’] will be a numpy array of every Sed’s magnitude in the ‘z’ bandpass etc.
For maximum efficiency, use the wavelen_match keyword when loading SEDs into your SedList and make sure that wavelen_match = myBandpassDict.wavelen_match. That way, this method will not have to waste time resampling the Seds onto the wavelength grid of the BandpassDict.
@param [in] sed_list is a SedList containing the Seds whose magnitudes are desired.
@param [in] indices is an optional list of indices indicating which bandpasses to actually calculate magnitudes for. Other magnitudes will be listed as numpy.NaN (i.e. this method will return as many magnitudes as were loaded with the loadBandpassesFromFiles methods; it will just return numpy.NaN for magnitudes you did not actually ask for)
@param [out] output_array is a dtyped numpy array of magnitudes (see above).
- mag_dict_for_sed(sedobj, indices=None)¶
Return an OrderedDict of magnitudes for a single Sed object.
The OrderedDict will be keyed off of the keys to this BandpassDict
@param [in] sedobj is an Sed object. Its wavelength grid can be arbitrary. If necessary, a copy will be created and resampled onto the wavelength grid of the Bandpasses before magnitudes are calculated. The original Sed will be unchanged.
@param [in] indices is an optional list of indices indicating which bandpasses to actually calculate magnitudes for. Other magnitudes will be listed as numpy.NaN (i.e. this method will return as many magnitudes as were loaded with the loadBandpassesFromFiles methods; it will just return numpy.NaN for magnitudes you did not actually ask for)
@param [out] magDict is an OrderedDict of magnitudes in the bandpasses stored in this BandpassDict
- mag_list_for_sed(sedobj, indices=None)¶
Return a list of magnitudes for a single Sed object.
@param [in] sedobj is an Sed object. Its wavelength grid can be arbitrary. If necessary, a copy will be created and resampled onto the wavelength grid of the Bandpasses before magnitudes are calculated. The original Sed will be unchanged.
@param [in] indices is an optional list of indices indicating which bandpasses to actually calculate magnitudes for. Other magnitudes will be listed as numpy.NaN (i.e. this method will return as many magnitudes as were loaded with the loadBandpassesFromFiles methods; it will just return numpy.NaN for magnitudes you did not actually ask for)
@param [out] magList is a list of magnitudes in the bandpasses stored in this BandpassDict
- mag_list_for_sed_list(sed_list, indices=None)¶
Return a 2-D array of magnitudes from a SedList. Each row will correspond to a different Sed, each column will correspond to a different bandpass, i.e. in the case of
mag = myBandpassDict.magListForSedList(mySedList)
mag[0][0] will be the magnitude of the 0th Sed in the 0th bandpass mag[0][1] will be the magnitude of the 0th Sed in the 1st bandpass mag[1][1] will be the magnitude of the 1st Sed in the 1st bandpass etc.
For maximum efficiency, use the wavelen_match keyword when loading SEDs into your SedList and make sure that wavelen_match = myBandpassDict.wavelen_match. That way, this method will not have to waste time resampling the Seds onto the wavelength grid of the BandpassDict.
@param [in] sed_list is a SedList containing the Seds whose magnitudes are desired.
@param [in] indices is an optional list of indices indicating which bandpasses to actually calculate magnitudes for. Other magnitudes will be listed as numpy.NaN (i.e. this method will return as many magnitudes as were loaded with the loadBandpassesFromFiles methods; it will just return numpy.NaN for magnitudes you did not actually ask for)
@param [out] output_list is a 2-D numpy array containing the magnitudes of each Sed (the rows) in each bandpass contained in this BandpassDict (the columns)
- values()¶
Returns a list of the BandpassDict’s values.