The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Protected Member Functions | Private Types | Friends | List of all members
WavelengthGrid Class Referenceabstract

#include <WavelengthGrid.hpp>

Inheritance diagram for WavelengthGrid:
Inheritance graph
[legend]

Public Member Functions

virtual int bin (double lambda) const =0
 
virtual vector< int > bins (double lambda) const =0
 
virtual double effectiveWidth (int ell) const =0
 
virtual double leftBorder (int ell) const =0
 
virtual int numBins () const =0
 
virtual double rightBorder (int ell) const =0
 
virtual double transmission (int ell, double lambda) const =0
 
virtual double wavelength (int ell) const =0
 
Range wavelengthRange () const
 
- Public Member Functions inherited from SimulationItem
template<class T >
T * find (bool setup=true) const
 
template<class T >
T * interface (int levels=-999999, bool setup=true) const
 
virtual string itemName () const
 
void setup ()
 
string typeAndName () const
 
- Public Member Functions inherited from Item
 Item (const Item &)=delete
 
virtual ~Item ()
 
void addChild (Item *child)
 
const vector< Item * > & children () const
 
virtual void clearItemListProperty (const PropertyDef *property)
 
void destroyChild (Item *child)
 
virtual bool getBoolProperty (const PropertyDef *property) const
 
virtual vector< double > getDoubleListProperty (const PropertyDef *property) const
 
virtual double getDoubleProperty (const PropertyDef *property) const
 
virtual string getEnumProperty (const PropertyDef *property) const
 
virtual int getIntProperty (const PropertyDef *property) const
 
virtual vector< Item * > getItemListProperty (const PropertyDef *property) const
 
virtual ItemgetItemProperty (const PropertyDef *property) const
 
virtual string getStringProperty (const PropertyDef *property) const
 
int getUtilityProperty (string name) const
 
virtual void insertIntoItemListProperty (const PropertyDef *property, int index, Item *item)
 
Itemoperator= (const Item &)=delete
 
Itemparent () const
 
virtual void removeFromItemListProperty (const PropertyDef *property, int index)
 
virtual void setBoolProperty (const PropertyDef *property, bool value)
 
virtual void setDoubleListProperty (const PropertyDef *property, vector< double > value)
 
virtual void setDoubleProperty (const PropertyDef *property, double value)
 
virtual void setEnumProperty (const PropertyDef *property, string value)
 
virtual void setIntProperty (const PropertyDef *property, int value)
 
virtual void setItemProperty (const PropertyDef *property, Item *item)
 
virtual void setStringProperty (const PropertyDef *property, string value)
 
void setUtilityProperty (string name, int value)
 
virtual string type () const
 

Protected Member Functions

 WavelengthGrid ()
 
- Protected Member Functions inherited from SimulationItem
 SimulationItem ()
 
virtual bool offersInterface (const std::type_info &interfaceTypeInfo) const
 
virtual void setupSelfAfter ()
 
virtual void setupSelfBefore ()
 
- Protected Member Functions inherited from Item
 Item ()
 

Private Types

using BaseType = SimulationItem
 
using ItemType = WavelengthGrid
 

Friends

class ItemRegistry
 

Detailed Description

WavelengthGrid is an abstract class that defines the interface for wavelength grids that can be used, for example, to specify the wavelength bins used for detetecting photon packets in instruments.

A wavelength grid consists of \(N>0\) possibly overlapping wavelength bins. Generally speaking, each of these bins is defined through a transmission curve determining the contribution fraction of a detected photon packet to the bin as a function of wavelength. This class defines the public interface for a wavelength grid in these general terms. Subclasses can implement several bin types, including bins that mimic a particular broadband, or straightforward bins with constant transmission across some wavelength interval.

Key properties of a wavelength bin include its left and right borders, defining a wavelength interval within which the transmission may be nonzero, and its characteristic wavelength, which will be used by instruments to convert mean specific luminosities in the band between wavelength and frequency representations. The WavelengthGrid class requires that the characteristic wavelength of a bin falls inside the bin, i.e. \(\lambda^\mathrm{left}_\ell \le \lambda^\mathrm{c}_\ell \le \lambda^\mathrm{right}_\ell, \ell=0\dots N-1\), and that no two bins have the same characteristic wavelength. This allows the WavelengthGrid class to meaningfully sort bins in increasing order of characteristic wavelength, and assign bin indices accordingly.

The public interface also includes functions to obtain the relative transmission for a given bin as a function of wavelength, defined as the transmission at that wavelength divided by the maximum transmission, and to obtain a bin's effective width, 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.

