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

#include <Instrument.hpp>

Inheritance diagram for Instrument:
Inheritance graph
[legend]

Public Member Functions

virtual Direction bfkobs (const Position &bfr) const =0
 
virtual Direction bfky (const Position &bfr) const =0
 
virtual void detect (PhotonPacket *pp)=0
 
virtual void determineSameObserverAsPreceding (const Instrument *precedingInstrument)=0
 
void flush ()
 
string instrumentName () const
 
const WavelengthGridinstrumentWavelengthGrid () const
 
bool isSameObserverAsPreceding () const
 
string itemName () const override
 
int numScatteringLevels () const
 
bool recordComponents () const
 
bool recordPolarization () const
 
bool recordStatistics () const
 
WavelengthGridwavelengthGrid () const
 
void write ()
 
- 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

 Instrument ()
 
 ~Instrument ()
 
FluxRecorderinstrumentFluxRecorder ()
 
void setSameObserverAsPreceding ()
 
void setupSelfAfter () override
 
void setupSelfBefore () override
 
- 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 = Instrument
 

Private Attributes

string _instrumentName
 
const WavelengthGrid_instrumentWavelengthGrid
 
bool _isSameObserverAsPreceding
 
int _numScatteringLevels
 
bool _recordComponents
 
FluxRecorder_recorder
 
bool _recordPolarization
 
bool _recordStatistics
 
WavelengthGrid_wavelengthGrid
 

Friends

class ItemRegistry
 

Detailed Description

Instrument is an abstract class representing instruments to collect the photon packets during a Monte Carlo simulation. Subclasses implement instruments that can vary in type of projection (e.g. parallel or perspective) and in what is recorded (e.g. SED or full integral field data cube). This top-level abstract class offers a generic interface for receiving photon packets from the simulation. It also includes facilities for configuring user properties that are common to all instruments, such as which flux contributions need to be recorded. A wavelength grid is established either by specifying a grid for this instrument specifically, or by defaulting to the common grid specified for the instrument system.

Properties of sub-types of this type are listed in user interfaces somewhere in between the properties of this type.

Constructor & Destructor Documentation

◆ Instrument()

Instrument::Instrument ( )
inlineprotected

Default constructor for abstract Item subclass Instrument : "an instrument" .

◆ ~Instrument()

Instrument::~Instrument ( )
protected

The destructor releases the FluxRecorder instance for this instrument.

Member Function Documentation

◆ bfkobs()

virtual Direction Instrument::bfkobs ( const Position bfr) const
pure virtual

This function returns the direction towards the observer, expressed in model coordinates, given the photon packet's launching position. The implementation must be provided in a subclass.

Implemented in AllSkyInstrument, DistantInstrument, HEALPixSkyInstrument, and PerspectiveInstrument.

◆ bfky()

virtual Direction Instrument::bfky ( const Position bfr) const
pure virtual

This function returns the direction along the positive y-axis of the instrument frame, expressed in model coordinates, given the photon packet's launching position. The implementation must be provided in a subclass.

Implemented in AllSkyInstrument, DistantInstrument, HEALPixSkyInstrument, and PerspectiveInstrument.

◆ detect()

virtual void Instrument::detect ( PhotonPacket pp)
pure virtual

This function simulates the detection of a photon packet by the instrument. Its implementation must be provided in a subclass.

Implemented in AllSkyInstrument, FrameInstrument, HEALPixSkyInstrument, PerspectiveInstrument, and SEDInstrument.

◆ determineSameObserverAsPreceding()

virtual void Instrument::determineSameObserverAsPreceding ( const Instrument precedingInstrument)
pure virtual

This function determines whether the specified instrument has the same observer type, position and viewing direction as the receiving instrument, and if so, calls the setSameObserverAsPreceding() function to remember the fact. The function is invoked by the InstrumentSystem during setup. The implementation must be provided in a subclass.

Implemented in AllSkyInstrument, DistantInstrument, HEALPixSkyInstrument, and PerspectiveInstrument.

◆ flush()

void Instrument::flush ( )

This function flushes any information buffered by the detect() function. It simply calls the corresponding function of the FluxRecorder instance associated with this instrument.

◆ instrumentFluxRecorder()

FluxRecorder * Instrument::instrumentFluxRecorder ( )
inlineprotected

This function returns the FluxRecorder instance associated with this instrument. This function is intended for use in subclasses only.

◆ instrumentName()

string Instrument::instrumentName ( ) const
inline

