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)

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

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

Models are stored in FITS format as ratios of intensities as a function of radiation field and hydrogen nucleus volume density.

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', mass=None, modelsetinfo=None, format='ipac')[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’

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

Params modelsetinfo:

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:

[‘PDR code’,’name’, ‘version’,’path’,’filename’,’medium’,’z’,’mass’,’description’]

z and mass should be floats, the rest should be strings. The ‘name`, version, medium, z, 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. :type modelsetinfo: str or :class:~astropy.Table :format: 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 :type format: str :raises ValueError: If model set not recognized/found.

Attributes:
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

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

z

The metallicity of this ModelSet

Methods

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

Add your own model to this ModelSet.

all_sets()

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.

param identifier:

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

type identifier:

str

param model:

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(?).

type model:

str or Measurement

param title:

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()[source]

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

Return type:

Table

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.

static list()[source]

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

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 z

The metallicity of this ModelSet

Return type:

float