Example #1
0
def find_stars_fld2():
    ## Loop through all the different data sets
    for key in dict_suffix.keys():

        img = dict_images[key]
        suf = dict_suffix[key]
        sky = dict_skies[key]
        fwhm = dict_fwhm[key]

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

        img_files = [
            out_dir +
            'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf)
            for ii in img
        ]
        redu.find_stars(img_files,
                        fwhm=fwhm,
                        threshold=8,
                        N_passes=2,
                        plot_psf_compare=False,
                        mask_file=calib_dir + 'mask.fits')

    return
Example #2
0
def find_stars_pleiades_closed():
    reduce_dir = root_dir + 'reduce/pleiades/'

    fnum1 = [
        27, 28, 29, 30, 31, 35, 36, 37, 44, 45, 46, 47, 48, 49, 53, 54, 55, 62,
        63, 64
    ]
    fnum2 = [
        74, 75, 76, 89, 90, 91, 101, 102, 103, 110, 111, 112, 123, 124, 125,
        132, 133
    ]
    fnum3 = [
        134, 141, 142, 143, 153, 154, 155, 162, 163, 164, 171, 172, 173, 183,
        184, 185
    ]
    fnum4 = [
        192, 193, 194, 201, 202, 203, 213, 214, 215, 222, 223, 224, 228, 229,
        230, 237
    ]
    fnum5 = [
        238, 239, 249, 250, 251, 258, 259, 260, 267, 268, 269, 278, 279, 284,
        285, 290
    ]
    fnum6 = [291, 296, 297, 309, 310, 311, 318, 319, 320]
    fnum = fnum1 + fnum2 + fnum3 + fnum4 + fnum5 + fnum6
    img_files = [
        reduce_dir + 'obj_c{0:03d}_clean.fits'.format(ii) for ii in fnum
    ]
    reduce_fli.find_stars(img_files, fwhm=3, threshold=6)

    return
Example #3
0
def analyze_stacks():

    open_img_files = [
        stacks_dir + 'FLD2_stack_open_30.fits',
        stacks_dir + 'FLD2_stack_open_60.fits'
    ]

    closed_img_files = [
        stacks_dir + 'FLD2_stack_closed_3S_30.fits',
        stacks_dir + 'FLD2_stack_closed_3L_30.fits',
        stacks_dir + 'FLD2_stack_closed_4_30.fits',
        stacks_dir + 'FLD2_stack_closed_3S_60.fits',
        stacks_dir + 'FLD2_stack_closed_3L_60.fits',
        stacks_dir + 'FLD2_stack_closed_4_60.fits'
    ]

    #Find stars in image
    reduce_fli.find_stars(open_img_files,
                          fwhm=8,
                          threshold=10,
                          N_passes=2,
                          plot_psf_compare=False)
    reduce_fli.find_stars(closed_img_files,
                          fwhm=4,
                          threshold=10,
                          N_passes=2,
                          plot_psf_compare=False)

    # Calc stats on all the stacked images
    reduce_fli.calc_star_stats(open_img_files + closed_img_files,
                               output_stats=stats_dir + 'stats_stacks.fits')

    return
Example #4
0
def find_stars_pleiades_closed():
    data_dir = root_dir + 'reduce/'
    os.chdir(data_dir)

    fnum1 = [
        7, 8, 12, 15, 16, 19, 20, 26, 27, 30, 31, 34, 35, 38, 39, 44, 45, 48,
        49, 52
    ]
    fnum2 = [
        53, 56, 57, 62, 63, 66, 67, 70, 71, 74, 75, 80, 81, 84, 85, 88, 89, 92,
        93
    ]
    fnum3 = [
        98, 99, 102, 103, 106, 107, 110, 111, 116, 117, 120, 121, 124, 125,
        128, 129
    ]
    fnum4 = [
        155, 156, 163, 164, 167, 168, 171, 172, 177, 178, 183, 184, 191, 192,
        198, 199
    ]
    fnum5 = [204, 205, 210, 211, 216, 217, 222, 223, 226, 227, 230, 231]
    fnum = fnum1  #+ fnum2 + fnum3 + fnum4 + fnum5
    img_files = ['obj_c{0:03d}_clean.fits'.format(ii) for ii in fnum]
    reduce_fli.find_stars(img_files, fwhm=5, threshold=6)

    return
