Beispiel #1
0
def get_unoccult_perf_psf(plot=False, hyperFile='/IntHyperUnOccult.pkl'):
    import copy
    tp_orig = copy.copy(tp)
    ap_orig = copy.copy(ap)
    iop_orig = copy.copy(iop)

    tp.detector = 'ideal'
    ap.companion = False
    # tp.NCPA_type = 'Wave'

    iop.hyperFile = iop.datadir + '/perfIntHyperUnOccult.pkl'
    tp.occulter_type = 'None'
    num_exp = 1
    ap.exposure_time = 0.001  # 0.001
    ap.numframes = int(num_exp * ap.exposure_time / cp.frame_time)
    tp.use_atmos = False
    tp.nwsamp = 1
    tp.CPA_type = None#'Quasi'# None
    tp.NCPA_type = None#'Wave'# #None
    tp.aber_params = {'CPA': False,
                        'NCPA': False,
                        'QuasiStatic': False,  # or 'Static'
                        'Phase': False,
                        'Amp': False,
                        'n_surfs': 2}
    # Yup this is 'if' is necessary
    hypercube = read.get_integ_hypercube()
    # PSF = hypercube[0,0]
    PSF = (read.take_exposure(hypercube))[0,0]
    if plot:
        quicklook_im(PSF)

    tp.__dict__ = tp_orig.__dict__
    ap.__dict__ = ap_orig.__dict__
    iop.__dict__ = iop_orig.__dict__
    # # print tp.occulter_type

    return PSF
Beispiel #2
0
    SSD_maps = np.array(SSD_maps)[:-1]
    # # SSD_maps[:2] /= star_phot
    # # SSD_maps[2] /= SSD_starphot
    # SSD_maps #/= star_phot

    #vmins = [2e-11, 2e-8, 1e-12], vmaxs = [5e-7, 1.5e-7, 1e-6]
    indep_images(
        SSD_maps,
        logAmp=True,
        titles=[r'  $I_C / I^{*}$', r'  $I_S / I^{*}$', r'  $I_r / I^{*}$'],
        annos=['Deterministic', 'Random', 'Beam Ratio'])

    print 'here'
    # quicklook_im(bunch_hypercube[0,0])
    ap.exposure_time = 1
    stacked = read.take_exposure(bunch_hypercube)
    quicklook_im(stacked[0, 0])

    from statsmodels.tsa.stattools import acovf, acf, ccf

    mask = Analysis.phot.aperture(64, 64, 1)
    aper_idx = np.where(mask)
    print aper_idx
    # quicklook_im(mask)

    star_corr = 0
    # for x, y in np.transpose(aper_idx):
    #     # for y in aper_idx[0]:
    #     print x, y
    #     corr, ljb, pvalue = acf(bunch_hypercube[:, 0, x, y], unbiased=False, qstat=True, nlags=len(range(5000)))
    #     # plt.plot(range(4999), corr[:-1])
Beispiel #3
0
readnoises = [0.1, 1, 5, 10, 30]
for rn in [50]:  #readnoises:
    #  ++++++++ H2RG - Full Obs ++++++
    iop.hyperFile = iop.datadir + '/nocompnorm_BinH2RG_with_coron_hyper_%i.pkl' % rn
    tp.occulter_type = 'Gaussian'
    tp.nwsamp = 10
    hp.readnoise = rn
    if __name__ == '__main__':
        hypercube = read.get_integ_hypercube(plot=False)
        # view_datacube(hypercube[0], logAmp=True)
        wsamples = np.linspace(tp.band[0], tp.band[1], tp.nwsamp)
        scale_list = tp.band[0] / wsamples
        print scale_list
        algo_dict = {'scale_list': scale_list}
        # datacube = hypercube[0]
        datacube = (read.take_exposure(hypercube) / ap.numframes)[0]
        # star_phots = star_phot
        angle_list = np.zeros((len(hypercube[0])))
        print datacube.shape
        method_out = eval_method(datacube, pca.pca, angle_list, algo_dict)
        plotdata.append(method_out[0])
        maps.append(method_out[1])
        # quicklook_im(method_out[1])
    # +++++++++++++++++++++++++++++++
    # *********************************************************

