The SKIRT project
advanced radiative transfer for astrophysics
Classes | Functions
pts.simulation.simulation Namespace Reference

Representing the files related to a SKIRT simulation. More...

Classes

class  _SimulationEntity
 This class serves as an abstract base class for the Instrument and Probe classes. More...
 
class  Instrument
 An instance of the Instrument class can be spawned from a Simulation object to represent an instrument in the simulation, allowing to retrieve its attributes. More...
 
class  Probe
 An instance of the Probe class can be spawned from a Simulation object to represent a probe in the simulation, allowing to retrieve its attributes. More...
 
class  Simulation
 An instance of the Simulation class represents all input and output files related to a single performed SKIRT simulation. More...
 

Functions

def createSimulation (outDirPath="", prefix=None)
 This function returns a single Simulation object corresponding to SKIRT output in the specified directory, optionally restricted to the simulation with the specified prefix. More...
 
def createSimulations (outDirPath="", prefix=None)
 This function returns a list of Simulation objects corresponding to SKIRT output in the specified directory, optionally restricted to the simulation with the specified prefix. More...
 
def instrumentOutFilePaths (entities, fileType=None)
 This function accepts a sequence of Simulation and/or Instrument instances, or a single instance of either of these types. More...
 
def probeOutFilePaths (entities, fileType=None)
 This function accepts a sequence of Simulation and/or Probe instances, or a single instance of either of these types. More...
 

Detailed Description

Representing the files related to a SKIRT simulation.

An instance of the Simulation class in this module represents all input and output files related to a single performed SKIRT simulation.

Function Documentation

◆ createSimulation()

def pts.simulation.simulation.createSimulation (   outDirPath = "",
  prefix = None 
)

This function returns a single Simulation object corresponding to SKIRT output in the specified directory, optionally restricted to the simulation with the specified prefix.

The function calls the createSimulations() function, verifies that there is exactly one item in the returned list, and returns that item. If no simulation is found, or multiple simulations are found, the function raises an error.

◆ createSimulations()

def pts.simulation.simulation.createSimulations (   outDirPath = "",
  prefix = None 
)

This function returns a list of Simulation objects corresponding to SKIRT output in the specified directory, optionally restricted to the simulation with the specified prefix.

The function detects SKIRT output based on the primary log file generated by each simulation. The arguments are as follows.

  • outDirPath: path to the directory to be searched, as described for the pts.utils.absPath() function. A missing argument or the empty string indicates the current working directory.
  • prefix: if specified, the search is restricted to the simulation with the specified prefix (corresponding to the stem of the ski filename passed to SKIRT). If omitted or None, all simulations in the directory are included.

If no simulation output conforming to the specified requirements is found, the function returns an empty list. The Simulation objects created by this function have no knowledge about any of the input files of the simulation.

◆ instrumentOutFilePaths()

def pts.simulation.simulation.instrumentOutFilePaths (   entities,
  fileType = None 
)

This function accepts a sequence of Simulation and/or Instrument instances, or a single instance of either of these types.

It iterates over these entities looking for associated instrument output files that have a name with a final segment that ends in the specified string (or all output files if the fileType argument is omitted). The function returns a list of tuples, each containing an Instrument instance and an associated output file path. The list follows the order of the specified input entities. The list may be empty.

◆ probeOutFilePaths()

def pts.simulation.simulation.probeOutFilePaths (   entities,
  fileType = None 
)

This function accepts a sequence of Simulation and/or Probe instances, or a single instance of either of these types.

It iterates over these entities looking for associated probe output files that have a name with a final segment that ends in the specified string (or all output files if the fileType argument is omitted). The function returns a list of tuples, each containing a Probe instance and an associated output file path. The list follows the order of the specified input entities. The list may be empty.