Example #5
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 #6
0
def find_stars_beehive():
    
    # Loop through all the different data sets and reduce them.
    for key in dict_suffix.keys():

        img = dict_images[key]
        suf = dict_suffix[key]
        sky = dict_skies[key]
        
        # o/c loop distinction
        fwhm = 5 if re.search('c_', key) else 8
        thrsh = 10 if re.search('c_', key) else 5

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

        img_files = [out_dir + 'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf) for ii in img]
        # Taken from working branch version args
        reduce_fli.find_stars(img_files, fwhm=fwhm,  threshold = thrsh, plot_psf_compare=False, mask_file=calib_dir+'mask.fits')

    # 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]) 
    # redu.find_stars_single(image_file, dict_fwhm['LS_c'], 3, 2, False, calib_dir + 'mask.fits')
                          
    return
Example #7
0
def find_stars_fld2():
    ## 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]
        filt = dict_filt[key]
        fwhm = dict_fwhm[key]
        
        thrsh = 10
        peak_max = 30000
        sharp_lim = 0.9

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

        #redu.find_stars(img_files, fwhm=fwhm, threshold=8, N_passes=2, plot_psf_compare=False,
        #                      mask_file=calib_dir+f'mask_{filt}.fits')
        redu.find_stars(img_files, 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)
        
    ## 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]) 
    # redu.find_stars_single(image_file, dict_fwhm['LS_c'], 3, 2, False, calib_dir + 'mask.fits')
                          
    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 find_stars_pleiades_open():
    reduce_dir = root_dir + 'reduce/pleiades/'

    fnum1 = [
        56, 57, 58, 65, 66, 67, 77, 78, 79, 92, 93, 94, 98, 99, 100, 104, 105,
        106
    ]
    fnum2 = [
        113, 114, 115, 126, 127, 128, 135, 136, 137, 144, 145, 146, 156, 157,
        158
    ]
    fnum3 = [
        165, 166, 167, 174, 175, 176, 186, 187, 188, 195, 196, 197, 204, 205,
        206
    ]
    fnum4 = [
        216, 217, 218, 231, 232, 233, 240, 241, 242, 252, 253, 254, 261, 262,
        263
    ]
    fnum5 = [
        270, 271, 272, 280, 281, 286, 287, 292, 293, 299, 300, 301, 302, 312,
        313
    ]
    fnum6 = [314, 321, 322, 323]
    fnum = fnum1 + fnum2 + fnum3 + fnum4 + fnum5 + fnum6
    img_files = [
        reduce_dir + 'obj_o{0:03d}_clean.fits'.format(ii) for ii in fnum
    ]
    reduce_fli.find_stars(img_files, fwhm=5, threshold=6)

    return
Example #10
0
def find_stars_pleiades_ttf():
    reduce_dir = root_dir + 'reduce/pleiades/'

    fnum1 = [
        32, 33, 34, 38, 39, 40, 50, 51, 52, 59, 60, 61, 68, 69, 70, 80, 81, 82,
        86
    ]
    fnum2 = [
        87, 88, 95, 96, 97, 107, 108, 109, 120, 121, 122, 129, 130, 131, 138,
        139
    ]
    fnum3 = [
        140, 150, 151, 152, 159, 160, 161, 168, 169, 170, 180, 181, 182, 189,
        190
    ]
    fnum4 = [
        191, 198, 199, 200, 210, 211, 212, 219, 220, 221, 225, 226, 227, 234,
        235
    ]
    fnum5 = [
        236, 246, 247, 248, 255, 256, 257, 264, 265, 266, 276, 277, 282, 283,
        288
    ]
    fnum6 = [289, 294, 295, 306, 307, 308, 315, 316, 317]
    fnum = fnum1 + fnum2 + fnum3 + fnum4 + fnum5 + fnum6
    img_files = [
        reduce_dir + 'obj_ttf{0:03d}_clean.fits'.format(ii) for ii in fnum
    ]
    reduce_fli.find_stars(img_files, fwhm=5, threshold=6)

    return
Example #11
0
def find_stars_pleiades_open():
    reduce_dir = root_dir + 'reduce/pleiades/'

    # Old Naming Scheme
    #     fnum1 = [10, 11, 14, 15, 18, 19, 24, 25, 28, 29, 34, 35, 38, 39, 40, 41, 44, 45, 50, 51, 55]
    #     fnum2 = [60, 61, 64, 65, 68, 69, 74, 75, 78, 79, 82, 83, 88, 89, 92, 93, 96, 97, 102, 103]
    #     fnum = fnum1 + fnum2
    #     img_files = [reduce_dir + 'obj{0:03d}_clean.fits'.format(ii) for ii in fnum]
    #     reduce_fli.find_stars(img_files, fwhm=5, threshold=6)

    # New Naming Scheme
    #fnum1 = [106, 107, 110, 111, 116, 117, 120, 121, 124, 125, 130, 131, 134, 135, 138, 139, 144]
    #fnum2 = [145, 148, 149, 152, 153, 158, 159, 162, 163, 166, 167, 172, 173, 176, 177, 180, 181]
    fnum3 = [
        184, 185, 190, 191, 194, 195, 198, 199, 202, 203, 208, 209, 212, 213,
        216, 217
    ]
    fnum4 = [
        220, 221, 226, 227, 230, 231, 235, 238, 239, 244, 245, 248, 249, 252,
        253
    ]
    #fnum = fnum1 + fnum2 + fnum3 + fnum4
    fnum = fnum3 + fnum4
    img_files = [
        reduce_dir + 'obj_o{0:03d}_clean.fits'.format(ii) for ii in fnum
    ]
    reduce_fli.find_stars(img_files, fwhm=5, threshold=6)

    return
Example #12
0
def find_stars_fld2():
    ## 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]
        sky = dict_skies[key]
        fwhm = dict_fwhm[key]

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

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

        redu.find_stars(img_files,
                        fwhm=fwhm,
                        threshold=6,
                        N_passes=2,
                        plot_psf_compare=False,
                        mask_file=calib_dir + 'mask.fits')

    ## 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])
    # redu.find_stars_single(image_file, dict_fwhm['LS_c'], 3, 2, False, calib_dir + 'mask.fits')

    return
Example #13
0
def find_stars_pleiades_binned_open():
    data_dir = root_dir + 'reduce/'
    os.chdir(data_dir)

    fnum1 = [
        9, 10, 13, 14, 17, 18, 21, 22, 28, 29, 32, 33, 36, 37, 40, 41, 46, 47,
        50, 51
    ]
    fnum2 = [
        54, 55, 58, 59, 64, 65, 68, 69, 72, 73, 76, 77, 82, 83, 86, 87, 90, 91,
        94, 95
    ]
    fnum3 = [
        100, 101, 104, 105, 108, 109, 112, 113, 118, 119, 122, 123, 126, 127,
        130, 131
    ]
    fnum4 = [
        141, 142, 149, 150, 179, 180, 185, 186, 193, 194, 200, 201, 206, 207,
        212, 213, 218, 219
    ]
    fnum = fnum1 + fnum2 + fnum3 + fnum4
    img_files = ['obj_o{0:03d}_clean.fits'.format(ii) for ii in fnum]
    reduce_fli.find_stars(img_files, fwhm=5, threshold=6)

    return
Example #14
0
def find_stars_pleiades_tt():
    data_dir = root_dir + 'reduce/'
    os.chdir(data_dir)

    fnum = [134, 135, 136, 137, 138, 139, 140]
    img_files = ['obj_tt{0:03d}_clean.fits'.format(ii) for ii in fnum]
    reduce_fli.find_stars(img_files, fwhm=5, threshold=6)

    return
Example #15
0
def find_stars_orion():

    # Open Loop
    img_files = [out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o]
    reduce_fli.find_stars(img_files, fwhm=8, threshold=10, 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)
    
    #Closed Loop - 4W
    img_files = [out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii) for ii in fnum_c_4W]
