Pandeia Quickstart
How to create a default Pandeia calculation with the build_default_calc function or by importing a JSON file from the web UI, how to make basic configuration edits, how to run the calculation, and how to get commonly-used elements of the results, are covered in this article.
On this page
Creating a Pandeia observation requires a configuration dictionary, which is most easily created with either the build_default_calc function, or by importing a JSON file created by the JWST ETC web UI. Running a Pandeia calculation is relatively straightforward, and obtaining useful information (e.g., observation time, signal to noise, or saturation) from the calculation results is also relatively easy. Whilst there are more advanced operations that can be performed with Pandeia via Python, a significant number of useful operations can be performed just by editing the default configuration.
Pandeia configuration files
Creating a Pandeia configuration dictionary
Importing a JSON configuration file from JWST ETC web UI
Words in bold are GUI menus/
panels or data software packages;
bold italics are buttons in GUI
tools or package parameters.
import json
with open('input.json', 'r') as inf:
calculation = json.loads(inf.read())
Once you have done this, calculation is a standard Python dictionary of key-value pairs that you can change as you would for any other Python dictionary (see examples below).
Creating a default configuration dictionary
You can create a Pandeia configuration dictionary by running the built-in Pandeia convenience function build_default_calc. In order to do so, enter the following commands whilst running Python from within your Pandeia environment:
from pandeia.engine.calc_utils import build_default_calc calculation = build_default_calc(<telescope>, <instrument>, <mode>)
where "telescope", "instrument", and "mode" are the telescope you are using (here jwst), the instrument (one of nircam, miri, niriss, or nirspec), and the observation mode of interest (see below for a list of modes).
Regardless of the values of "telescope", "instrument", and "mode", the build_default_calc function will create a scene with a single object. That object will be a point source with x and y offsets of zero, and a flat spectrum in f_nu normalized to 2.0 mjy at 0.001 μm. The source will have zero redshift, zero extinction, and no applied emission or absorption lines.
Four instrument modes have multiple possible data reduction strategies. For NIRSpec's IFU mode and MIRI's MRS and MRS TS modes, there are options of ifunodinscene (the default) and ifunodoffscene; for NIRSpec's MOS mode there are options of msafullapphot (the default) and specapphot. These can be set with a 4th method option to build_default_calc, so that it produces a properly configured calculation:
calculation = build_default_calc("jwst", "nirspec", "mos", method="specapphot")
calculation = build_default_calc("jwst", "miri", "mrs", method="ifunodoffscene")
Editing Pandeia configuration files
Changing the observation filter
calculation['configuration']['instrument']['filter'] = <filter>
filter is the filter you wish to use (see below for a full list).
Changing the disperser
calculation['configuration']['instrument']['disperser'] = <disperser> calculation['configuration']['instrument']['filter'] = <matching_filter>
disperser is one of the available dispersers (see below), and <matching_filter> the filter that goes along with it (again, see below).
Changing the scene
scene = {<dictionary_designing_scene>}
calculation['scene'][0] = scene
The scene in the configuration is a list of all the sources in the calculation. There are a number of examples of creating scene dictionaries below.
Running Pandeia
Once you have a configuration dictionary, running a Pandeia calculation on that dictionary may be done as follows:
from pandeia.engine.perform_calculation import perform_calculation report = perform_calculation(calculation)
Pandeia calculation results
When run using its default parameters, Pandeia returns a Python dictionary reporting on the results of the simulation. Amongst the useful contents of this dictionary are:
- "
report['warnings']" contains any warnings generated by the calculation - "
report['input']" contains a copy of the configuration dictionary (which may be useful) - "
report['scalar']" contains- The exposure time in "
report['scalar']['exposure_time']" - The signal-to-noise ratio in "
report['scalar']['sn']" - The extracted flux in "
report['scalar']['extracted_flux']" - The extracted background counts in "report['scalar']['background']"
- The exposure time in "
Appendices
Observing modes
- MIRI
coronagraphy- coronagraphic imagingimaging- imagingimaging_ts- imaging time serieslrsslit- low resolution spectroscopy (LRS) slitlrsslitless- low resolution spectroscopy (LRS) slitless, a time-series modemrs- medium resolution spectroscopy (MRS)mrs_ts- MRS time seriestarget_acq- target acquisitionwfss- wide field slitless spectroscopy
- NIRCam
coronagraphy- coronagraphic imaginglw_imaging- long wavelength imaginglw_ts- long wavelength time-series imaginglw_tsgrism- long wavelength time-series grismsw_imaging- short wavelength imagingsw_ts- short wavelength time-series imagingsw_tsgrism- short wavelength time-series grismwfgrism- wide field slitless spectroscopytarget_acq- target acquisition
- NIRISS
imaging- imagingsoss- single object slitless spectroscopywfss- wide field slitless spectroscopyami- AMItarget_acq- target acquisition
- NIRSpec
mos- multi-object spectroscopymos_conf- multi-object spectroscopy confirmation imagingmos_ver- multi-object spectroscopy verification imagingfixed_slit- fixed slitbots- bright object time seriesifu- integral field unitifu_ver- IFU verification imagingtarget_acq- target acquisition
Observation filters
- MIRI
- Coronagraphic
- F1065C
- F1140C
- F1550C
- F2300C
ImagingF560WF770WF1000WF1130WF1280WF1500WF1800WF2100WF2550WFNDF1065CF1140CF1550CF2300C
- Coronagraphic
- NIRCam
- Short Wavelength
F070WF090WF115WF140MF150WF150W2F162MF164NF182MF187NF200WF210MF212NF212N2(with WLP4 lens only)
- Long Wavelength
F250MF277WF300MF322W2F323NF335MF356WF360MF405NF410MF430MF444WF460MF466NF470NF480M
- Short Wavelength
- NIRISS
F090WF115WF140MF150WF158MF200WF277WF356WF380MF430MF444WF480M
- NIRSpec
F110WF140X
Dispersers and associated filters
- NIRCam
GRISMC/GRISMRF250MF277WF300MF322W2F335MF356WF360MF410MF430MF444WF460MF480M
- NIRISS
GR150R/GR150CF090WF115WF140MF150WF158MF200W
- GR700XD
- F277W
- NIRSpec
G140HF070LPF100LP
G140MF070LPF100LP
G235HF170LP
G235MF170LP
G395HF290LP
G395MF290LP
PRISMCLEAR
Sample code
Creating a Scene with a centered flat spectrum point source normalized to 2 mJy at 2.5 μm
Note that the supplied instrument and mode are examples intended for illustration only.
Creating a Scene with a 50,000 K blackbody spectrum Gaussian extended source
Note that, again, the supplied instrument and mode are intended for illustration only.
Creating and observing a scene with Pandeia
The resulting SNR (to three decimal places) is 2032.883