ModelSets: The interface to models in the Toolbox#

PDRT supports a variety of PDR models to be used to fit your data. These are represented in the Python class ModelSet. Broadly three classes are available:

  1. Wolfire/Kaufman 2020 models for constant density media (metallicities Z=0.5,1) and viewing angles 0 (face-on), 30, 45, 60, 75 degrees.

  2. Wolfire/Kaufman 2006 face-on models for constant density media (Z=0.1,1,3)

  3. Kosma-\(\tau\) 2013 models for clumpy and non-clumpy media (Z=1)

The viewing angle models calculate the emitted line intensity along a line-of-sight at angle, theta, with respect to the illuminated face of the PDR. The angle theta=0 is a line that is perpendicular to the face while the angle theta=90 is a line that is parallel to the face. The line intensity for each transition as well as the integrated far-infrared intensity is calculated as in Pabst et al. 2017, A&A, 606, A29. We make the assumption that each line of sight passes through all layers of the PDR to an optical depth of Av=7 from the face. This means that the integral along the line-of-sight as well as Av increases as 7/cos(theta), and the thickness of the PDR increases as 7*tan(theta). The user should keep in mind that this assumption may lead to unrealistically large Av that should be checked against observations if possible. The different angles and Avs are given in the fits headers as follows LOSANGLE angle in degrees with respect to illuminated face of PDR.

Note that the face-on intensity is angle averaged over intensities emitted from the PDR face as in Tielens & Hollenbach 1985, but the angle-on intensity is the intensity along the ray at the given angle.

Models are stored in FITS format as ratios of intensities as a function of radiation field and hydrogen nucleus volume density. The FITS headers list three different extinction values:

  • AV: optical depth in magnitudes of visual extinction of PDR along a line

through the illuminated face to the deepest layers. All models are fixed at \(A_V = 7\).

  • AVPERP: optical depth in magnitudes of visual extinction of the PDR

perpendicular to Av

  • AVLOS: optical depth in magnitudes of visual extinction of the PDR along

the line-of-sight.

For example how to use ModelSets, see the notebook PDRT_Example_ModelSets.ipynb


Manage pre-computed PDR models

class pdrtpy.modelset.ModelSet(name, z, medium='constant density', losangle=0, mass=None, modelsetinfo=None, format='ipac', debug=False)[source]#

Bases: object

Class for computed PDR Model Sets. ModelSet provides interface to a directory containing the model FITS files and the ability to query details about.

Parameters:
  • name (str) – identifying name, e.g., ‘wk2006’

  • z (float) – metallicity in solar units.

  • medium (str) – medium type, e.g. ‘constant density’, ‘clumpy’, ‘non-clumpy’

  • losangle (float) – the line-of-sight inclination angle (aka viewing angle), losangle=0 is face-on, losangle=90 is edge-on. Valid values are 0, 30, 45, 60, 75, 90.

  • mass (float) – maximum clump mass (for KosmaTau models). Default:None (appropriate for Wolfire/Kaufman models)

  • modelsetinfo (str or Table) –

    For adding user specified ModelSet, this parameter specifies the file with information about the ModelSet. It can be a pathname to an externalt tabular file in an astropy-recognized or an astropy Table object. If an external tabular file, its format should be give by the format keyword. The columns are:

    ['PDRcode','name', 'version','path','filename','medium','z','inc', 'mass','description']
    

    z, ‘inc’, and mass should be numbers, the rest should be strings. The name, version, medium, z, ‘inc’, and mass columns contain the values available in the input ModelSet as described above. PDR code is the originator of the code e.g., “KOSMA-tau”, version is the code version, path is the full-qualified pathname to the FITS files, filename is the tabular file which contains descriptions of individual FITS files. This must also be in the format specified by the format keyword. description is a description of the input ModelSet.

  • format (str) – If modelsetinfo is a file, give the format of file. Must be an astropy recognized Table format. e.g., ascii, ipac, votable. Default is IPAC format

Raises:

ValueError – If model set not recognized/found.

Attributes:
avlos

The visual extinction along the line of sight, express in magnitudes.

avperp

The PDR thickness for inclined viewing angle models, expressed in visual magnitudes.

code

The PDR code that created this ModelSet, e.g.

description

The description of this model

identifiers

Table of lines and continuum that are included in ratio models of this ModelSet.

is_wk2006

method to indicate this is a wk2006 model, to deal with quirks

is_wk2020

method to indicate this is a wk2020 model, to deal with quirks

losangle

The inclination (viewing) angle with respect to the line of sight, in degrees.

medium

The medium type of this model, e.g.

metallicity

The metallicity of this ModelSet

name

The name of this ModelSet

supported_intensities

Table of lines and continuum that are covered by this ModelSet and have models separate from the any ratio model they might be in.

supported_ratios

The emission ratios that are covered by this ModelSet

table

The table containing details of the models in this ModelSet.

user_added_models

Show which models have been added to this ModelSet by the user

version

The version of this ModelSet

viewangle

The viewing angle (inclination) with respect to the line of sight, in degrees.

z

The metallicity of this ModelSet

Methods

add_model(identifier, model, title[, overwrite])

Add your own model to this ModelSet.

all_sets([debug])

Return a table of the names and descriptions of available ModelSets (not just this one)

find_files(m[, ext])

Find the valid model ratios files in this ModelSet for a given list of measurement IDs.

find_pairs(m)

Find the valid model ratios labels in this ModelSet for a given list of measurement IDs

get_model(identifier[, unit, ext])

Get a specific model by its identifier

get_models(identifiers[, model_type, ext])

get the models from thie ModelSet that match the input list of identifiers

list()

Print the names and descriptions of available ModelSets (not just this one)

model_intensities(m)

Return the model intensities in this ModelSet that match the input Measurement ID list.

