An instance of the BroadBand class represents a broadband filter with a given transmission curve. More...
Public Member Functions | |
def | __init__ (self, bandspec) |
As mentioned in the class header, built-in Broadband instances can be obtained using one of the class functions builtinBands() or builtinBand() as opposed to directly invoking the constructor. More... | |
def | builtinBand (cls, nameSegments) |
This function returns the single BroadBand instance that matches the specified criteria. More... | |
def | builtinBands (cls, nameSegments="", minWavelength=0<< u.m, maxWavelength=1e99<< u.m) |
This function returns a list of BroadBand instances that match the specified criteria. More... | |
def | convolve (self, wavelengths, fluxes, *numWavelengths=None, flavor=None) |
This function calculates and returns the band-averaged value | |
def | effectiveWidth (self) |
This function returns the effective band width (a wavelength interval) as defined in the class header as an astropy quantity. More... | |
def | maxWavelength (self) |
This function returns the maximum wavelength for the band, as an astropy quantity. More... | |
def | minWavelength (self) |
This function returns the minimum wavelength for the band, as an astropy quantity. More... | |
def | name (self) |
This function returns the built-in band's name, or "Uniform" or "Custom" for uniform or custom bands respectively. More... | |
def | pivotWavelength (self) |
This function returns the pivot wavelength as defined in the class header, as an astropy quantity. More... | |
def | transmissionCurve (self) |
This function returns a tuple containing a copy of the wavelength and transmission arrays representing the transmission curve for this band, normalized to unity. More... | |
def | wavelengthRange (self) |
This function returns a tuple of astropy quantities specifying the wavelength range for this band. More... | |
Private Member Functions | |
def | _addBuiltinBands (cls, directory) |
This private function recursively searches the contents of the specified directory and adds files with a name ending in "_BroadBand.stab" to the list of built-in bands. More... | |
def | _ensureBuiltinBands (cls) |
This private function adds any band definitions detected in the SKIRT or PTS resources directories to the list of built-in bands. More... | |
def | _normalize (self) |
This private function normalizes the transmission curve for uniform and custom bands, and attaches the appropriate astropy units (micron and 1/micron, respectively). More... | |
Private Attributes | |
_added | |
_bandname | |
_transmissions | |
_wavelengths | |
Static Private Attributes | |
bool | _added |
Flag becomes True as soon as bandpaths have been added for the SKIRT and PTS resource directories. More... | |
_bandpaths | |
The file paths for all detected built-in band definitions (i.e. More... | |
An instance of the BroadBand class represents a broadband filter with a given transmission curve.
BroadBand instances are usually obtained by loading built-in band definitions using one of the class functions builtinBands() or builtinBand() as opposed to directly invoking the constructor. However, for specific use cases, a BroadBand instance can also be constructed directly, for example to obtain a uniform filter with constant transmission over a specified wavelength range. For more information, refer to the documentation of the constructor.
This class relies on SKIRT resource files to provide built-in broadband definitions. These resource files are written in the SKIRT stored table format and have names that end with "_BroadBand.stab". The first part of the file name identifies the particular band being represented.
The class recursively searches for broadband resource files in the contents of two directories, if they exist: the ~/SKIRT/resources directory and the ~/PTS/resources directory. In other words, if SKIRT has been installed and all relevant resource packs have been installed, all broadbands available to SKIRT are available to this class as well. In case SKIRT is not installed on the same system (and in the same project directory), one can manually download the appropriate resource packs from the SKIRT web site, unzip the archives, and place the files in the ~/PTS/resources directory.
For a list of available broadbands, see the documentation of the SKIRT BroadBand class, or use the "pts list_bands" command.
This class offers operations such as determining the band's pivot wavelength and convolving an SED or a frame data cube with the band's transmission curve.
Refer to the appendix in Camps et al. 2016 (MNRAS 462, 1057-1075) for a brief introduction of the relevant concepts and a derivation of the corresponding formulas. For the purposes of this class, a band is defined through its arbitrarily scaled transmission curve
Given a spectral energy distribution
The pivot wavelength of the band is defined as the wavelength at which the mean specific luminosity can be properly converted between wavelength and frequency representations. It is given by
The effective width of the band is defined as the horizontal size of a rectangle with height equal to the maximum transmission and with the same area as the one covered by the band's transmission curve. It is given by
As set forth by Camps et al. 2016, for energy measuring devices (bolometers) the total system transmission
Also, to further simplify the above formulas, the constructor normalizes the transmission curve to unity, i.e.
def pts.band.broadband.BroadBand.__init__ | ( | self, | |
bandspec | |||
) |
As mentioned in the class header, built-in Broadband instances can be obtained using one of the class functions builtinBands() or builtinBand() as opposed to directly invoking the constructor.
For more information, refer to the doumentation of these functions.
The constructor supports the following use cases, depending on the type of the bandspec argument:
If bandspec has a different type, or if the string/path does not refer to a file in the proper format, the constructor raises an exception.
|
private |
This private function recursively searches the contents of the specified directory and adds files with a name ending in "_BroadBand.stab" to the list of built-in bands.
|
private |
This private function adds any band definitions detected in the SKIRT or PTS resources directories to the list of built-in bands.
It does so only the first time it is called.
|
private |
This private function normalizes the transmission curve for uniform and custom bands, and attaches the appropriate astropy units (micron and 1/micron, respectively).
def pts.band.broadband.BroadBand.builtinBand | ( | cls, | |
nameSegments | |||
) |
This function returns the single BroadBand instance that matches the specified criteria.
It raises an error if multiple bands or no band match the criteria.
def pts.band.broadband.BroadBand.builtinBands | ( | cls, | |
nameSegments = "" , |
|||
minWavelength = 0<<u.m , |
|||
maxWavelength = 1e99<<u.m |
|||
) |
This function returns a list of BroadBand instances that match the specified criteria.
The list is in arbitrary order and can be empty.
def pts.band.broadband.BroadBand.convolve | ( | self, | |
wavelengths, | |||
fluxes, | |||
* | numWavelengths = None , |
||
flavor = None |
|||
) |
This function calculates and returns the band-averaged value
For a band with transmission curve
The function in fact accepts a distribution (over a range of wavelengths) of various spectral quantities, including flux density, surface brightness, spectral radiance, or spectral luminosity of any "flavor" (neutral, per wavelength, or per frequency) and in arbitrary units. For the purposes of this function, these quantities are generically referred to as "flux". The incoming fluxes are converted to an equivalent "per-wavelength" flavor, the convolution is calculated according to the equation above, and the result is converted back to the flavor and units of the incoming fluxes, or to the optionally specified flavor and/or units.
The function accepts the following arguments:
def pts.band.broadband.BroadBand.effectiveWidth | ( | self | ) |
This function returns the effective band width (a wavelength interval) as defined in the class header as an astropy quantity.
def pts.band.broadband.BroadBand.maxWavelength | ( | self | ) |
This function returns the maximum wavelength for the band, as an astropy quantity.
def pts.band.broadband.BroadBand.minWavelength | ( | self | ) |
This function returns the minimum wavelength for the band, as an astropy quantity.
def pts.band.broadband.BroadBand.name | ( | self | ) |
This function returns the built-in band's name, or "Uniform" or "Custom" for uniform or custom bands respectively.
def pts.band.broadband.BroadBand.pivotWavelength | ( | self | ) |
This function returns the pivot wavelength as defined in the class header, as an astropy quantity.
def pts.band.broadband.BroadBand.transmissionCurve | ( | self | ) |
This function returns a tuple containing a copy of the wavelength and transmission arrays representing the transmission curve for this band, normalized to unity.
Both arrays are astropy quantities.
def pts.band.broadband.BroadBand.wavelengthRange | ( | self | ) |
This function returns a tuple of astropy quantities specifying the wavelength range for this band.
The transmission may be zero in some (usually small) intervals within the range, but it is guaranteed to be zero outside the range.
|
staticprivate |
Flag becomes True as soon as bandpaths have been added for the SKIRT and PTS resource directories.
|
staticprivate |
The file paths for all detected built-in band definitions (i.e.
ending with "_BroadBand.stab")