The SKIRT project
advanced radiative transfer for astrophysics
Functions
pts.storedtable.convert_opticalprops Namespace Reference

Functions for converting optical properties to stored table format. More...

Functions

def convertDustemOpticalProps (inFilePaths, outFilePaths)
 This function converts optical properties given in DustEM format to stored table format. More...
 
def convertGenericOpticalProps (inFilePaths, outFilePaths)
 This function converts optical properties listed in a single text file (in the format described below) to stored table format. More...
 
def convertMinOpticalProps (inFilePaths, outFilePaths)
 This function converts optical properties given in the format provided by Michiel Min to stored table format. More...
 
def convertStokesPolarizedOpticalProps (inFilePaths, outFilePaths)
 This function converts optical properties given in STOKES format to stored table format. More...
 

Detailed Description

Functions for converting optical properties to stored table format.

The functions in this module can convert various kinds of optical property data to SKIRT stored table format. The stored tables for basic optical properties produced by the functions in this module have a two axes:

Function Documentation

◆ convertDustemOpticalProps()

def pts.storedtable.convert_opticalprops.convertDustemOpticalProps (   inFilePaths,
  outFilePaths 
)

This function converts optical properties given in DustEM format to stored table format.

It expects three input file paths and a single output file path. The input files should respectively contain:

  • the wavelength grid \(\lambda_k\), in increasing order;
  • the grain sizes \(a_i\) plus the absorption and scattering efficiencies \(Q_{k,i}^{\text{abs}}\) and \(Q_{k,i}^{\text{sca}}\) on the two-dimensional grid;
  • the grain sizes \(a_i\) plus the scattering phase function asymmetry parameter \(g_{k,i}\) on the same grid; the grain sizes values must be identical in both files.

The files should have a simple text format as described here. For all files, any initial lines that start with a # character are considered to be part of a header and are thus ignored.

In the wavelength grid file, the first number on the first non-header line specifies the number of wavelength grid points \(N_\lambda\). The remaining numbers in the file (separated by whitespace, possibly including line endings) specify the wavelength grid points \(\lambda_k\) in (micron).

The efficiencies file contains three blocks, each optionally starting with a header consisting of lines that start with a # character. In the first block, the first number on the first non-header line specifies the number of grain size grid points \(N_a\). The second line has \(N_a\) columns specifying the grain sizes \(a_i\) (in micron), in increasing order. The second block contains \(N_\lambda\) non-header lines. Each line specifies the \(N_a\) absorption efficiencies \(Q_{k,i}^{\text{abs}}\) corresponding to line (wavelength) \(k\) and column (grain size) \(i\). Similarly, the third block contains \(N_\lambda\) non-header lines. Each line now specifies the \(N_a\) scattering efficiencies \(Q_{k,i}^{\text{sca}}\) corresponding to line (wavelength) \(k\) and column (grain size) \(i\).

The scattering assymetry parameter file similarly contains two blocks. The first block describes the grain size grid and should be identical to the first block in the efficiencies file. The second block again contains \(N_\lambda\) non-header lines. Each line now specifies the \(N_a\) scattering assymetry parameters \(g_{k,i}\) corresponding to line (wavelength) \(k\) and column (grain size) \(i\). */

◆ convertGenericOpticalProps()

def pts.storedtable.convert_opticalprops.convertGenericOpticalProps (   inFilePaths,
  outFilePaths 
)

This function converts optical properties listed in a single text file (in the format described below) to stored table format.

Several options provide extra flexibility to support various existing formats.

In addition to a single output file path for the stored table, the function expects five input argument strings, in order of occurrence: input-file-path, reverse, skip1, skip2, skip3. The last four arguments are booleans. The string "true" (case insensitive) represents True, anything else represents False.

The input file should have a simple text format as described here. Any initial lines that start with a '#' character are considered to be part of a header and are thus ignored. The first number on the first non-header line specifies the number of grain size grid points \(N_a\); the first number on the second non-header line specifies the number of wavelength grid points \(N_\lambda\).

Subsequently there must be \(N_a\) blocks containing \(N_\lambda+1\) lines each. The first number on the first line in each block provides the grain size value for this block (in micron); blocks must be in order of increasing grain size. Subsequent lines in the block provide information for the various wavelengths at this grain size. If the reverse flag is false, these lines are in order of increasing wavelength, otherwise they are in order of decreasing wavelength. All data lines in a block must have 4 to 7 columns in the following order: \(X_1\), \(\lambda\), \(X_2\), \(Q^\text{abs}\), \(Q^\text{sca}\), \(X_3\), \(g\), where the presence or absence of each of the dummy \(X_i\) fields is indicated by the corresponding skip flag (true means the field is present, false means it is absent). The wavelength must be given in micron; the other three values are dimensionless.

For all lines discussed above, any additional information at the end of the line is ignored.

◆ convertMinOpticalProps()

def pts.storedtable.convert_opticalprops.convertMinOpticalProps (   inFilePaths,
  outFilePaths 
)

This function converts optical properties given in the format provided by Michiel Min to stored table format.

In addition to a single output file path for the stored table, the function expects two input arguments: the input filename template, in which the asterisk will be replaced by the grain size to obtain the actual filenames, and the bulk density of the grain material.

There is an input file for each grain size; the grain size (in micron) is encoded in the file name. Each file has the following columns: wavelength (micron), kappa_ext (cm^2/g), kappa_abs (cm^2/g), kappa_scat (cm^2/g), asymmetry parameter. For solid spherical grains we have: Q = kappa * rho_bulk * 4/3*a.

◆ convertStokesPolarizedOpticalProps()

def pts.storedtable.convert_opticalprops.convertStokesPolarizedOpticalProps (   inFilePaths,
  outFilePaths 
)

This function converts optical properties given in STOKES format to stored table format.

It expects a single input file paths and two output file paths: one for the basic optical properties and one for the Mueller matrix coeffients.

The input file should have the text format as used by the STOKES code version 2.06. The file contains the absorption and scattering coefficients as a function of grain size and wavelength, and Mueller matrix coeffients as a function of grain size, wavelength, and scattering angle.