Example #16
0
def find_stars_beehive():
    ## Loop through all the different data sets
    #for key in ['set_name']: ## Single key setup
    for key in dict_suffix.keys():
        #for key in ['LS_3wfs_s_1']:

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

        fwhm = dict_fwhm[key]
        sharp_lim = 0.9  #dict_sharp[key]
        thrsh = 4
        peak_max = 30000

        print('Working on: {1:s}  {0:s}'.format(key, suf))
        print('   Images: ', img)
        print('      Sky: ', sky)
        print('    Rebin: ', rebin_data)

        if rebin_data:
            img_files = [
                out_dir +
                'bin2/sta{img:03d}{suf:s}_scan_clean_bin2.fits'.format(img=ii,
                                                                       suf=suf)
                for ii in img
            ]
            mask_f = calib_dir + 'domemask_bin2.fits'
            fwhm = fwhm / 2
        else:
            img_files = [
                out_dir +
                'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf)
                for ii in img
            ]
            mask_f = calib_dir + 'domemask.fits'

        # find stars on a starlist in parallel
        redu.find_stars(img_files,
                        fwhm=fwhm,
                        threshold=thrsh,
                        plot_psf_compare=False,
                        mask_file=mask_f,
                        peak_max=peak_max,
                        sharp_lim=sharp_lim)

    ## 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])
    # redu.find_stars_single(image_file, dict_fwhm['LS_c'], 3, 2, False, calib_dir + 'mask.fits')

    return
