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:
Wolfire/Kaufman 2020 models for constant density media (metallicities Z=0.5,1)
Wolfire/Kaufman 2006 models for constant density media (Z=0.1,1,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:
objectClass for computed PDR Model Sets.
ModelSetprovides 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 (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
formatkeyword. The columns are:['PDR code','name', 'version','path','filename','medium','z','mass','description']
zandmassshould be floats, the rest should be strings. Thename,version,medium,z, andmasscolumns contain the values available in the input ModelSet as described above.PDR codeis the originator of the code e.g., “KOSMA-tau”,versionis the code version,pathis the full-qualified pathname to the FITS files,filenameis the tabular file which contains descriptions of individual FITS files. This must also be in the format specified by theformatkeyword.descriptionis a description of the input ModelSet.format (str) – If
modelsetinfois 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:
codeThe PDR code that created this ModelSet, e.g.
descriptionThe description of this model
identifiersTable of lines and continuum that are included in ratio models of this ModelSet.
is_wk2006method to indicate this is a wk2006 model, to deal with quirks
mediumThe medium type of this model, e.g.
metallicityThe metallicity of this ModelSet
nameThe name of this ModelSet
supported_intensitiesTable of lines and continuum that are covered by this ModelSet and have models separate from the any ratio model they might be in.
supported_ratiosThe emission ratios that are covered by this ModelSet
tableThe table containing details of the models in this ModelSet.
user_added_modelsShow which models have been added to this ModelSet by the user
versionThe version of this ModelSet
zThe 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)
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
MeasurementID. 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 aMeasurementit 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()[source]#
Return a table of the names and descriptions of available ModelSets (not just this one)
- Return type:
- 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
MeasurementIDs, 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
MeasurementIDs, 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
MeasurementID. It can be an intensity or a ratio, e.g., “CII_158”,”CI_609/FIR”.- Returns:
The model matching the identifier
- Return type:
- 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
MeasurementIDs, 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:
- 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:
- property is_wk2006#
method to indicate this is a wk2006 model, to deal with quirks of that modelset
- Returns:
True if it is.
- property medium#
The medium type of this model, e.g. ‘constant density’, ‘clumpy’, ‘non-clumpy’
- Return type:
- 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
MeasurementIDs, e.g., [“CII_158”,”OI_145”,”CS_21”]- Returns:
list of string identifiers of ratios IDs, e.g., [‘CII_158’,’OI_145’]
- Return type:
- 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
MeasurementIDs, 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:
- ratiocount(m)[source]#
The number of valid ratios in this ModelSet, given a list of observation (
Measurement) identifiers.- Parameters:
m (list) – list of string
MeasurementIDs, e.g. [“CII_158”,”OI_145”,”FIR”]- Returns:
The number of model ratios found for the given list of measurement IDs
- Return type:
- 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:
- property supported_ratios#
The emission ratios that are covered by this ModelSet
- Return type:
- property table#
The table containing details of the models in this ModelSet.
- Return type:
- property user_added_models#
Show which models have been added to this ModelSet by the user
- Return type: