The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Private Attributes | List of all members
pts.simulation.simulation._SimulationEntity Class Reference

This class serves as an abstract base class for the Instrument and Probe classes. More...

Public Member Functions

def __init__ (self, simulation, xpath)
 The constructor accepts the Simulation instance in which this entity resides, and the xpath of the entity in the ski file for the simulation. More...
 
def getBoolAttribute (self, attribute)
 This function returns the value of the specified entity attribute as a Boolean value. More...
 
def getFloatAttribute (self, attribute)
 This function returns the value of the specified entity attribute as a floating point number representing a dimensionless quantity. More...
 
def getIntAttribute (self, attribute)
 This function returns the value of the specified entity attribute as an integer number. More...
 
def getQuantityAttribute (self, attribute)
 This function returns the value of the specified entity attribute as an astropy scalar quantity with given units. More...
 
def getQuantityListAttribute (self, attribute)
 This function returns the value of the specified entity attribute as an astropy quantity array with given units, assuming comma-separated values in the attribute value. More...
 
def getStringAttribute (self, attribute)
 This function returns the value of the specified entity attribute as a string. More...
 
def outFilePaths (self, fileType=None)
 This function returns a list of absolute paths to the output files associated with this entity. More...
 
def prefix (self)
 This function returns the prefix for the simulation with which this entity is associated. More...
 
def type (self)
 This function returns the type of the entity, i.e. More...
 
def wavelengthBinWidths (self)
 This function returns an astropy quantity array containing the wavelength bin widths of the wavelength grid associated with this entity, or raises an error if this information cannot be obtained. More...
 
def wavelengthIndices (self, wavelengths)
 This function uses the wavelengths() function to load the characteristic wavelengths of the wavelength grid associated with this entity, and then determines the zero-based grid index corresponding to (i.e. More...
 
def wavelengths (self)
 This function returns an astropy quantity array containing the characteristic wavelengths of the wavelength grid associated with this entity, or raises an error if this information cannot be obtained. More...
 

Private Attributes

 _simulation
 
 _xpath
 

Detailed Description

This class serves as an abstract base class for the Instrument and Probe classes.

Instances of these classes can be spawned from a Simulation object to represent one of those entities and allow retrieving attributes. This base class implements some common functionality.

Constructor & Destructor Documentation

◆ __init__()

def pts.simulation.simulation._SimulationEntity.__init__ (   self,
  simulation,
  xpath 
)

The constructor accepts the Simulation instance in which this entity resides, and the xpath of the entity in the ski file for the simulation.

It is intended to be invoked only from within the constructor of a subclass.

Reimplemented in pts.simulation.simulation.Instrument, and pts.simulation.simulation.Probe.

Member Function Documentation

◆ getBoolAttribute()

def pts.simulation.simulation._SimulationEntity.getBoolAttribute (   self,
  attribute 
)

This function returns the value of the specified entity attribute as a Boolean value.

The string value is considered to represent True if it contains "true", "t", "yes", "y" or "1" (case insensitive), and False otherwise. If the entity does not have the specified attribute, an error is raised.

◆ getFloatAttribute()

def pts.simulation.simulation._SimulationEntity.getFloatAttribute (   self,
  attribute 
)

This function returns the value of the specified entity attribute as a floating point number representing a dimensionless quantity.

If the entity does not have the specified attribute, an error is raised.

◆ getIntAttribute()

def pts.simulation.simulation._SimulationEntity.getIntAttribute (   self,
  attribute 
)

This function returns the value of the specified entity attribute as an integer number.

If the entity does not have the specified attribute, an error is raised.

◆ getQuantityAttribute()

def pts.simulation.simulation._SimulationEntity.getQuantityAttribute (   self,
  attribute 
)

This function returns the value of the specified entity attribute as an astropy scalar quantity with given units.

If the entity does not have the specified attribute, or if the attribute value does not include a unit string, an error is raised.

◆ getQuantityListAttribute()

def pts.simulation.simulation._SimulationEntity.getQuantityListAttribute (   self,
  attribute 
)

This function returns the value of the specified entity attribute as an astropy quantity array with given units, assuming comma-separated values in the attribute value.

If the entity does not have the specified attribute, or if one of the attribute values does not include a unit string, an error is raised.

◆ getStringAttribute()

def pts.simulation.simulation._SimulationEntity.getStringAttribute (   self,
  attribute 
)

This function returns the value of the specified entity attribute as a string.

If the entity does not have the specified attribute, an error is raised.

◆ outFilePaths()

def pts.simulation.simulation._SimulationEntity.outFilePaths (   self,
  fileType = None 
)

This function returns a list of absolute paths to the output files associated with this entity.

If the fileType argument is present, the list is limited to files with a name with a final segment (i.e. the portion after the simulation prefix an entity name) that ends in the specified string. The returned list is sorted alphabetically on filename. The list may be empty.

◆ prefix()

def pts.simulation.simulation._SimulationEntity.prefix (   self)

This function returns the prefix for the simulation with which this entity is associated.

The prefix is used as the initial segment of all output file names.

◆ type()

def pts.simulation.simulation._SimulationEntity.type (   self)

This function returns the type of the entity, i.e.

the corresponding SKIRT class name, as a string.

◆ wavelengthBinWidths()

def pts.simulation.simulation._SimulationEntity.wavelengthBinWidths (   self)

This function returns an astropy quantity array containing the wavelength bin widths of the wavelength grid associated with this entity, or raises an error if this information cannot be obtained.

The function uses the following mechanisms for obtaining the wavelength bin widths, in the order listed, until one is successful.

  • Load the "*_wavelengths.dat" file associated with this entity.
  • If the simulation has an oligochromatic wavelength regime, read the wavelengths from the ski file and determine the fixed bin width as 1/500 of the shortest wavelength in the list (in this case all wavelength grids in the simulation are identical, and the bin widths are determined as here described).

If all mechanisms fail, an error is raised.

◆ wavelengthIndices()

def pts.simulation.simulation._SimulationEntity.wavelengthIndices (   self,
  wavelengths 
)

This function uses the wavelengths() function to load the characteristic wavelengths of the wavelength grid associated with this entity, and then determines the zero-based grid index corresponding to (i.e.

with a characteristic wavelength nearest to) each of the wavelengths specified as an argument. The wavelengths argument must be an iterable of astropy quantities (including an astropy quantity array). The function returns an iterable of integers with the same length.

◆ wavelengths()

def pts.simulation.simulation._SimulationEntity.wavelengths (   self)

This function returns an astropy quantity array containing the characteristic wavelengths of the wavelength grid associated with this entity, or raises an error if this information cannot be obtained.

The function uses the following mechanisms for obtaining the wavelength grid, in the order listed, until one is successful.

  • If the simulation has an oligochromatic wavelength regime, read the wavelengths from the ski file (in this case all wavelength grids in the simulation are identical).
  • Load the "*_wavelengths.dat" file associated with this entity.
  • Load the "*_sed.dat" file associated with this entity.
  • Load any "*.dat" file associated with this entity that has an unambiguous "wavelength" column.
  • Load from any "*.fits" file associated with this entity that has a wavelength-compatible table extension.

If all mechanisms fail, an error is raised.


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