Beispiel #1
0
def make_snr_spectrum():
    ### 

    bp_k = S.ObsBandpass('johnson,k')
    sp = pynrc.stellar_spectrum('K0V',5.541,'vegamag',bp_k,)

    nrc = pynrc.NIRCam('F322W2', pupil='GRISM0', ngroup=3, nint=100, read_mode='RAPID',
                      wind_mode='STRIPE',xpix=2048,ypix=64)
    det = nrc.Detectors[0]
    wave, psfImg = nrc.gen_psf(sp=sp)
    oneDSpec = np.sum(psfImg,axis=0)
    pix_noise = det.pixel_noise(fsrc=psfImg,fzodi=nrc.bg_zodi(zfact=1.0))
    varImg = pix_noise**2
    SNR = np.sum(psfImg) / np.sqrt(np.sum(varImg))
    print(' Broadband noise (ppm) = {0}'.format(1e6/SNR))
    
    ## SNR spectrum
    SNRSpec = np.sum(psfImg,axis=0) / np.sqrt(np.sum(varImg,axis=0))
    tSpec = Table()
    tSpec['wave'] = wave
    tSpec['sigma_ppm'] = 1e6/SNRSpec
    
    keepWave = (tSpec['wave'] > 2.4) & (tSpec['wave'] <= 4.02)
    tSpec2 = tSpec[keepWave]
    
    tSpec2.meta = {'filter':'F322W2W','TEXP':det.time_total}
    tSpec2.write('data/instrument/snr_spec_f322w2.fits',overwrite=True)
    tSpec2.write('data/instrument/snr_spec_f322w2.csv',overwrite=True)
    
    fig, ax = plt.subplots()
    
    plt.plot(tSpec2['wave'],tSpec2['sigma_ppm'])
    plt.ylim(300,900)
    
    fig.savefig('data/instrument/snr_spectrum.pdf')
Beispiel #2
0
# Define 2MASS Ks bandpass and source information
bp_k = pynrc.bp_2mass('k')

# Solar analog at 10pc
# https://iopscience.iop.org/article/10.3847/1538-4365/aabfdf#apjsaabfdft3
# Science      source,  dist, age, sptype, Teff, [Fe/H], log_g, mag, band
args_sources = ('G2V', 10.0, 100,  'G2V', 5777, 0, 4.43, 3.27, bp_k)
# References     source,  sptype, Teff, [Fe/H], log_g, mag, band
ref_sources = ('G2V Ref', 'G2V', 5777, 0, 4.43, 3.27, bp_k)

# Get science spectrum
name_sci, dist_sci, age, spt_sci, Teff_sci, feh_sci, logg_sci, mag_sci, bp_sci = args_sources
args = (spt_sci, mag_sci, 'vegamag', bp_sci)
kwargs = {'Teff':Teff_sci, 'metallicity':feh_sci, 'log_g':logg_sci}
sp_sci = pynrc.stellar_spectrum(*args, **kwargs)
sp_sci.name = name_sci

# Do the same for the reference source
name_ref, spt_ref, Teff_ref, feh_ref, logg_ref, mag_ref, bp_ref = ref_sources
args = (spt_ref, mag_ref, 'vegamag', bp_ref)
kwargs = {'Teff':Teff_ref, 'metallicity':feh_ref, 'log_g':logg_ref}
sp_ref = pynrc.stellar_spectrum(*args, **kwargs)
sp_ref.name = name_ref

# Load OPD and other information
tvals_sec = fits.getdata(opd_dir + 'time_vector.fits') * 60

# Static OPDs
hdul_opds_static = OPDFile_to_HDUList(opd_dir + 'STATIC_NIRCAM-A_INPUT.fits')
Beispiel #3
0
                            wind_mode='STRIPE',
                            xpix=2048,
                            ypix=256,
                            read_mode='BRIGHT1')

    print('Allocated LW NRC instance for {} & {}'.format(oneFilt, nGROUP))

    # Specify name of output file.
    # Time stamps will be automatically inserted for unique file names.
    bpJ = S.ObsBandpass('johnson,j')

    print('Allocated Normalization Bandwidth: J-band')

    stellarType = 'K7V'
    Jmag = 9.2
    sp = pynrc.stellar_spectrum(stellarType, Jmag, 'vegamag', bpJ)

    print('Allocated Stellar spectrum with SType: {} and Jmag: {}'.format(
        stellarType, Jmag))

    file_out = 'sim_img/grism/NRCALONG_' + oneFilt + '_'
    file_outWL = 'sim_img/grism/NRCA1_' + oneFilt + '_'

    print('Assigned SW file out as {}'.format(file_outWL))
    print('Assigned LW file out as {}'.format(file_out))

    print('Generating SW Exposure')
    res_wl = nrcWL.gen_exposures(sp, file_outWL)

    print('Generating LW Exposure')
    res_sp = nrcGrism.gen_exposures(sp, file_out)
Beispiel #4
0
import pynrc
pynrc.setup_logging('WARN', verbose=False)
from pynrc.nrc_utils import S

oneFilt = 'F444W'
nGROUP = 12
nINT = 666
# Initialize a NIRCam Grism observation in Stripe mode 
nrc = pynrc.NIRCam(oneFilt, pupil='GRISM0', module='A', nint=nINT,ngroup=nGROUP,
                   wind_mode='STRIPE', xpix=2048, ypix=256,read_mode='BRIGHT1')

nrcWL = pynrc.NIRCam('F210M', pupil='Weak Lens +8', module='A', nint=nINT,ngroup=nGROUP,
                     wind_mode='STRIPE', xpix=2048, ypix=256)
# Specify name of output file.
# Time stamps will be automatically inserted for unique file names.
bpJ = S.ObsBandpass('johnson,j')
sp = pynrc.stellar_spectrum('K7V', 9.2, 'vegamag', bpJ)
file_out = 'sim_img/grism/NRCALONG_'+oneFilt+'_'
file_outWL = 'sim_img/grism/NRCA1_'+oneFilt+'_'
res_sp = nrc.gen_exposures(sp, file_out,targ_name='WASP-80')
res_wl = nrcWL.gen_exposures(sp, file_outWL,targ_name='WASP-80')
import pynrc
pynrc.setup_logging('WARN', verbose=False)
from pynrc.nrc_utils import S

# Initialize a NIRCam Grism observation in Stripe mode 
for oneFilt in ['F210M','F300M']:
    nrc = pynrc.NIRCam(oneFilt, pupil=None, module='B', nint=4,ngroup=3,
                       wind_mode='WINDOW', xpix=64, ypix=64,read_mode='RAPID')

    bpJ = S.ObsBandpass('johnson,j')
    sp = pynrc.stellar_spectrum('F7V', 9.3, 'vegamag', bpJ)
    thisDetector = nrc.Detectors[0]
    file_out = 'sim_img/direct_imaging/'+thisDetector.detname
    # Specify name of output file.
    # Time stamps will be automatically inserted for unique file names.
    res_sp = nrc.gen_exposures(sp, file_out,targ_name='WASP-62')