pandeia_io.simulate_tso

pandeia_io.simulate_tso(
    tso,
    n_obs=1,
    resolution=None,
    bins=None,
    noiseless=False,
)

Given a TSO dict from a pandeia TSO run, simulate a transit/eclipse spectrum scaling the noise by the number of observations and resampling over wavelength.

Parameters

Name Type Description Default
tso required
n_obs Number of transit/eclipse observations 1
resolution If not None, resample the spectrum at the given resolution. None
bins If not None, bin the spectrum in between the edges given by this array. None
noiseless If True, do not add scatter noise to the spectrum. False

Returns

Name Type Description
bin_wl 1D array
bin_spec 1D array
bin_err 1D array
bin_widths 1D array

Examples

>>> import gen_tso.pandeia_io as jwst
>>> import matplotlib.pyplot as plt
>>> scene = jwst.make_scene(
>>>     sed_type='phoenix', sed_model='k5v',
>>>     norm_band='2mass,ks', norm_magnitude=8.637,
>>> )
>>> # With NIRSpec
>>> pando = jwst.PandeiaCalculation('nirspec', 'bots')
>>> pando.calc['scene'] = [scene]
>>> disperser='g395h'
>>> filter='f290lp'
>>> readout='nrsrapid'
>>> subarray='sub2048'
>>> ngroup = 16
>>> transit_dur = 2.71
>>> obs_dur = 6.0
>>> obs_type = 'transit'
>>> depth_model = np.loadtxt(
>>>     '../planet_spectra/WASP80b_transit.dat', unpack=True)
>>> tso = pando.tso_calculation(
>>>     obs_type, transit_dur, obs_dur, depth_model,
>>>     ngroup, disperser, filter, subarray, readout,
>>> )
>>> bin_wl, bin_spec, bin_err, bin_widths = jwst.simulate_tso(
>>>    tso, n_obs=1, resolution=300.0, noiseless=False,
>>> )
>>> plt.figure(10)
>>> plt.clf()
>>> plt.plot(depth_model[0], depth_model[1], c='orange')
>>> plt.plot(tso['wl'], tso['depth_spectrum'], c='orangered')
>>> plt.errorbar(bin_wl, bin_spec, bin_err, fmt='ok', ms=4, mfc='w')
>>> plt.xlim(2.8, 5.3)
Back to top