Finally, and most importantly, the public interface offers a function to determine the (indices of) the bin(s) that may have a nonzero transmission at a given wavelength.

Constructor & Destructor Documentation

◆ WavelengthGrid()

WavelengthGrid::WavelengthGrid ( )
inlineprotected

Default constructor for abstract Item subclass WavelengthGrid : "a wavelength grid" .

Member Function Documentation

◆ bin()

virtual int WavelengthGrid::bin ( double  lambda) const
pure virtual

This function returns the index \(\ell\) of one the wavelength bins that may have a nonzero transmission at the specified wavelength \(\lambda\), i.e. for which \(\lambda^\mathrm{left}_\ell \le \lambda \le \lambda^\mathrm{right}_\ell\). If no wavelengths bins match this condition, the function returns -1. If multiple bins match this condition, the function returns the index for the bin with the shortest characteristic wavelength.

Implemented in BandWavelengthGrid, and DisjointWavelengthGrid.

◆ bins()

virtual vector< int > WavelengthGrid::bins ( double  lambda) const
pure virtual

This function returns a list of indices \(\ell_k\) of the wavelength bins that may have a nonzero transmission at the specified wavelength \(\lambda\), i.e. for which \(\lambda^\mathrm{left}_\ell \le \lambda \le \lambda^\mathrm{right}_\ell\). If no wavelengths bins match this condition, the function returns an empty list.

Implemented in BandWavelengthGrid, and DisjointWavelengthGrid.

◆ effectiveWidth()

virtual double WavelengthGrid::effectiveWidth ( int  ell) const
pure virtual

This function returns the effective width of the wavelength bin corresponding to the index \(\ell\). The effective width 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. For bins with a constant transmission over the complete interval, the effective width is simply \(\lambda^\mathrm{right}_\ell - \lambda^\mathrm{left}_\ell\). For bins with non-constant transmission, this is no longer true.

Implemented in BandWavelengthGrid, and DisjointWavelengthGrid.

◆ leftBorder()

virtual double WavelengthGrid::leftBorder ( int  ell) const
pure virtual

This function returns the left border of the wavelength bin corresponding to the index \(\ell\), i.e. \(\lambda^\mathrm{left}_\ell\). The transmission for this bin is guaranteed to be zero for all wavelengths shorter than the left border.

Implemented in BandWavelengthGrid, and DisjointWavelengthGrid.

◆ numBins()

virtual int WavelengthGrid::numBins ( ) const
pure virtual

This function returns the number of bins \(N\) in the grid, or equivalently, the number of characteristic wavelengths. Bins are always sorted in order of increasing characteristic wavelength.

Implemented in BandWavelengthGrid, and DisjointWavelengthGrid.

◆ rightBorder()

virtual double WavelengthGrid::rightBorder ( int  ell) const
pure virtual

This function returns the right border of the wavelength bin corresponding to the index \(\ell\), i.e. \(\lambda^\mathrm{right}_\ell\). The transmission for this bin is guaranteed to be zero for all wavelengths longer than the right border.

Implemented in BandWavelengthGrid, and DisjointWavelengthGrid.

◆ transmission()

virtual double WavelengthGrid::transmission ( int  ell,
double  lambda 
) const
pure virtual

This function returns the relative transmission for the wavelength bin corresponding to the index \(\ell\) at the wavelength \(\lambda\). The relative transmission is defined as the transmission at that wavelength divided by the maximum transmission for the bin.

Implemented in BandWavelengthGrid, and DisjointWavelengthGrid.

◆ wavelength()

virtual double WavelengthGrid::wavelength ( int  ell) const
pure virtual

This function returns the characteristic wavelength \(\lambda^\mathrm{c}_\ell\) corresponding to the index \(\ell\). The characteristic wavelength of a bin is always inside the bin, i.e. \(\lambda^\mathrm{left}_\ell \le \lambda^\mathrm{c}_\ell \le \lambda^\mathrm{right}_\ell\). It can be used to convert mean specific luminosities in the band between wavelength and frequency representations. Bins are always sorted in order of increasing characteristic wavelength.

Implemented in BandWavelengthGrid, and DisjointWavelengthGrid.

◆ wavelengthRange()

Range WavelengthGrid::wavelengthRange ( ) const

This function returns the wavelength range covered by the wavelength grid, which is defined as the range from the left border of the leftmost bin to the right border of the rightmost bin. This range includes all wavelengths possibly covered by the wavelength grid except in the rare case of overlapping bins where an inner bin is so wide that it outer limit extends beyond the outer bin.


The documentation for this class was generated from the following file: