Example #1
0
def calc_star_stats():
    util.mkdir(stats_dir)

    for key in dict_suffix.keys():

        img = dict_images[key]
        suf = dict_suffix[key]

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Catalog: ', img)

        img_files = [
            out_dir +
            'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf)
            for ii in img
        ]
        stats_file = stats_dir + 'stats_' + key + '.fits'

        redu.calc_star_stats(img_files, output_stats=stats_file)
        moffat.fit_moffat(img_files, stats_file, flux_percent=0.2)

        # stats1 = table.Table.read(stats_file)
        # redu.add_frame_number_column(stats1)
        # stats1.write(stats_file, overwrite=True)

        # stats_file_mdp = stats_file.replace('.fits', '_mdp.fits')
        # stats2 = table.Table.read(stats_file_mdp)
        # redu.add_frame_number_column(stats1)
        # stats2.write(stats_file_mdp, overwrite=True)

    return
Example #2
0
def calc_star_stats():
    util.mkdir(stats_dir)
    
    ## Loop through all the different data sets
    #for key in ['set_name']: ## Single key setup
    #for key in ['open_IVBR', 'LS_IVBR', 'docz_IVBR']:
    #for key in []:
    for key in dict_suffix.keys():
        
        img = dict_images[key]
        suf = dict_suffix[key]

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Catalog: ', img)
        
        img_files = [out_dir + 'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf) for ii in img]
        stats_file = stats_dir + 'stats_' + key + '.fits'

        redu.calc_star_stats(img_files, output_stats=stats_file)
        moffat.fit_moffat(img_files, stats_file, flux_percent=0.2)

    ## DEBUG - single threaded
    #key_i = 'open_BRIV'
    #fmt = '{dir}sta{img:03d}{suf:s}_scan_clean.fits'
    #image_file = fmt.format(dir=out_dir, img=dict_images[key_i][0], suf=dict_suffix[key_i]) 
    #stats_file = f'{stats_dir}stats_{key_i}.fits'
    #redu.calc_star_stats([image_file], output_stats=stats_file)
    #moffat.fit_moffat_single(image_file,image_file.replace('.fits', '_stars_stats.fits'), 0.2)

        
    return
Example #3
0
def analyze_4F_stacks():
    ## Loop through all the different data sets
    #for key in ['set_name']: ## Single key setup
    all_images = []
    all_starlists = []

    for key in dict_suffix.keys():
        img = dict_images[key]
        suf = dict_suffix[key]
        odr = dict_filt[key]

        if odr != 'I':
            all_images += [
                stacks_dir + f'fld2_stack_{suf}_{odr}.fits' for f in filters
            ]
            all_starlists += [
                stacks_dir + f'4F/fld2_stack_{suf}_{odr}_{f}_{odr}_stars.txt'
                for f in filters
            ]  # unfortunate naming error

    stats_file = stats_dir + 'stats_stacks.fits'
    starlist_stats = [
        strlst.replace('_stars.txt', '_stars_stats.fits')
        for strlst in all_starlists
    ]
    ## Calc stats on all the stacked images
    #redu.calc_star_stats(all_images, output_stats=stats_file, starlists=all_starlists, fourfilt=True)
    print("Starting moffat fitting")
    moffat.fit_moffat(all_images,
                      stats_file,
                      starlists=starlist_stats,
                      flux_percent=0.2)

    return
Example #4
0
def analyze_stacks():
    # Loop through all the different data sets and reduce them.
    all_images = []
    for key in dict_suffix.keys():
        img = dict_images[key]
        suf = dict_suffix[key]
        fwhm = dict_fwhm[key]

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Images: ', img)
        print('     Fwhm: ', str(fwhm))

        image_file = [stacks_dir + 'beehive_stack_' + suf + '.fits']
        all_images.append(image_file[0])
        
        reduce_fli.find_stars(image_file, fwhm=fwhm, threshold=3, N_passes=2, plot_psf_compare=False,
                              mask_file=calib_dir + 'mask.fits')

    # Calc stats on all the stacked images
    out_stats_file = stats_dir + 'stats_stacks.fits'
    reduce_fli.calc_star_stats(all_images, output_stats=out_stats_file)
    moffat.fit_moffat(all_images, out_stats_file, flux_percent=0.2)

    # DEBUG - single threaded
    # image_file = stacks_dir + 'beehive_stack_' + dict_suffix['open'] + '.fits'
    # redu.find_stars_single(image_file, dict_fwhm['open'], 3, 2, False, calib_dir + 'mask.fits')        

    return
Example #5
0
def calc_star_stats():
    util.mkdir(stats_dir)

    ## Loop through all the different data sets
    #for key in ['set_name']: ## Single key setup
    for key in dict_suffix.keys():

        img = dict_images[key]
        suf = dict_suffix[key]

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Catalog: ', img)

        img_files = [
            out_dir +
            'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf)
            for ii in img
        ]
        stats_file = stats_dir + 'stats_' + key + '.fits'

        redu.calc_star_stats(img_files, output_stats=stats_file)
        moffat.fit_moffat(img_files, stats_file, flux_percent=0.2)

    ## DEBUG - single threaded
    # fmt = '{dir}sta{img:03d}{suf:s}_scan_clean.fits'
    # image_file = fmt.format(dir=out_dir, img=dict_images['LS_c'][0], suf=dict_suffix['LS_c'][0])
    # stats_file = stats_dir + 'stats_LS_c.fits'
    # redu.calc_star_stats(image_file, stats_file, flux_percent=0.2)

    return
Example #6
0
def calc_fourfilt_stats():   
    # Getting unique suffixes (loop states):
    suffixes = list(set(dict_suffix_rot.values()))
    
    # Grouping by suffixes 
    for suf in suffixes:
        # keys with given suffix
        keys = [key for key in dict_suffix_rot.keys() if dict_suffix_rot[key] == suf]
        
        # Iterating through filters
        for f in filters:
            stats_file = stats_dir + f'stats_{suf}_{f}.fits'
            img_files = []
            starlists = []
            
            for key in keys:
                img = dict_images_rot[key]
                odr = dict_orders_rot[key]
                
                img_files += [out_dir + 'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf) for ii in img]
                starlists += [out_dir + 'sta{img:03d}{suf:s}_scan_clean_{f:s}_{odr:s}_stars.txt'.format(img=ii, suf=suf, f=f, odr=odr) for ii in img]
            reduce_fli.calc_star_stats(img_files, output_stats=stats_file, starlists=starlists, fourfilt=True)
            print("Starting moffat fitting")
            moffat.fit_moffat(img_files, stats_file, starlists=starlists)
            
            ## SINGLE THREAD
            # reduce_fli.calc_star_stats_single(img_files[0], starlists[0], True)
    
    return
Example #7
0
def calc_4F_stats():
    # Getting unique suffixes (loop states):
    suffixes = list(set(dict_suffix_rot.values()))
    
    # Grouping by suffixes 
    for suf in suffixes:
        # keys with given suffix
        keys = [key for key in dict_suffix_rot.keys() if dict_suffix_rot[key] == suf]
        
        # Iterating through filters
        for f in filters:
            stats_file = stats_dir + f'stats_{suf}_{f}.fits'
            img_files = []
            starlists = []
            
            for key in keys:
                img = dict_images_rot[key]
                odr = dict_orders_rot[key]
                
                img_files += [out_dir + 'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf) for ii in img]
                starlists += [out_dir + '4F/sta{img:03d}{suf:s}_scan_clean_{f:s}_{odr:s}_stars.txt'.format(img=ii, suf=suf, f=f, odr=odr) for ii in img]
            starlist_stats = [strlst.replace('_stars.txt', '_stars_stats.fits') for strlst in starlists]
            print(f"Calc Star_Stats: {suf} \n Filter: {f}")
            redu.calc_star_stats(img_files, output_stats=stats_file, starlists=starlists, fourfilt=True)
            print("Starting moffat fitting")
            moffat.fit_moffat(img_files, stats_file, starlists=starlist_stats)
            
            ## DEBBUG: SINGLE THREAD
            #print("stars: ", starlists[0])
            #print("stats: ", stats_file)
            #redu.calc_star_stats_single(img_files[0], starlists[0], True)
            #moffat.fit_moffat_single(img_files[0], starlist_stats[0], 0.2)
            #break
        #break 
    return
Example #8
0
def analyze_stacks():
    ## Loop through all the different data sets
    #for key in ['set_name']: ## Single key setup
    all_images = []
    for key in dict_suffix.keys():
        img = dict_images[key]
        suf = dict_suffix[key]
        
        # o/c loop distinction
        fwhm = 15 if re.search('open', key) else 8
        thrsh = 5 if re.search('open', key) else 6

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Images: ', img)
        print('     Fwhm: ', str(fwhm))
        print('    thrsh: ', str(thrsh))

        image_file = [stacks_dir + 'beehive_stack_' + suf + '.fits']
        all_images.append(image_file[0])
        
        redu.find_stars(image_file, fwhm=fwhm, threshold=thrsh, N_passes=2, plot_psf_compare=False,
                              mask_file=calib_dir + 'domemask.fits')

    ## Calc stats on all the stacked images
    out_stats_file = stats_dir + 'stats_stacks.fits'
    redu.calc_star_stats(all_images, output_stats=out_stats_file)
    moffat.fit_moffat(all_images, out_stats_file, flux_percent=0.2)

    ## DEBUG - single threaded
    # image_file = stacks_dir + 'fld2_stack_' + dict_suffix['open'] + '.fits'
    # redu.find_stars_single(image_file, dict_fwhm['open'], 3, 2, False, calib_dir + 'mask.fits')        

    return
Example #9
0
def calc_star_stats():
    util.mkdir(stats_dir)

    ## Loop through all datasets
    for key in dict_suffix.keys():

        img = dict_images[key]
        suf = dict_suffix[key]
        bin = 'bin1' if 'bin1' in key else 'bin2'  # key should contain bin info

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Catalog: ', img)

        img_files = [
            out_dir +
            'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf)
            for ii in img
        ]
        stats_file = stats_dir + 'stats_' + key + '.fits'
        redu.calc_star_stats(img_files, output_stats=stats_file)
        moffat.fit_moffat(img_files, stats_file, flux_percent=0.2)

    # DEBUG - single threaded
    # fmt = '{dir}sta{img:03d}{suf:s}_scan_clean.fits'
    # image_file = fmt.format(dir=out_dir, img=dict_images['LS_c'][0], suf=dict_suffix['LS_c'][0])
    # stats_file = stats_dir + 'stats_LS_c.fits'
    # redu.calc_star_stats(image_file, stats_file, flux_percent=0.2)

    return
Example #10
0
def calc_mof_stats():

    # Open Loop
    stats_file = stats_dir + 'stats_open.fits'
    img_files = [
        out_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum_o
    ]
    moffat.fit_moffat(img_files, stats_file)

    # Closed Loop - 3S
    stats_file = stats_dir + 'stats_closed_threeWFS_LS.fits'
    img_files = [
        out_dir + 'obj{0:04d}_threeWFS_LS_clean.fits'.format(ii)
        for ii in fnum_threeWFS_LS
    ]
    moffat.fit_moffat(img_files, stats_file)

    # Closed Loop - 3L
    stats_file = stats_dir + 'stats_closed_threeWFSLS_B2_c.fits'
    img_files = [
        out_dir + 'obj{0:04d}_threeWFSLS_B2_c_clean.fits'.format(ii)
        for ii in fnum_threeWFSLS_B2_c
    ]
    moffat.fit_moffat(img_files, stats_file)

    # Closed Loop - 4
    stats_file = stats_dir + 'stats_closed_threeWFSMean_B2_c.fits'
    img_files = [
        out_dir + 'obj{0:04d}_threeWFSMean_B2_c_clean.fits'.format(ii)
        for ii in fnum_threeWFSMean_B2_c
    ]
    moffat.fit_moffat(img_files, stats_file)

    return
Example #11
0
def calc_mof_stats():

    # Open Loop
    stats_file = stats_dir + 'stats_open.fits'
    img_files = [
        out_dir + 'obj{0:04d}_o_clean.fits'.format(ii)
        for ii in fnum_o_30 + fnum_o_60
    ]
    moffat.fit_moffat(img_files, stats_file)

    # Closed Loop - 3S
    stats_file = stats_dir + 'stats_closed_3WFS_S.fits'
    img_files = [
        out_dir + 'obj{0:04d}_threewfs_small_c_clean.fits'.format(ii)
        for ii in fnum_c_3S_30 + fnum_c_3S_60
    ]
    moffat.fit_moffat(img_files, stats_file)

    # Closed Loop - 3L
    stats_file = stats_dir + 'stats_closed_3WFS_L.fits'
    img_files = [
        out_dir + 'obj{0:04d}_threeWFS_big_c_clean.fits'.format(ii)
        for ii in fnum_c_3L_30 + fnum_c_3L_60
    ]
    moffat.fit_moffat(img_files, stats_file)

    # Closed Loop - 4
    stats_file = stats_dir + 'stats_closed_4WFS.fits'
    img_files = [
        out_dir + 'obj{0:04d}_fourWFS_c_clean.fits'.format(ii)
        for ii in fnum_c_4_30 + fnum_c_4_60
    ]
    moffat.fit_moffat(img_files, stats_file)

    return
Example #12
0
def calc_mof_stats():

    # Open Loop
    stats_file = stats_dir + 'stats_open.fits'
    img_files = [
        data_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum_o
    ]
    moffat.fit_moffat(img_files, stats_file)

    # Closed Loop
    stats_file = stats_dir + 'stats_closed.fits'
    img_files = [
        data_dir + 'obj{0:04d}_c_clean.fits'.format(ii) for ii in fnum_c
    ]
    moffat.fit_moffat(img_files, stats_file)
Example #13
0
def calc_moffat():
    
    reduce_dir = root_dir + 'reduce/pleiades/'
    stats_dir = root_dir + 'reduce/stats/'
    
    #open loop
    fnum = np.arange(57, 67)
    img_files = [reduce_dir + 'obj{0:03d}_clean.fits'.format(ii) for ii in fnum]
    moffat.fit_moffat(img_files, stats_dir + 'stats_open_mdp_alt.fits', x_guess=6, y_guess=8, flux_percent=0.5)

    #closed loop
    fnum = np.arange(47, 57)
    img_files = [reduce_dir + 'obj{0:03d}_clean.fits'.format(ii) for ii in fnum]
    moffat.fit_moffat(img_files, stats_dir + 'stats_closed_mdp_alt.fits', x_guess=3.3, y_guess=3.3, flux_percent=0.5)
    
    return
Example #14
0
def calc_star_stats():
    util.mkdir(stats_dir)

    for key in dict_suffix.keys():
        img = dict_images[key]
        suf = dict_suffix[key]

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Catalog: ', img)
        
        img_files = [out_dir + 'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf) for ii in img]
        stats_file = stats_dir + 'stats_' + key + '.fits'
        
        reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
        moffat.fit_moffat(img_files, stats_file, flux_percent=0.2)

    return
Example #15
0
def calc_star_stats():
    util.mkdir(stats_dir)

    # Open Loop
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o
    ]
    stats_file = stats_dir + 'stats_open.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - B2
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_B2_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_B2
    ]
    stats_file = stats_dir + 'stats_closed_B2.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - 4W
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_4W
    ]
    stats_file = stats_dir + 'stats_closed_4W.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - n1
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_zc11_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_zc
    ]
    stats_file = stats_dir + 'stats_closed_zc.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #tip tilt
    img_files = [out_dir + 'obj{0:03d}tip_tilt_scan_clean.fits'.format(ii)\
 for ii in fnum_tt]
    stats_file = stats_dir + 'stats_closed_tt.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    return
Example #16
0
def analyze_stacks():
    ## EDITED FOR 4F DATA

    ## Loop through all the different data sets
    #for key in ['set_name']: ## Single key setup
    all_images = []
    for key in dict_suffix.keys():
        img = dict_images[key]
        suf = dict_suffix[key]
        fwhm = dict_fwhm[key]
        filt = dict_filt[key]

        thrsh = 10
        peak_max = 30000
        sharp_lim = 0.9

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Images: ', img)
        print('     Fwhm: ', str(fwhm))

        image_file = [stacks_dir + 'fld2_stack_' + suf + '_' + filt + '.fits'
                      ]  ## EDITED LINE
        all_images.append(image_file[0])

        #redu.find_stars(image_file, fwhm=fwhm, threshold=6, N_passes=2, plot_psf_compare=False, mask_file=calib_dir + f'mask_{filt}.fits')
        redu.find_stars(image_file,
                        fwhm=fwhm,
                        threshold=thrsh,
                        N_passes=2,
                        plot_psf_compare=False,
                        mask_file=calib_dir + f'mask_{filt}.fits',
                        peak_max=peak_max,
                        sharp_lim=sharp_lim)

    ## Calc stats on all the stacked images
    out_stats_file = stats_dir + 'stats_stacks.fits'
    redu.calc_star_stats(all_images, output_stats=out_stats_file)
    moffat.fit_moffat(all_images, out_stats_file, flux_percent=0.2)

    ## DEBUG - single threaded
    # image_file = stacks_dir + 'fld2_stack_' + dict_suffix['open'] + '.fits'
    # redu.find_stars_single(image_file, dict_fwhm['open'], 3, 2, False, calib_dir + 'mask.fits')

    return
Example #17
0
def calc_star_stats():
    util.mkdir(stats_dir)

    # Open Loop
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o
    ]
    stats_file = stats_dir + 'stats_open.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - threeWFS_LS
    img_files = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean.fits'.format(ii)
        for ii in fnum_c
    ]
    stats_file = stats_dir + 'stats_closed_threeWFS_LS_c.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    return
Example #18
0
def analyze_stacks():
    ## Loop through all the different data sets
    #for key in ['set_name']: ## Single key setup
    all_images = []
    #for key in dict_suffix.keys():
    for key in ['LS_3wfs_r2', 'LS_5wfs_r2', 'open_r2']:
        img = dict_images[key]
        suf = dict_suffix[key]

        fwhm = dict_fwhm[key]
        thrsh = 10
        peak_max = 30000
        sharp_lim = dict_sharp[key]

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Images: ', img)
        print('     Fwhm: ', str(fwhm))
        print('   Thresh: ', str(thrsh))

        image_file = [stacks_dir + 'beehive_stack_' + suf + '.fits']
        all_images.append(image_file[0])

        redu.find_stars(image_file,
                        fwhm=fwhm,
                        threshold=thrsh,
                        plot_psf_compare=False,
                        mask_file=calib_dir + 'domemask.fits',
                        peak_max=peak_max,
                        sharp_lim=sharp_lim)

    ## Calc stats on all the stacked images
    out_stats_file = stats_dir + 'stats_stacks.fits'
    redu.calc_star_stats(all_images, output_stats=out_stats_file)
    moffat.fit_moffat(all_images, out_stats_file, flux_percent=0.2)

    ## DEBUG - single threaded
    # image_file = stacks_dir + 'fld2_stack_' + dict_suffix['open'] + '.fits'
    # redu.find_stars_single(image_file, dict_fwhm['open'], 3, 2, False, calib_dir + 'mask.fits')

    return
Example #19
0
def calc_star_stats():
    util.mkdir(stats_dir)

    # Open Loop
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o
    ]
    stats_file = stats_dir + 'stats_open.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - B2
    img_files = [
        out_dir + 'obj{0:03d}LS_B2_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_B2
    ]
    stats_file = stats_dir + 'stats_closed_B2.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - n7
    img_files = [
        out_dir + 'obj{0:03d}LSnrej7_zc21_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_n7
    ]
    stats_file = stats_dir + 'stats_closed_n7.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - n1
    img_files = [
        out_dir + 'obj{0:03d}LSnrej1_zc21_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_n1
    ]
    stats_file = stats_dir + 'stats_closed_n1.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    return
Example #20
0
def calc_star_stats():
    util.mkdir(stats_dir)

    # Open Loop
    img_files = [out_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum_o]
    stats_file = stats_dir + 'stats_open.fits'
    reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - threeWFS_LS
    img_files = [out_dir + 'obj{0:04d}_threeWFS_LS_clean.fits'.format(ii) for ii in fnum_threeWFS_LS]
    stats_file = stats_dir + 'stats_closed_threeWFS_LS.fits'
    reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - threeWFSLS_B2_c
    img_files = [out_dir + 'obj{0:04d}_threeWFSLS_B2_c_clean.fits'.format(ii) for ii in fnum_threeWFSLS_B2_c]
    stats_file = stats_dir + 'stats_closed_threeWFSLS_B2_c.fits'
    reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - threeWFSMean_B2_c
    img_files = [out_dir + 'obj{0:04d}_threeWFSMean_B2_c_clean.fits'.format(ii) for ii in fnum_threeWFSMean_B2_c]
    stats_file = stats_dir + 'stats_closed_threeWFSMean_B2_c.fits'
    reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    # Open Loop - 2 filter
    img_files = [out_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum_o_2filt]
    stats_file = stats_dir + 'stats_open_2filt.fits'
    reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - threeWFS_LS - 2 filter
    img_files = [out_dir + 'obj{0:04d}_threeWFS_LS_clean.fits'.format(ii) for ii in fnum_threeWFS_LS_2filt]
    stats_file = stats_dir + 'stats_closed_threeWFS_LS_2filt.fits'
    reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - threeWFSLS_B2_c - 2 filter
    img_files = [out_dir + 'obj{0:04d}_threeWFSLS_B2_c_clean.fits'.format(ii) for ii in fnum_threeWFSLS_B2_c_2filt]
    stats_file = stats_dir + 'stats_closed_threeWFSLS_B2_c_2filt.fits'
    reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - threeWFSMean_B2_c - 2 filter
    img_files = [out_dir + 'obj{0:04d}_threeWFSMean_B2_c_clean.fits'.format(ii) for ii in fnum_threeWFSMean_B2_c_2filt]
    stats_file = stats_dir + 'stats_closed_threeWFSMean_B2_c_2filt.fits'
    reduce_fli.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    return
Example #21
0
def calc_star_stats_fourfilt():
    util.mkdir(stats_dir)

    # Open Loop
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o
    ]

    # R
    stats_file = stats_dir + 'stats_open_R.fits'
    starlists = [
        out_dir + 'obj{0:03d}_o_scan_clean_R_stars.txt'.format(ii)
        for ii in fnum_o
    ]
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file, filt='R')
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # V
    stats_file = stats_dir + 'stats_open_V.fits'
    starlists = [
        out_dir + 'obj{0:03d}_o_scan_clean_V_stars.txt'.format(ii)
        for ii in fnum_o
    ]
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file, filt='V')
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # B
    stats_file = stats_dir + 'stats_open_B.fits'
    starlists = [
        out_dir + 'obj{0:03d}_o_scan_clean_B_stars.txt'.format(ii)
        for ii in fnum_o
    ]
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file, filt='B')
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # I
    stats_file = stats_dir + 'stats_open_I.fits'
    starlists = [
        out_dir + 'obj{0:03d}_o_scan_clean_I_stars.txt'.format(ii)
        for ii in fnum_o
    ]
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file, filt='I')
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    #Closed Loop - threeWFS_LS
    img_files = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean.fits'.format(ii)
        for ii in fnum_c
    ]

    # R
    stats_file = stats_dir + 'stats_closed_R.fits'
    starlists = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean_R_stars.txt'.format(ii)
        for ii in fnum_c
    ]
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file, filt='R')
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # V
    stats_file = stats_dir + 'stats_closed_V.fits'
    starlists = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean_V_stars.txt'.format(ii)
        for ii in fnum_c
    ]
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file, filt='V')
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # B
    stats_file = stats_dir + 'stats_closed_B.fits'
    starlists = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean_B_stars.txt'.format(ii)
        for ii in fnum_c
    ]
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file, filt='B')
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # I
    stats_file = stats_dir + 'stats_closed_I.fits'
    starlists = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean_I_stars.txt'.format(ii)
        for ii in fnum_c
    ]
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file, filt='I')
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    return
Example #22
0
    reduce_fli.find_stars(img_files, fwhm=7, threshold=15, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.8, mask_max=1.4, \
                              left_slice =20, right_slice=20, top_slice=25, bottom_slice=25)
                          
    return


def calc_star_stats():
    util.mkdir(stats_dir)

    # Open Loop
    img_files = [out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o]
    stats_file = stats_dir + 'stats_open.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - 4W
<<<<<<< HEAD
    img_files = [out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii) for ii in fnum_c_4W]
=======
<<<<<<< HEAD
    img_files = [out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii) for ii in fnum_c_4W]
=======
    img_files = [out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii) for ii in fnum_c_4@]
>>>>>>> 9d0fe2dfc407d195227cb24b248c5a5cff886914
>>>>>>> 89ee2c675e89b7f849298b2cbbd5d3a37068a09f
    stats_file = stats_dir + 'stats_closed_4W.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    #Closed Loop - B2
    img_files = [out_dir + 'obj{0:03d}LS4WFS_B2_c_scan_clean.fits'.format(ii) for ii in fnum_c_B2]
Example #23
0
def calc_fourfilt_stats():

    # Open Loop - B
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in rot_o_4
    ]
    starlists = [
        out_dir + 'obj{0:03d}_o_scan_clean_B_BVIR_stars.txt'.format(ii)
        for ii in rot_1_o
    ]
    starlists += [
        out_dir + 'obj{0:03d}_o_scan_clean_B_VIRB_stars.txt'.format(ii)
        for ii in rot_2_o
    ]
    starlists += [
        out_dir + 'obj{0:03d}_o_scan_clean_B_IRBV_stars.txt'.format(ii)
        for ii in rot_3_o
    ]
    stats_file = stats_dir + 'stats_open_B.fits'
    reduce_STA.calc_star_stats(img_files,
                               output_stats=stats_file,
                               starlists=starlists,
                               fourfilt=True)
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # Open Loop - V
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in rot_o_4
    ]
    starlists = [
        out_dir + 'obj{0:03d}_o_scan_clean_V_BVIR_stars.txt'.format(ii)
        for ii in rot_1_o
    ]
    starlists += [
        out_dir + 'obj{0:03d}_o_scan_clean_V_VIRB_stars.txt'.format(ii)
        for ii in rot_2_o
    ]
    starlists += [
        out_dir + 'obj{0:03d}_o_scan_clean_V_IRBV_stars.txt'.format(ii)
        for ii in rot_3_o
    ]
    stats_file = stats_dir + 'stats_open_V.fits'
    reduce_STA.calc_star_stats(img_files,
                               output_stats=stats_file,
                               starlists=starlists,
                               fourfilt=True)
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # Open Loop - R
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in rot_o_4
    ]
    starlists = [
        out_dir + 'obj{0:03d}_o_scan_clean_R_BVIR_stars.txt'.format(ii)
        for ii in rot_1_o
    ]
    starlists += [
        out_dir + 'obj{0:03d}_o_scan_clean_R_VIRB_stars.txt'.format(ii)
        for ii in rot_2_o
    ]
    starlists += [
        out_dir + 'obj{0:03d}_o_scan_clean_R_IRBV_stars.txt'.format(ii)
        for ii in rot_3_o
    ]
    stats_file = stats_dir + 'stats_open_R.fits'
    reduce_STA.calc_star_stats(img_files,
                               output_stats=stats_file,
                               starlists=starlists,
                               fourfilt=True)
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # Open Loop - I
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in rot_o_4
    ]
    starlists = [
        out_dir + 'obj{0:03d}_o_scan_clean_I_BVIR_stars.txt'.format(ii)
        for ii in rot_1_o
    ]
    starlists += [
        out_dir + 'obj{0:03d}_o_scan_clean_I_VIRB_stars.txt'.format(ii)
        for ii in rot_2_o
    ]
    starlists += [
        out_dir + 'obj{0:03d}_o_scan_clean_I_IRBV_stars.txt'.format(ii)
        for ii in rot_3_o
    ]
    stats_file = stats_dir + 'stats_open_I.fits'
    reduce_STA.calc_star_stats(img_files,
                               output_stats=stats_file,
                               starlists=starlists,
                               fourfilt=True)
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # Closed Loop - B
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii)
        for ii in rot_c_4
    ]
    starlists = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_B_BVIR_stars.txt'.format(ii)
        for ii in rot_1_c
    ]
    starlists += [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_B_VIRB_stars.txt'.format(ii)
        for ii in rot_2_c
    ]
    starlists += [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_B_IRBV_stars.txt'.format(ii)
        for ii in rot_3_c
    ]
    stats_file = stats_dir + 'stats_closed_B.fits'
    reduce_STA.calc_star_stats(img_files,
                               output_stats=stats_file,
                               starlists=starlists,
                               fourfilt=True)
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # Closed Loop - V
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii)
        for ii in rot_c_4
    ]
    starlists = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_V_BVIR_stars.txt'.format(ii)
        for ii in rot_1_c
    ]
    starlists += [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_V_VIRB_stars.txt'.format(ii)
        for ii in rot_2_c
    ]
    starlists += [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_V_IRBV_stars.txt'.format(ii)
        for ii in rot_3_c
    ]
    stats_file = stats_dir + 'stats_closed_V.fits'
    reduce_STA.calc_star_stats(img_files,
                               output_stats=stats_file,
                               starlists=starlists,
                               fourfilt=True)
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # Closed Loop - R
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii)
        for ii in rot_c_4
    ]
    starlists = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_R_BVIR_stars.txt'.format(ii)
        for ii in rot_1_c
    ]
    starlists += [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_R_VIRB_stars.txt'.format(ii)
        for ii in rot_2_c
    ]
    starlists += [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_R_IRBV_stars.txt'.format(ii)
        for ii in rot_3_c
    ]
    stats_file = stats_dir + 'stats_closed_R.fits'
    reduce_STA.calc_star_stats(img_files,
                               output_stats=stats_file,
                               starlists=starlists,
                               fourfilt=True)
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    # Closed Loop - I
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii)
        for ii in rot_c_4
    ]
    starlists = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_I_BVIR_stars.txt'.format(ii)
        for ii in rot_1_c
    ]
    starlists += [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_I_VIRB_stars.txt'.format(ii)
        for ii in rot_2_c
    ]
    starlists += [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean_I_IRBV_stars.txt'.format(ii)
        for ii in rot_3_c
    ]
    stats_file = stats_dir + 'stats_closed_I.fits'
    reduce_STA.calc_star_stats(img_files,
                               output_stats=stats_file,
                               starlists=starlists,
                               fourfilt=True)
    moffat.fit_moffat(img_files, stats_file, starlists=starlists)

    return
Example #24
0
def calc_star_stats():
    util.mkdir(stats_dir)

    # Open Loop
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o
    ]
    stats_file = stats_dir + 'stats_open.fits'
    #reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    #moffat.fit_moffat(img_files, stats_file)

    # EXPERIMENT 1:

    # Closed - LS_c
    img_files = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean.fits'.format(ii)
        for ii in fnum_LS_c
    ]
    stats_file = stats_dir + 'stats_closed_LS.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    # Closed - LS_B2_c
    img_files = [
        out_dir + 'obj{0:03d}threeWFSLS_B2_c_scan_clean.fits'.format(ii)
        for ii in fnum_LS_B2_c
    ]
    stats_file = stats_dir + 'stats_closed_LS_B2.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    # Closed - Mean_B2_c
    img_files = [
        out_dir + 'obj{0:03d}threeWFSMean_B2_c_scan_clean.fits'.format(ii)
        for ii in fnum_Mean_B2_c
    ]
    stats_file = stats_dir + 'stats_closed_Mean_B2.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    # EXPERIMENT 2

    # Closed - nrej1
    img_files = [
        out_dir + 'obj{0:03d}threeWFSLS_nrej1_c_scan_clean.fits'.format(ii)
        for ii in fnum_nrej1
    ]
    stats_file = stats_dir + 'stats_closed_nrej1.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    # Closed - nrej4
    img_files = [
        out_dir + 'obj{0:03d}threeWFSLS_nrej4_c_scan_clean.fits'.format(ii)
        for ii in fnum_nrej4
    ]
    stats_file = stats_dir + 'stats_closed_nrej4.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    # Closed - nrej7
    img_files = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean.fits'.format(ii)
        for ii in fnum_nrej7
    ]
    stats_file = stats_dir + 'stats_closed_nrej7.fits'
    reduce_STA.calc_star_stats(img_files, output_stats=stats_file)
    moffat.fit_moffat(img_files, stats_file)

    return