Example #17
0
def find_stars_FLD2():
    data_dir = root_dir + 'reduce/FLD2/'

    # Open Loop
    fnum = [63, 67, 71, 75, 80, 84, 88, 92, 96, 100, 104, 108, 112, 124]
    img_files = [
        data_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum
    ]
    reduce_fli.find_stars(img_files, fwhm=8, threshold=10)

    # Closed Loop

    fnum = [64, 68, 72, 76, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113]
    img_files = [
        data_dir + 'obj{0:04d}_c_clean.fits'.format(ii) for ii in fnum
    ]
    reduce_fli.find_stars(img_files, fwhm=6, threshold=6)

    #Closed A

    fnum = [65, 69, 73, 78, 82, 86, 90, 94, 98, 102, 106, 110, 114]
    img_files = [
        data_dir + 'obj{0:04d}_cA_clean.fits'.format(ii) for ii in fnum
    ]
    reduce_fli.find_stars(img_files, fwhm=6, threshold=6)

    # Closed B

    fnum = [66, 70, 74, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115]
    img_files = [
        data_dir + 'obj{0:04d}_cB_clean.fits'.format(ii) for ii in fnum
    ]
    reduce_fli.find_stars(img_files, fwhm=6, threshold=6)

    return
Example #18
0
def find_stars_FLD2():

    # Open Loop
    img_files = [out_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum_o+fnum_o_2filt]
    reduce_fli.find_stars(img_files, fwhm=9, threshold=10, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=20, bottom_slice=0)
    
    #Closed Loop - threeWFS_LS
    img_files = [out_dir + 'obj{0:04d}_threeWFS_LS_clean.fits'.format(ii) for ii in fnum_threeWFS_LS+fnum_threeWFS_LS_2filt]
    reduce_fli.find_stars(img_files, fwhm=6, threshold=10, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=20, bottom_slice=0)
                              
    #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+fnum_threeWFSLS_B2_c_2filt]
    reduce_fli.find_stars(img_files, fwhm=6, threshold=10, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=20, bottom_slice=0)
                              
    #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+fnum_threeWFSMean_B2_c_2filt]
    reduce_fli.find_stars(img_files, fwhm=6, threshold=10, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=20, bottom_slice=0)

    return
Example #19
0
def analyze_stacks_I():

    open_img_files = [stacks_dir + 'beehive_stack_open_I.fits']

    closed_img_files = [stacks_dir + 'beehive_stack_closed_I.fits']
    
    #Find stars in image
    #reduce_fli.find_stars(open_img_files, fwhm=10, threshold=10, N_passes=2, plot_psf_compare=False, \
    #                          mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
    #                          left_slice =25, right_slice=0, top_slice=25, bottom_slice=0)
    reduce_fli.find_stars(closed_img_files, fwhm=7, threshold=10, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=25, bottom_slice=0)
    
    return
Example #20
0
def find_stars_FLD2():

    # Open Loop
    img_files = [
        out_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum_o
    ]
    reduce_fli.find_stars(img_files, fwhm=8, threshold=10)

    #Closed Loop
    img_files = [
        out_dir + 'obj{0:04d}_c_clean.fits'.format(ii) for ii in fnum_c
    ]
    reduce_fli.find_stars(img_files, fwhm=6, threshold=6)

    return
