pandeia_io.PandeiaCalculation
self, instrument, mode=None) pandeia_io.PandeiaCalculation(
A class to interface with the pandeia.engine package.
Parameters
Name | Type | Description | Default |
---|---|---|---|
instrument | The JWST instrument: nircam, niriss, nirspec, miri. | required | |
mode | Observing mode. If not set, default to the first item for each instrument from this list below: instrument mode comments ———- —- ——– nircam: lw_tsgrism spectroscopy sw_tsgrism spectroscopy target_acq aquisition niriss: soss spectroscopy target_acq aquisition nirspec: bots spectroscopy target_acq aquisition miri: lrsslitless spectroscopy mrs_ts spectroscopy target_acq aquisition | None |
Examples
>>> import gen_tso.pandeia_io as jwst
>>> pando = jwst.PandeiaCalculation('nircam')
>>> pando = jwst.PandeiaCalculation('nirspec')
>>> pando = jwst.PandeiaCalculation('nircam', 'target_acq')
Methods
Name | Description |
---|---|
calc_noise | Run a Pandeia calculation and extract the observed wavelength, |
get_configs | Print out or return the list of available configurations. |
get_saturation_values | Calculate the brightest-pixel rate (e-/s) and full_well (e-) |
get_scene | Get a flattened copy of the scene containing the SED and |
perform_calculation | Run pandeia’s perform_calculation() for the given configuration |
saturation_fraction | Estimate the number of groups below a given saturation fraction or |
set_scene | Set the stellar point-source scene to observe. |
show_config | Display a summary of the instrumental and scene configuration |
simulate_tso | Simulate a time-series observation spectrum with noise |
tso_calculation | Run pandeia to simulate a transit/eclipse time-series observation |
tso_print | Print to screen a summary of the latest tso_calculation() ran. |
wl_ranges | Get wavelength range covered by the instrument/mode |
calc_noise
pandeia_io.PandeiaCalculation.calc_noise(=None,
obs_dur=None,
ngroup=None,
disperserfilter=None,
=None,
subarray=None,
readout=None,
aperture=None,
nint )
Run a Pandeia calculation and extract the observed wavelength, flux, and variances.
Parameters
Name | Type | Description | Default |
---|---|---|---|
obs_dur | Duration of the observation. | None |
|
ngroup | Number of groups per integrations | None |
|
disperser | None |
||
filter | None |
||
subarray | None |
||
readout | None |
||
aperture | None |
Returns
Name | Type | Description |
---|---|---|
TBD |
Examples
>>> import gen_tso.pandeia_io as jwst
>>> instrument = 'nircam'
>>> mode = 'lw_tsgrism'
>>> pando = jwst.PandeiaCalculation(instrument, mode)
>>> pando.set_scene(
>>> sed_type='phoenix', sed_model='k5v',
>>> norm_band='2mass,ks', norm_magnitude=8.637,
>>> )
>>> # Example TBD
get_configs
=None) pandeia_io.PandeiaCalculation.get_configs(output
Print out or return the list of available configurations.
Parameters
Name | Type | Description | Default |
---|---|---|---|
output | The configuration variable to list. Select from: readouts, subarrays, filters, or dispersers. | None |
Returns
Name | Type | Description |
---|---|---|
outputs: 1D list of strings | The list of available inputs for the requested variable. |
get_saturation_values
pandeia_io.PandeiaCalculation.get_saturation_values(
disperser,filter,
subarray,
readout,=2,
ngroup=None,
aperture=None,
order=False,
get_max )
Calculate the brightest-pixel rate (e-/s) and full_well (e-) for the current instrument and scene configuration, which once known, are sufficient to calculate the saturation level once the saturation time is known.
Examples
>>> import gen_tso.pandeia_io as jwst
>>> instrument = 'nircam'
>>> mode = 'lw_tsgrism'
>>> pando = jwst.PandeiaCalculation(instrument, mode)
>>> pando.set_scene(
>>> sed_type='phoenix', sed_model='k2v',
>>> norm_band='2mass,ks', norm_magnitude=8.351,
>>> )
>>> brightest_pixel_rate, full_well = pando.get_saturation_values(
>>> disperser='grismr', filter='f444w',
>>> readout='rapid', subarray='subgrism64',
>>> )
>>> # Also works for Target Acquisition:
>>> instrument = 'nircam'
>>> mode = 'target_acq'
>>> pando = jwst.PandeiaCalculation(instrument, mode)
>>> pando.set_scene(
>>> sed_type='phoenix', sed_model='k5v',
>>> norm_band='2mass,ks', norm_magnitude=8.351,
>>> )
>>> brightest_pixel_rate, full_well = pando.get_saturation_values(
>>> disperser=None, filter='f335m',
>>> readout='rapid', subarray='sub32tats', ngroup=3,
>>> )
get_scene
pandeia_io.PandeiaCalculation.get_scene()
Get a flattened copy of the scene containing the SED and normalization properties.
Returns
Name | Type | Description |
---|---|---|
scene_args | Dictionary | Scene arguments. |
perform_calculation
pandeia_io.PandeiaCalculation.perform_calculation(
ngroup,
nint,=None,
disperserfilter=None,
=None,
subarray=None,
readout=None,
aperture=None,
order )
Run pandeia’s perform_calculation() for the given configuration (or set of configurations, see notes below).
Parameter
ngroup: Integer Number of groups per integration. Must be >= 2. nint: Integer Number of integrations. disperser: String Disperser/grating for the given instrument. filter: String Filter for the given instrument. subarray: String Subarray mode for the given instrument. readout: String Readout pattern mode for the given instrument. aperture: String Aperture configuration for the given instrument. order: Integer For NIRISS SOSS only, the spectral order. Other modes will ignore this argument.
Returns
Name | Type | Description |
---|---|---|
report | dict | The Pandeia’s report output for the given configuration. If there’s more than one requested calculation, return a list of reports. |
Notes
- Provide a list of values for any of these arguments to compute a batch of calculations.
- To leave a config parameter unmodified, leave the respective argument as None. To set a config parameter as None, set the argument to ’’.
saturation_fraction
pandeia_io.PandeiaCalculation.saturation_fraction(=None,
fraction=None,
ngroup=None,
flux_rate=None,
full_well )
Estimate the number of groups below a given saturation fraction or the saturation level for a given number of groups.
Parameters
Name | Type | Description | Default |
---|---|---|---|
fraction | If not None, estimate the maximum number of groups below the given saturation fraction (percentage units). | None |
|
ngroup | If not None, estimate the saturation fraction (%) for ngroup. | None |
|
flux_rate | e- per second rate at the brightest pixel. | None |
|
full_well | Number of e- counts to saturate the detector. | None |
Returns
Name | Type | Description |
---|---|---|
(if fraction argument is not None) | ||
ngroup | Integer | Maximum number of groups to remain below the saturation fraction |
(if ngroup argument is not None) | ||
sat_fraction | Float | Saturation level reached for given ngroup. |
Examples
>>> import gen_tso.pandeia_io as jwst
>>> instrument = 'nircam'
>>> mode = 'lw_tsgrism'
>>> pando = jwst.PandeiaCalculation(instrument, mode)
>>> pando = jwst.PandeiaCalculation('niriss', 'soss')
>>> pando.set_scene(
>>> sed_type='phoenix', sed_model='k5v',
>>> norm_band='2mass,ks', norm_magnitude=8.351,
>>> )
>>>
>>> # Get number of groups below 80% saturation:
>>> ngroup = pando.saturation_fraction(fraction=80.0)
>>> print(ngroup)
104
>>>
>>> # Get saturation fraction (%) for 96 groups:
>>> fraction = pando.saturation_fraction(ngroup=91)
>>> print(fraction)
69.3642895274301
set_scene
pandeia_io.PandeiaCalculation.set_scene(
sed_type,
sed_model,
norm_band,
norm_magnitude,='ecliptic_low',
background )
Set the stellar point-source scene to observe.
Parameters
Name | Type | Description | Default |
---|---|---|---|
sed_type | Type of model: ‘phoenix’, ‘k93models’, ‘blackbody’, or ‘flat’ | required | |
sed_model | The SED model required for each sed_type: - phoenix or k93models: the model key (see load_sed_list) - blackbody: the effective temperature (K) - flat: the unit (‘flam’ or ‘fnu’) | required | |
norm_band | Band over which to normalize the spectrum. | required | |
norm_magnitude | Magnitude of the star at norm_band. | required | |
background | Set the background flux. Select from: ‘ecliptic_low’, ‘ecliptic_medium’, ‘ecliptic_high’, ‘minzodi_low’, ‘minzodi_medium’, ‘minzodi_high’ | 'ecliptic_low' |
Examples
>>> import gen_tso.pandeia_io as jwst
>>> instrument = 'nircam'
>>> mode = 'lw_tsgrism'
>>> pando = jwst.PandeiaCalculation(instrument, mode)
>>> pando.set_scene(
>>> sed_type='phoenix', sed_model='k5v',
>>> norm_band='2mass,ks', norm_magnitude=8.637,
>>> )
show_config
pandeia_io.PandeiaCalculation.show_config()
Display a summary of the instrumental and scene configuration
simulate_tso
pandeia_io.PandeiaCalculation.simulate_tso(=1,
n_obs=None,
resolution=None,
bins=False,
noiseless )
Simulate a time-series observation spectrum with noise for the given number of observations and spectral sampling.
Parameters
Name | Type | Description | Default |
---|---|---|---|
TBD | required |
Returns
Name | Type | Description |
---|---|---|
TBD |
Examples
>>> TBD
tso_calculation
pandeia_io.PandeiaCalculation.tso_calculation(
obs_type,
transit_dur,
obs_dur,
depth_model,=None,
ngroup=None,
disperserfilter=None,
=None,
subarray=None,
readout=None,
aperture=None,
order )
Run pandeia to simulate a transit/eclipse time-series observation
Parameters
Name | Type | Description | Default |
---|---|---|---|
obs_type | The observing geometry ‘transit’ or ‘eclipse’. | required | |
transit_dur | Duration of the transit or eclipse event in hours. | required | |
obs_dur | Total duration of the observation (baseline plus transit or eclipse event) in hours. | required | |
depth_model | The transit or eclipse depth spectrum where the first item is the wavelength (um) and the second is the depth. | required | |
ngroup | Number of groups per integrations | None |
|
disperser | None |
||
filter | None |
||
subarray | None |
||
readout | None |
||
aperture | None |
||
order | None |
Returns
Name | Type | Description |
---|---|---|
tso | dict | A dictionary containing the time-series observation data: - wl: instrumental wavelength sampling (microns) - depth_spectrum: Transit/eclipse depth spectrum at instrumental wl - time_in: In-transit/eclipse measuring time (seconds) - flux_in: In-transit/eclipse flux (e-) - var_in: In-transit/eclipse variance - time_out: Out-of-transit/eclipse measuring time (seconds) - flux_out: Out-of-transit/eclipse flux (e-) - var_out: Out-of-transit/eclipse - report_in: In-transit/eclipse pandeia output report - report_out: Out-of-transit/eclipse pandeia output report |
Examples
>>> import gen_tso.pandeia_io as jwst
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> import pyratbay.constants as pc
>>>
>>> transit_dur = 2.131
>>> obs_dur = 6.01
>>> # Planet model: wl(um) and transit depth (no units):
>>> depth_model = np.loadtxt('WASP80b_transit.dat', unpack=True)
>>> # Set a NIRCam observation
>>> pando = jwst.PandeiaCalculation('nircam', 'lw_tsgrism')
>>> # The star:
>>> pando.set_scene(
>>> sed_type='phoenix', sed_model='k5v',
>>> norm_band='2mass,ks', norm_magnitude=8.351,
>>> )
>>> # Take a look at the default cofiguration:
>>> pando.calc['configuration']
>>>
>>> # Edit disperser, filter, readout, subarray, or aperture if needed
>>> # See options with pando.get_configs()
>>> ngroup = 90
>>> # Run TSO:
>>> obs_type = 'transit'
>>> tso = pando.tso_calculation(
>>> obs_type, transit_dur, obs_dur, depth_model, ngroup,
>>> )
>>>
>>> # Draw a simulated transit spectrum at selected resolution
>>> obs_wl, obs_depth, obs_error, band_widths = jwst.simulate_tso(
>>> tso, resolution=250.0,
>>> )
>>> plt.figure(4)
>>> plt.clf()
>>> plt.plot(
>>> tso['wl'], tso['depth_spectrum']/pc.percent,
>>> c='salmon', label='depth at instrumental resolution',
>>> )
>>> plt.errorbar(
>>> obs_wl, obs_depth/pc.percent, yerr=obs_error/pc.percent,
>>> fmt='o', ms=5, color='xkcd:blue', mfc=(1,1,1,0.85),
>>> label='simulated (noised up) transit spectrum',
>>> )
>>> plt.legend(loc='best')
>>> plt.xlim(3.6, 5.05)
>>> plt.ylim(2.88, 3.00)
>>> plt.xlabel('Wavelength (um)')
>>> plt.ylabel('Transit depth (%)')
>>> plt.title('WASP-80 b / NIRCam F444W')
>>>
>>> # Fluxes and Flux rates
>>> col1, col2 = plt.cm.viridis(0.8), plt.cm.viridis(0.25)
>>> plt.figure(0, (8.5, 4))
>>> plt.clf()
>>> plt.subplot(121)
>>> plt.plot(tso['wl'], tso['flux_out'], c=col2, label='out of transit')
>>> plt.plot(tso['wl'], tso['flux_in'], c=col1, label='in transit')
>>> plt.legend(loc='best')
>>> plt.xlabel('Wavelength (um)')
>>> plt.ylabel('Total collected flux (e-)')
>>> plt.subplot(122)
>>> plt.plot(tso['wl'], tso['flux_out']/tso['time_out'], c=col2, label='out of transit')
>>> plt.plot(tso['wl'], tso['flux_in']/tso['time_in'], c=col1, label='in transit')
>>> plt.legend(loc='best')
>>> plt.xlabel('Wavelength (um)')
>>> plt.ylabel('Flux rate (e-/s)')
>>> plt.tight_layout()
tso_print
format='rich') pandeia_io.PandeiaCalculation.tso_print(
Print to screen a summary of the latest tso_calculation() ran.
Parameters
Name | Type | Description | Default |
---|---|---|---|
format | If ‘rich’ print with colourful text when there are warnings or errors in values. If None, print as plain text. | 'rich' |
Examples
>>> import gen_tso.pandeia_io as jwst
>>> import numpy as np
>>> wl = np.logspace(0, 2, 1000)
>>> depth = [wl, np.tile(0.03, len(wl))]
>>> pando = jwst.PandeiaCalculation('nircam', 'lw_tsgrism')
>>> pando.set_scene('phoenix', 'k5v', '2mass,ks', 8.351)
>>> tso = pando.tso_calculation(
>>> 'transit', transit_dur=2.1, obs_dur=6.0, depth_model=depth,
>>> ngroup=130, readout='rapid', filter='f444w',
>>> )
>>> pando.tso_print()
wl_ranges
pandeia_io.PandeiaCalculation.wl_ranges()
Get wavelength range covered by the instrument/mode