Optimize ngroup and saturation level
This Python script shows how to
- optimize the number of groups given a target saturation fraction, and
- estimate the saturation fraction for a given number of groups.
0. Setup
Lets set up a target and instrument observation first:
import gen_tso.pandeia_io as jwst
import gen_tso.catalogs as cat
# Find a suitable stellar SED model for a WASP-80b transit:
= cat.Catalog()
catalog = catalog.get_target('WASP-80 b')
target = jwst.find_closest_sed(target.teff, target.logg_star, sed_type='phoenix')
sed
# Initialize the instrument and set the scene:
= jwst.PandeiaCalculation('nirspec', 'bots')
pando
pando.set_scene(='phoenix', sed_model=sed,
sed_type='2mass,ks', norm_magnitude=target.ks_mag,
norm_band )
Now lets take a look at the current cofiguration:
print(
"The SED:\n"
f" Teff = {target.teff}\n"
f" log_g = {target.logg_star}\n"
f" SED = {sed}\n"
) pando.show_config()
Which returns:
The SED:
Teff = 4143.0
log_g = 4.66
SED = k5v
Instrument configuration:
instrument = 'nirspec'
mode = 'bots'
aperture = 's1600a1'
disperser = 'g395h'
filter = 'f290lp'
readout pattern = 'nrsrapid'
subarray = 'sub2048'
Scene configuration:
sed_type = 'phoenix'
key = 'k5v'
normalization = 'photsys'
bandpass = '2mass,ks'
norm_flux = 8.351
norm_fluxunit = 'vegamag'
1. Optimize ngroup
Once setup an instrument configuration and an SED, the optimal number of groups below a saturation level can be computed with the following method:
= pando.saturation_fraction(fraction=70.0)
ngroup_max print(f'ngroup below 70% saturation: {ngroup_max}')
ngroup below 70% saturation: 12
Note
Saturation levels can be instantly computed for any PHOENIX or Kurucz (k93models) SED models and the Ks band for normalization and for most spectroscopic instrument modes. For other combinations, users will need to calculate the flux rate first:
= pando.perform_calculation(ngroup=2, nint=1)
result = jwst.saturation_level(result)
flux_rate, full_well = pando.saturation_fraction(
ngroup =70.0,
fraction=flux_rate, full_well=full_well,
flux_rate )
2. Estimate saturation level
Use the same method to estimate the saturation level, this time providing the number of groups:
= pando.saturation_fraction(ngroup=14)
saturation print(f'saturation level for 14 groups: {saturation:.2f}')
saturation level for 14 groups: 77.24