This function returns the value of the discoverable string property instrumentName : "the name for this instrument" .

◆ instrumentWavelengthGrid()

const WavelengthGrid * Instrument::instrumentWavelengthGrid ( ) const
inline

This function returns the wavelength grid for the instrument as determined during setup, i.e. either the grid specified for this instrument or the default grid specified for the instrument system. After setup has completed, the function never returns a nulltpr because setupSelfBefore() throws a fatal error if neither of these grids are specified.

◆ isSameObserverAsPreceding()

bool Instrument::isSameObserverAsPreceding ( ) const
inline

This function returns true if the receiving instrument has the same observer type, position and viewing direction as the preceding instrument in the instrument system. This information is determined and cached by the determineSameObserverAsPreceding() function, which is called by the InstrumentSystem during setup.

◆ itemName()

string Instrument::itemName ( ) const
overridevirtual

This function returns the instrument name as human-readable name for the simulation item, so that it can be used in log messages to identify the instrument and differentiate it from other instruments.

Reimplemented from SimulationItem.

◆ numScatteringLevels()

Instrument::numScatteringLevels ( ) const
inline

This function returns the value of the discoverable integer property numScatteringLevels : "the number of individually recorded scattering levels" .

The minimum value for this property is "0" .

The maximum value for this property is "99" .

The default value for this property is given by the conditional value expression "0" .

This property is relevant only if the Boolean expression "recordComponents" evaluates to true after replacing the names by true or false depending on their presence.

This property is displayed only if the Boolean expression "Level2" evaluates to true after replacing the names by true or false depending on their presence.

◆ recordComponents()

Instrument::recordComponents ( ) const
inline

This function returns the value of the discoverable Boolean property recordComponents : "record flux components separately" .

The default value for this property is given by the conditional value expression "false" .

◆ recordPolarization()

Instrument::recordPolarization ( ) const
inline

This function returns the value of the discoverable Boolean property recordPolarization : "record polarization (Stokes vector elements)" .

The default value for this property is given by the conditional value expression "false" .

This property is displayed only if the Boolean expression "Level2" evaluates to true after replacing the names by true or false depending on their presence.

◆ recordStatistics()

Instrument::recordStatistics ( ) const
inline

This function returns the value of the discoverable Boolean property recordStatistics : "record information for calculating statistical properties" .

The default value for this property is given by the conditional value expression "false" .

This property is displayed only if the Boolean expression "Level2" evaluates to true after replacing the names by true or false depending on their presence.

◆ setSameObserverAsPreceding()

void Instrument::setSameObserverAsPreceding ( )
inlineprotected

This function sets the "isSameObserverAsPreceding" flag to true. By default (i.e. if this function is never invoked) the flag is set to false. This function is intended for use from the determineSameObserverAsPreceding() function implementation in subclasses.

◆ setupSelfAfter()

void Instrument::setupSelfAfter ( )
overrideprotectedvirtual

This function finalizes the configuration of FluxRecorder instance for this instrument.

Reimplemented from SimulationItem.

◆ setupSelfBefore()

void Instrument::setupSelfBefore ( )
overrideprotectedvirtual

This function performs setup for the instrument. It establishes the wavelength grid for the instrument: if a grid is specified for the instrument, that grid is used. If not, the default wavelength grid specified for the instrument system is used instead. If neither of these grids are specified, the function throws a fatal error.

The function also creates and partially configures the FluxRecorder instance for this instrument, passing it the values of the user properties offered by this class and some extra information on the simulation. The setupSelfBefore() function of each subclass is expected to augment the configuration by calling the includeFluxDensity() and/or includeSurfaceBrightness() functions.

Reimplemented from SimulationItem.

Reimplemented in PerspectiveInstrument, and SEDInstrument.

◆ wavelengthGrid()

Instrument::wavelengthGrid ( ) const
inline

This function returns the value of the discoverable item property wavelengthGrid : "the wavelength grid for this instrument" .

This property is relevant only if the Boolean expression "Panchromatic" evaluates to true after replacing the names by true or false depending on their presence.

This property is required only if the Boolean expression "!DefaultInstrumentWavelengthGrid" evaluates to true after replacing the names by true or false depending on their presence.

This property is displayed only if the Boolean expression "Level2" evaluates to true after replacing the names by true or false depending on their presence.

◆ write()

void Instrument::write ( )

This function calibrates the instrument and outputs the recorded contents to a set of files. It simply calls the corresponding function of the FluxRecorder instance associated with this instrument.


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