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

Plot polarization maps from SKIRT simulation output. More...

Functions

def _circArrow (ax, posx, posy, size)
 This helper function draws a circular polarization arrow in the given matplotlib axes. More...
 
def _roundUp (x, slack=0.01)
 This helper function rounds up a given number (away from zero) to one significant digit, in a logarithmic fashion. More...
 
def plotPolarization (simulation, *plotLinMap=True, plotDegMap=False, plotDegAvg=False, plotCirMap=False, wavelength=None, binSize=(7, 7), degreeScale=None, decades=5, outDirPath=None, figSize=(8, 6), interactive=None)
 This function creates PDF polarization maps for the output of polarization-enabled SKIRT simulations that include instruments generating surface brightness frames or data cubes (*.fits files). More...
 

Detailed Description

Plot polarization maps from SKIRT simulation output.

The function in this module creates PDF polarization maps for the output of polarization-enabled SKIRT simulations that include instruments generating surface brightness frames or data cubes (*_total.fits and *_stokes*.fits files).

Function Documentation

◆ _circArrow()

def pts.visual.plotpolarization._circArrow (   ax,
  posx,
  posy,
  size 
)
private

This helper function draws a circular polarization arrow in the given matplotlib axes.

◆ _roundUp()

def pts.visual.plotpolarization._roundUp (   x,
  slack = 0.01 
)
private

This helper function rounds up a given number (away from zero) to one significant digit, in a logarithmic fashion.

The slack argument allows a number just larger than the nearest limit to be clamped to that limit.

◆ plotPolarization()

def pts.visual.plotpolarization.plotPolarization (   simulation,
plotLinMap = True,
  plotDegMap = False,
  plotDegAvg = False,
  plotCirMap = False,
  wavelength = None,
  binSize = (7,7),
  degreeScale = None,
  decades = 5,
  outDirPath = None,
  figSize = (8, 6),
  interactive = None 
)

This function creates PDF polarization maps for the output of polarization-enabled SKIRT simulations that include instruments generating surface brightness frames or data cubes (*.fits files).

Specifically, the function accepts a sequence of Simulation and/or Instrument instances (or a single instance of either of these types), and it creates polarization maps for each of the instruments that actually produced both *_total.fits and *_stokes*.fits files. Other instruments are silently ignored.

By default, the figures are saved in the output directory of the corresponding instrument, using a name starting with the simulation prefix and instrument name, and ending with ".pdf". The output directory can be overridden. In interactive mode (see the pts.utils.interactive() function), the figures are not saved and are left open for display in notebooks.

The function takes the following arguments:

  • simulation: a sequence of Simulation and/or Instrument instances, or a single instance of either of these types.
  • plotLinMap: whether to plot a linear polarization map (binned degree and angle); True or False.
  • plotDegMap: whether to plot a linear polarization degree map; True or False.
  • plotDegAvg: whether to plot the y-axis averaged linear polarization degree for all x pixels; True or False.
  • plotCirMap: whether to plot a circular polarization map; True or False.
  • wavelength: an astropy quantity or a sequence of astropy quantities specifying the wavelength(s) for which to create the plot, or the string 'all' to create a plot for all wavelengths in the data cube, or None to use the first frame in the data cube.
  • binSize: the number of pixels in each bin, in horizontal and vertical directions.
  • degreeScale: the maximum polarization degree to be visualized, or None for automatic scale.
  • decades: number of surface brightness decades (dex) shown in the background image; default is 5.
  • outDirPath: string or Pathlib.Path object that specifies (overrides) the output directory.
  • figSize: the horizontal and vertical size of the output figure in inch; default is 6x6 inch.
  • interactive: whether to leave figures open (True) or save them to file (False).