Pandeia Order of Operations

How to use JWST Pandeia from Python, as well as a number of important considerations about how the Pandeia Engine runs, is covered in this article. 

From within Python, in order to import and start running a Pandeia Engine calculation, simply enter the following on the command line, as long as a configuration dictionary exists:

Running Pandeia
from pandeia.engine.perform_calculation import perform_calculation
 
report = perform_calculation(configuration)

Running "perform_calculation(configuration, dict_report=False)" will generate output in the form of a Pandeia Engine Report object rather than a dictionary.



Order of operations for the Pandeia Engine

It is important to consider the order in which the Pandeia Engine performs calculation tasks. The Pandeia Engine order of operations for each source in the observation is as follows:

  1. Pandeia loads all of the sources listed in the "Scene."

  2. Then, it loads the "Instrument" configuration, as well as any instrument-specific parameters like PSFs, and computes the exposure time.

  3. Then, it configures the required "Strategy," as defined in the strategy section of the calculation.

  4. The instrument configuration, sky background configuration, "Scene," and "Strategy" are bundled together into an "Observation."

  5. The "Observation" is used to compute the exposure time.

  6. The "Observation" is used to generate the model scene:

  7. For each source, the spectrum is processed:
    1. Create the source SED, using information in the "source['scene']['spectrum']" dictionary, except that redshift, extinction, and normalization are not yet applied.
    2. Apply the redshift defined in "source['scene']['spectrum']['redshift']"
    3. Apply the extinction defined in "source['scene']['spectrum']['extinction']"
    4. Apply the normalization defined in "source['scene']['spectrum']['normalization']"
    5. Update any warnings generated by creating the SED or applying normalization
    6. Add all emission lines specified in "source['scene']['spectrum']['lines']"

  8. For each source, the spatial information is processed.
    1. A properly-defined 2-D shape is created and positioned on a 2-D array.
    2. The 2-D array is multiplied by the spectrum to form a 3-D flux cube of the source at every wavelength
    3. If more than one source, the 3-D cubes are added together to form the entire model scene. (For coronagraphy, only sources that would use the same spatially-distinct PSF library are grouped together, and the "Convolved Scene Cubes" are added together after)
    4. The 3-D "Model Scene Cube" is convolved by the appropriate PSFs (for each wavelength) from the pre-generated PSF library to form a "Convolved Scene Cube"
    5. The background (if any is specified) is converted from MJy/sr/μm to mJy/pixel/μm and added to each slice of the 3-D flux cube.

  9. The 3-D "Convolved Scene Cube" is converted to a flux in photons/s and all instrument throughputs are applied:
    1. Telescope OTE rate
    2. Filter throughput (if applicable)
    3. Disperser blaze function (if applicable)
    4. Instrument internal efficiency
    5. QE curve

  10. The "Convolved Scene Cube" is projected onto a "detector" according to the observation type—imaging-like, spectroscopy, slitless spectroscopy, multiorder spectroscopy—and converted from photons/s to e/s using a quantum yield curve.

  11. Additional detector effects (e.g., dark current) are added to the projected signal.

  12. Noise products and saturation maps are created from the projected signal, using the readout noise, flat field noise, and cosmic ray rate.

  13. The detector flux and noise are passed to the "Strategy," which constructs 2-D extraction masks based on the user input extraction aperture and sky annulus settings.

  14. Using the array masks, the "Strategy" extracts flux, SNR, and most other reported parameters of interest.

  15. The "Report" class creates realistic 2-D images of the detector (and SNR) with appropriately randomized noise, and collects all the properties to be reported (in a Python dictionary, or the web interface)


Note that, as a result of the order of operations in step 6, extinction will not be applied to emission lines, nor will redshift. Whilst a zero-continuum source with only emission lines can be created, and any or all of redshift, extinction, or normalization can be applied to it, none of those parameters will actually change the emission lines as input. In addition, if you create a continuum source with emission (or absorption) lines in the normalization bandpass, these lines will not be present when the source is normalized, so the final source flux in that bandpass will differ from the normalization value you entered. If you wish to normalize or redshift a spectrum with lines, you will need to generate the spectrum with lines outside of the engine and input it:

Custom spectrum upload
source['scene']['spectrum']['sed']['sed_type'] = 'input'
source['scene']['spectrum']['sed']['spectrum'] = [<wavelength array>, <flux array>]

For more information on the inner workings of the Pandeia Engine, consult Pontoppidan et al. (2016).



References

Pontoppidan, K. M., Pickering, T. E.,  Laidler, V. G.  et al., 2016, Proc. SPIE 9910, Observatory Operations: Strategies, Processes, and Systems VI, 991016
Pandeia: a multi-mission exposure time calculator for JWST and WFIRST




Latest updates
  •  
    Updated for ETC 3.0.

  •  
    Expanded for ETC 2.0.

  •  
    Reviewed for ETC 1.6.

  •  
    Updated for ETC 1.5.


  • Added references section, added reference, and fixed link to reference in text.


  • Updated for ETC 1.3. Title changed. Some material moved to Pandeia Configuration Dictionaries article.
Originally published