Example #21
0
def run_find_stars():
    work_dir = '/Users/jlu/work/imaka/pleiades/press_release/'

    img_files = [
        'west_stack_open.fits', 'west_stack_ttf.fits', 'west_stack_closed.fits'
    ]
    for ii in range(len(img_files)):
        img_files[ii] = work_dir + img_files[ii]

    reduce_fli.find_stars(img_files, fwhm=5, threshold=4, N_passes=2)

    # Calc stats on all the stacked images
    reduce_fli.calc_star_stats(img_files,
                               output_stats=work_dir + 'stats_stacks.fits')

    return
Example #22
0
def find_stars_beehive():

    # Open Loop
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o
    ]
    #reduce_fli.find_stars(img_files, fwhm=8, threshold=6, 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)

    #Closed Loop - 4W
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_4W
    ]
    #reduce_fli.find_stars(img_files, fwhm=7, threshold=6, 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)

    #Closed Loop - B2
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_B2_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_B2
    ]
    #reduce_fli.find_stars(img_files, fwhm=7, threshold=6, 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)

    #Closed Loop - zc
    img_files = [
        out_dir + 'obj{0:03d}LS4WFS_zc11_c_scan_clean.fits'.format(ii)
        for ii in fnum_c_zc
    ]
    #reduce_fli.find_stars(img_files, fwhm=7, threshold=6, 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)

    #Tip tilt
    img_files = [
        out_dir + 'obj{0:03d}tip_tilt_scan_clean.fits'.format(ii)
        for ii in fnum_tt
    ]
    reduce_fli.find_stars(img_files, fwhm=7, threshold=6, 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
Example #23
0
def find_stars_pleiades():
    ##########
    # Open Loop
    ##########
    fnum = np.arange(57, 67)
    img_files = ['{0:s}/obj{1:03d}_clean.fits'.format(data_dir, ii) for ii in fnum]

    reduce_fli.find_stars(img_files, fwhm=2, threshold=6)
    
    ##########
    # Closed Loop 
    ##########
    fnum = np.arange(47, 57)
    img_files = ['{0:s}/obj{1:03d}_clean.fits'.format(data_dir, ii) for ii in fnum]

    reduce_fli.find_stars(img_files, fwhm=2, threshold=6)

    return
Example #24
0
def analyze_stacks():
    data_dir = root_dir + 'reduce/stacks/'
    stats_dir = root_dir + 'reduce/stats/'
    
    img_files = [data_dir + 'FLD2_stack_open.fits',
                 data_dir + 'FLD2_stack_closed.fits',
                 data_dir + 'FLD2_stack_closedA.fits',
                 data_dir + 'FLD2_stack_closedB.fits',
                 data_dir + 'FLD2_stack_closedC.fits',
                 data_dir + 'FLD2_stack_closedD.fits']
    
    #Find stars in image
    reduce_fli.find_stars(img_files, fwhm=5, threshold=10, N_passes=2, plot_psf_compare=False)
    
    # Calc stats on all the stacked images
    reduce_fli.calc_star_stats(img_files, output_stats= stats_dir + 'stats_stacks.fits')

    return
Example #25
0
def find_stars_pleiades_ttf():
    data_dir = root_dir + 'reduce/'
    os.chdir(data_dir)
    #
    fnum1 = [
        143, 144, 145, 146, 147, 148, 151, 152, 153, 154, 157, 157, 158, 161,
        162, 165, 166
    ]
    fnum2 = [
        169, 170, 173, 174, 175, 176, 181, 182, 187, 188, 189, 190, 202, 203,
        208, 209, 214
    ]
    fnum3 = [215, 220, 221, 224, 225, 228, 229]
    fnum = fnum1 + fnum2 + fnum3
    img_files = ['obj_ttf{0:03d}_clean.fits'.format(ii) for ii in fnum]
    reduce_fli.find_stars(img_files, fwhm=5, threshold=6)

    return
Example #26
0
def analyze_stacks():

    open_img_files = [stacks_dir + 'FLD2_stack_open.fits']

    closed_img_files = [stacks_dir + 'FLD2_stack_threeWFS_LS_c.fits']

    #Find stars in image
    reduce_fli.find_stars(open_img_files, fwhm=10, threshold=100, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=25, bottom_slice=0)
    reduce_fli.find_stars(closed_img_files, fwhm=7, threshold=30, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=25, bottom_slice=0)

    # Calc stats on all the stacked images
    #reduce_fli.calc_star_stats(open_img_files+closed_img_files, output_stats= stats_dir + 'stats_stacks.fits')

    return
Example #27
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 #28
0
def find_stars_beehive():
    ## Loop through all the different data sets
    #for key in ['set_name']: ## Single key setup
    #for key in dict_suffix.keys():
    for key in ['LS_3wfs_r2', 'LS_5wfs_r2', 'open_r2']:
        #for key in []:

        img = dict_images[key]
        suf = dict_suffix[key]
        sky = sky_dir + 'beehive_sky.fits'

        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('      Sky: ', sky)
        print('     Fwhm: ', str(fwhm))
        print('   Thresh: ', str(thrsh))

        img_files = [
            out_dir +
            'sta{img:03d}{suf:s}_scan_clean.fits'.format(img=ii, suf=suf)
            for ii in img
        ]
        # Taken from working branch version args
        redu.find_stars(img_files,
                        fwhm=fwhm,
                        threshold=thrsh,
                        plot_psf_compare=False,
                        mask_file=calib_dir + 'domemask.fits',
                        peak_max=peak_max,
                        sharp_lim=sharp_lim)

    ## DEBUG - single threaded
    #key_i = 'LS_5wfs_r2'
    #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])
    #redu.find_stars_single(image_file, dict_fwhm[key_i], 10, 2, False, calib_dir + 'mask.fits', sharp_lim=0.6, peak_max=30000)

    return
Example #29
0
def find_stars_pleiades_closed():
    reduce_dir = root_dir + 'reduce/pleiades/'

    ##########
    # first half of night
    ##########
    fnum1 = [
        31, 32, 33, 40, 41, 42, 52, 53, 54, 55, 64, 65, 66, 67, 79, 80, 81, 82,
        91, 92
    ]
    fnum2 = [
        93, 94, 417, 448, 479, 577, 578, 579, 580, 581, 590, 591, 592, 593
    ]
    fnum = fnum1 + fnum2
    img_files = [
        '{0:s}/obj_c{1:03d}_clean.fits'.format(reduce_dir, ii) for ii in fnum
    ]

    reduce_fli.find_stars(img_files, fwhm=3, threshold=6)

    ##########
    # second half of night
    ##########
    fnum1 = [
        605, 606, 607, 608, 618, 619, 620, 632, 633, 634, 635, 1006, 1007, 1008
    ]
    fnum2 = [
        1009, 1018, 1019, 1020, 1021, 1030, 1031, 1032, 1033, 1045, 1046, 1047,
        1048
    ]
    fnum3 = [
        1057, 1058, 1059, 1060, 1069, 1070, 1071, 1072, 1084, 1085, 1086, 1087,
        1096
    ]
    fnum4 = [1097, 1098, 1099]
    fnum = fnum1 + fnum2 + fnum3 + fnum4
    img_files = [
        '{0:s}/obj_c{1:03d}_clean.fits'.format(reduce_dir, ii) for ii in fnum
    ]

    reduce_fli.find_stars(img_files, fwhm=3, threshold=6)

    return
Example #30
0
def find_stars_FLD2():

    # Open Loop
    img_files = [
        out_dir + 'obj{0:03d}_o_scan_clean.fits'.format(ii) for ii in fnum_o
    ]
    reduce_fli.find_stars(img_files, fwhm=10, threshold=20, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=25, bottom_slice=0)

    #Closed Loop - threeWFS_LS
    img_files = [
        out_dir + 'obj{0:03d}threeWFS_LS_c_scan_clean.fits'.format(ii)
        for ii in fnum_c
    ]
    reduce_fli.find_stars(img_files, fwhm=7, threshold=30, N_passes=2, plot_psf_compare=False, \
                              mask_flat=flat_dir+"flat.fits", mask_min=0.7, mask_max=1.4, \
                              left_slice =25, right_slice=0, top_slice=25, bottom_slice=25)

    return