# if __name__ == "__main__":
#     plotdata = np.array(plotdata)
#     rad_samp = np.linspace(0,tp.platescale/1000.*plotdata.shape[2],plotdata.shape[2])
#     fig, axes = plt.subplots(nrows=1, ncols=3, figsize=(14, 3.4))
#     for thruput in plotdata[:,0]:
Beispiel #4
0
    wsamples = np.linspace(tp.band[0], tp.band[1], tp.w_bins)
    scale_list = wsamples/(tp.band[1]-tp.band[0])
    scale_list = scale_list#[::-1]
    algo_dict = {'scale_list': scale_list}

    ap.exposure_time = 0.1  # 0.001

    ap.numframes = int(num_exp * ap.exposure_time / cp.frame_time)
    iop.hyperFile = iop.datadir + 'HR8799_phot_tag%i_tar_%i.h5' % (ap.numframes, np.log10(ap.star_photons))
    dprint(iop.hyperFile)
    orig_hyper = read.get_integ_hypercube(plot=False)[:, :]

    # fast_hyper = fast_hyper[:100]
    # ap.numframes = int(100 * ap.exposure_time / cp.frame_time)
    # dprint(fast_hyper.shape)
    fast_hyper = read.take_exposure(orig_hyper)
    ap.exposure_time = 1  # 0.001
    med_hyper = read.take_exposure(orig_hyper)
    ap.exposure_time = 10#1.0  # 0.001
    slow_hyper = read.take_exposure(orig_hyper)
    ap.exposure_time = 100#1.0  # 0.001
    v_slow_hyper = read.take_exposure(orig_hyper)

    # this is crucial for the PCA
    fast_hyper /= np.sum(fast_hyper) # /ap.numframes
    med_hyper /= np.sum(med_hyper) # /ap.numframes
    slow_hyper /= np.sum(slow_hyper) # /ap.numframes
    # v_slow_hyper /= np.sum(v_slow_hyper) # /ap.numframes

    fast_hyper = np.transpose(fast_hyper, (1, 0, 2, 3))
    med_hyper = np.transpose(med_hyper, (1, 0, 2, 3))
Beispiel #5
0
tp.detector = 'H2RG'  #''MKIDs'#
sp.save_obs = False
sp.show_wframe = False  #True#'continuous'
if sp.show_wframe == 'continuous':
    sp.fig = plt.figure()

sp.show_cube = False
sp.return_cube = True
tp.nwsamp = 4
# tp.use_atmos = True # have to for now because ao wfs reads in map produced but not neccessary
# tp.use_ao = True
# tp.active_null=False
# tp.satelite_speck = True
# tp.speck_locs = [[40,40]]
# ap.frame_time = 0.001
num_exp = 25
ap.exposure_time = 0.01
ap.numframes = int(num_exp * ap.exposure_time / cp.frame_time)
sp.num_processes = 1
if __name__ == '__main__':
    hypercube = run()
    print np.shape(hypercube)
    hypercube = read.take_exposure(hypercube)
    print np.shape(hypercube[0, 3]), np.shape(hypercube)
    loop_frames(hypercube[:, 0])
    plt.close()
    loop_frames(hypercube[0])
    plt.show()
    loop_frames(hypercube[:, 0])
    plt.show()
Beispiel #6
0
    for R in np.round(R_sigs):
        # for R in [51]:
        mp.R_sig = R
        iop.hyperFile = iop.datadir + '/SDIHyper_C1e5_Rsig%i_5w_5.h5' % R
        iop.device_params = iop.datadir + '/deviceParams_Rsig%i_5w_5.pkl' % R
        wsamples = np.linspace(tp.band[0], tp.band[1], tp.nwsamp)
        scale_list = tp.band[0] / wsamples
        # print tp.nwsamp
        SDI_hypercube = read.get_integ_hypercube(plot=False)
        # print SDI_hypercube.shape
        noncor_frames = np.zeros((10, 128, 128))
        thruputs = np.zeros((10, 41))
        for t in range(10):
            ap.exposure_time = 0.1  #1.
            datacube = read.take_exposure(
                SDI_hypercube[t * 100:(t + 1) * 100]) / (ap.numframes / 10)
            # view_datacube(datacube[0])
            # datacube = read.med_collapse(SDI_hypercube)
            # dprint(datacube.shape)
            # loop_frames(SDI_hypercube[0])
            # loop_frames(SDI_hypercube[:,0])
            # loop_frames(datacube[0], logAmp=False)
            # view_datacube(datacube[0], logAmp=False)
            # ap.exposure_time = 0.005
            ap.exposure_time = 0.001
            # loop_frames(datacube[0])
            algo_dict = {'scale_list': scale_list[::-1]}
            # star_phots = star_phot

            angle_list = np.zeros((len(SDI_hypercube[0])))
            method_out = eval_method(datacube[0], pca.pca, angle_list,