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 (called msa
internally) 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", "msa", 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 acquisition
- NIRCam
coronagraphy
- coronagraphic imaginglw_imaging
- long wavelength imaginglw_ts
- long wavelength time-series imagingsw_imaging
- short wavelength imagingsw_ts
- short wavelength time-series imagingssgrism
- long 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
msa
- 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
Imaging
F560W
F770W
F1000W
F1130W
F1280W
F1500W
F1800W
F2100W
F2550W
FND
- Coronagraphic
- NIRCam
- Short Wavelength
F070W
F090W
F115W
F140M
F150W
F150W2
F162M
F164N
F182M
F187N
F200W
F210M
F212N
F212N2
(with WLP4 lens only)
- Long Wavelength
F250M
F277W
F300M
F322W2
F323N
F335M
F356W
F360M
F405N
F410M
F430M
F444W
F460M
F466N
F470N
F480M
- Short Wavelength
- NIRISS
F090W
F115W
F140M
F150W
F158M
F200W
F277W
F356W
F380M
F430M
F444W
F480M
- NIRSpec
F110W
F140X
Dispersers and associated filters
- NIRCam
GRISMC/GRISMR
F250M
F277W
F300M
F322W2
F335M
F356W
F360M
F410M
F430M
F444W
F460M
F480M
- NIRISS
GR150R/GR150C
F090W
F115W
F140M
F150W
F158M
F200W
- GR700XD
- F277W
- NIRSpec
G140H
F070LP
F100LP
G140M
F070LP
F100LP
G235H
F170LP
G235M
F170LP
G395H
F290LP
G395M
F290LP
PRISM
CLEAR
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 is 940.17542634437.