The SKIRT project
advanced radiative transfer for astrophysics
Functions
pts.visual.plotcurves Namespace Reference

Plot SEDs or other SKIRT output as a function of wavelength. More...

Functions

def _adjustWavelengthRange (wrange, wunit, wmin=None, wmax=None)
 This private function adjusts the given wavelength range to the given minimum and/or maximum, if present, and returns the result. More...
 
def plotSeds (simulation, minWavelength=None, maxWavelength=None, decades=None, *outDirPath=None, outFileName=None, outFilePath=None, figSize=(8, 6), interactive=None)
 This function creates a plot of the SEDs produced by one or more SKIRT simulations. More...
 
def plotSources (simulation, minWavelength=None, maxWavelength=None, decades=None, *outDirPath=None, outFileName=None, outFilePath=None, figSize=(8, 6), interactive=None)
 This function creates a plot of the behavior of the sources in a SKIRT simulations. More...
 
def plotSpectralResolution (inFilePath, minWavelength=None, maxWavelength=None, decades=None, *title=None, outDirPath=None, outFileName=None, outFilePath=None, figSize=(8, 5), interactive=None)
 This function creates a plot of the spectral resolution \(R=\lambda/\Delta\lambda\) of a wavelength grid loaded from a SKIRT stored table (".stab"), a SKIRT text column file (".dat") that includes a wavelength axis, or a SKIRT instrument or probe data cube that includes a wavelength axis. More...
 

Detailed Description

Plot SEDs or other SKIRT output as a function of wavelength.

This module offers functions to plot spectral distributions or other SKIRT output as a function of wavelength. Each function accepts a list of Instrument or Probe instances of a certain type, and plots the corresponding output.

Function Documentation

◆ _adjustWavelengthRange()

def pts.visual.plotcurves._adjustWavelengthRange (   wrange,
  wunit,
  wmin = None,
  wmax = None 
)
private

This private function adjusts the given wavelength range to the given minimum and/or maximum, if present, and returns the result.

The input and output wavelength ranges are expressed in the specified units but do not carry explicit unit information. The output range will always be in increasing order. The minimum and/or maximum values, if present, must include explicit unit information and will be converted to plot units. Their ordering depends on the style of the units in which they are specified (and not on the plot units).

◆ plotSeds()

def pts.visual.plotcurves.plotSeds (   simulation,
  minWavelength = None,
  maxWavelength = None,
  decades = None,
outDirPath = None,
  outFileName = None,
  outFilePath = None,
  figSize = (8, 6),
  interactive = None 
)

This function creates a plot of the SEDs produced by one or more SKIRT simulations.

Specifically, the function accepts a sequence of Simulation and/or Instrument instances (or a single instance of either of these types), and it plots the total flux density for each of the instruments that actually produced an "*_sed.dat" file.

If there is only a single SED, and the corresponding output file includes the individual flux components, the function plots these as well.

If there are multiple SEDs, the plot uses the flux flavor and units of the first SED and the data for all other SEDs are converted, if needed.

If there is no SED in the list, the function does nothing.

By default, the figure is saved in the output directory of the first instrument in the list, using a name starting with the corresponding simulation prefix, possibly including the instrument name, and ending with ".pdf". This can be overridden with the out* arguments as described for the pts.utils.savePath() function. In interactive mode (see the pts.utils.interactive() function), the figure is not saved and it is left open so that is displayed in notebooks.

◆ plotSources()

def pts.visual.plotcurves.plotSources (   simulation,
  minWavelength = None,
  maxWavelength = None,
  decades = None,
outDirPath = None,
  outFileName = None,
  outFilePath = None,
  figSize = (8, 6),
  interactive = None 
)

This function creates a plot of the behavior of the sources in a SKIRT simulations.

Specifically, it plots the luminosity of and the number of photon packets launched by each source as a function of wavelength. Both curves are normalized so that their maximum value is equal to one. This allows a user to evaluate whether the photon packet distribution (as a function of wavelength) is appropriate for the source spectra.

The function accepts a single Simulation instance and it assumes that the simulation includes exactly one LuminosityProbe and exactly one LaunchedPacketsProbe. If this is not the case, the function does nothing.

By default, the figure is saved in the simulation output directory, using a name starting with the simulation prefix and ending with "sources.pdf". This can be overridden with the out* arguments as described for the pts.utils.savePath() function. In interactive mode (see the pts.utils.interactive() function), the figure is not saved and it is left open so that is displayed in notebooks.

◆ plotSpectralResolution()

def pts.visual.plotcurves.plotSpectralResolution (   inFilePath,
  minWavelength = None,
  maxWavelength = None,
  decades = None,
title = None,
  outDirPath = None,
  outFileName = None,
  outFilePath = None,
  figSize = (8, 5),
  interactive = None 
)

This function creates a plot of the spectral resolution \(R=\lambda/\Delta\lambda\) of a wavelength grid loaded from a SKIRT stored table (".stab"), a SKIRT text column file (".dat") that includes a wavelength axis, or a SKIRT instrument or probe data cube that includes a wavelength axis.

By default, the figure is saved in the current directory, using the name of the input file but with the ".pdf" filename extension. This can be overridden with the out* arguments as described for the pts.utils.savePath() function. In interactive mode (see the pts.utils.interactive() function), the figure is not saved and it is left open so that is displayed in notebooks.