model_ratios(m)

Return the model ratios that match the input Measurement ID list.

ratiocount(m)

The number of valid ratios in this ModelSet, given a list of observation (Measurement) identifiers.

add_model(identifier, model, title, overwrite=False)[source]#

Add your own model to this ModelSet.

Parameters:
  • identifier (str) – a Measurement ID. It can be an intensity or a ratio, e.g., “CII_158”,”CI_609/FIR”.

  • model (str or Measurement) – the model to add. If a string, this must be the fully-qualified path of a FITS file. If a Measurement it must have the same CTYPEs and CUNITs as the models in the ModelSet(?).

  • title (str :param overwrite: Whether to overwrite the model if the identifier already exists in the ModelSet or has been previously added. Default: False :type overwrite: bool) – A formatted string (e.g., LaTeX) describing this observation that can be used for plotting. Python r-strings are accepted, e.g., r’$^{13}$CO(3-2)’ would give \(^{13}{\rm CO(3-2)}\).

static all_sets(debug=False)[source]#

Return a table of the names and descriptions of available ModelSets (not just this one)

Return type:

Table

property avlos#

The visual extinction along the line of sight, express in magnitudes. :rtype: float

property avperp#

The PDR thickness for inclined viewing angle models, expressed in visual magnitudes. A value of 0 indicates a face-on model, for which avperp is undefined. :rtype: float

property code#

The PDR code that created this ModelSet, e.g. ‘KOSMA-tau’

Return type:

str

property description#

The description of this model

Return type:

str

find_files(m, ext='fits')[source]#

Find the valid model ratios files in this ModelSet for a given list of measurement IDs. See id()

Parameters:
  • m (list) – list of string Measurement IDs, e.g. [“CII_158”,”OI_145”,”FIR”]

  • ext (str) – file extension. Default: “fits”

Returns:

An iterator of model ratio files for the given list of Measurement IDs

Return type:

iterator

find_pairs(m)[source]#

Find the valid model ratios labels in this ModelSet for a given list of measurement IDs

Parameters:

m (list) – list of string Measurement IDs, e.g. [“CII_158”,”OI_145”,”FIR”]

Returns:

An iterator of model ratios labels for the given list of measurement IDs

Return type:

iterator

get_model(identifier, unit=None, ext='fits')[source]#

Get a specific model by its identifier

Parameters:

identifier (str) – a Measurement ID. It can be an intensity or a ratio, e.g., “CII_158”,”CI_609/FIR”.

Returns:

The model matching the identifier

Return type:

Measurement

Raises:

KeyError – if identifier not found in this ModelSet

get_models(identifiers, model_type='ratio', ext='fits')[source]#

get the models from thie ModelSet that match the input list of identifiers

Parameters:
  • identifiers (list) – list of string Measurement IDs, e.g., [“CII_158”,”OI_145”,”CS_21”]

  • model_type (str) – indicates which type of model is requested one of ‘ratio’ or ‘intensity’

Returns:

The matching models as a list of Measurement.

Return type:

list

Raises:

KeyError – if identifiers not found in this ModelSet

property identifiers#

Table of lines and continuum that are included in ratio models of this ModelSet. Only lines and continuum that are part of ratios are included in this list. For a separate list of line and continuum intensity models see supported_intensities().

Return type:

astropy.table.Table

property is_wk2006#

method to indicate this is a wk2006 model, to deal with quirks of that modelset

Returns:

True if it is.

property is_wk2020#

method to indicate this is a wk2020 model, to deal with quirks of that modelset

Returns:

True if it is.

static list()[source]#

Print the names and descriptions of available ModelSets (not just this one)

property losangle#

The inclination (viewing) angle with respect to the line of sight, in degrees. A value of 0 means face-on. :rtype: float

property medium#

The medium type of this model, e.g. ‘constant density’, ‘clumpy’, ‘non-clumpy’

Return type:

str

property metallicity#

The metallicity of this ModelSet

Return type:

float

model_intensities(m)[source]#

Return the model intensities in this ModelSet that match the input Measurement ID list. This method will return the intersection of the input list and the list of supported lines.

Parameters:

m (list) – list of string Measurement IDs, e.g., [“CII_158”,”OI_145”,”CS_21”]

Returns:

list of string identifiers of ratios IDs, e.g., [‘CII_158’,’OI_145’]

Return type:

list

model_ratios(m)[source]#

Return the model ratios that match the input Measurement ID list. You must provide at least 2 Measurements IDs

Parameters:

m (list) – list of string Measurement IDs, e.g., [“CII_158”,”OI_145”,”FIR”]

Returns:

list of string identifiers of ratios IDs, e.g., [‘OI_145/CII_158’, ‘OI_145+CII_158/FIR’]

Return type:

list

property name#

The name of this ModelSet

Return type:

str

ratiocount(m)[source]#

The number of valid ratios in this ModelSet, given a list of observation (Measurement) identifiers.

Parameters:

m (list) – list of string Measurement IDs, e.g. [“CII_158”,”OI_145”,”FIR”]

Returns:

The number of model ratios found for the given list of measurement IDs

Return type:

int

property supported_intensities#

Table of lines and continuum that are covered by this ModelSet and have models separate from the any ratio model they might be in.

Return type:

astropy.table.Table

property supported_ratios#

The emission ratios that are covered by this ModelSet

Return type:

astropy.table.Table

property table#

The table containing details of the models in this ModelSet.

Return type:

astropy.table.Table

property user_added_models#

Show which models have been added to this ModelSet by the user

Return type:

list

property version#

The version of this ModelSet

Return type:

str

property viewangle#

The viewing angle (inclination) with respect to the line of sight, in degrees. A value of 0 means face-on. :rtype: float

property z#

The metallicity of this ModelSet

Return type:

float