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
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
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
def calc_star_stats_open(): reduce_dir = root_dir + 'reduce/' stats_dir = root_dir + 'stats/' 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 + fum4 img_files = ['obj_o{0:03d}_clean.fits'.format(ii) for ii in fnum] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_open.fits') return
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
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
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
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
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
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
def calc_star_stats_closed(): reduce_dir = '/Volumes/g/lu/data/imaka/2017_01_11/fli/reduce/' stats_dir = '/Volumes/g/lu/data/imaka/2017_01_11/fli/reduce/stats/' 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.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closed.fits') return
def calc_star_stats_tt(): reduce_dir = '/Volumes/g/lu/data/imaka/2017_01_11/fli/reduce/' stats_dir = '/Volumes/g/lu/data/imaka/2017_01_11/fli/reduce/stats/' 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.calc_star_stats(img_files, output_stats=stats_dir + 'stats_tt.fits') return
def calc_star_stats(): data_dir = root_dir + 'reduce/FLD2/' stats_dir = root_dir + 'reduce/stats/' # 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.calc_star_stats(img_files, output_stats=stats_dir + 'stats_open.fits') # 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.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closed.fits') # Closed A fnum = [65, 69, 73, 78, 82, 86, 90, 94, 98, 102, 106, 110, 114] img_files = [data_dir + "obj{0:04d}_cA.fits".format(ii) for ii in fnum] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closedA.fits') # Closed B fnum = [66, 70, 74, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115] img_files = [data_dir + "obj{0:04d}_cB.fits".format(ii) for ii in fnum] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closedB.fits') return
def analyze_stacks(): img_files = [ 'west_stack_open.fits', 'west_stack_ttf.fits', 'west_stack_closed.fits' ] find_stars(img_files, fwhm=5, threshold=4, N_passes=2, plot_psf_compare=True) # Calc stats on all the stacked images reduce_fli.calc_star_stats(img_files, output_stats='stats_stacks.fits') return
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
def calc_star_stats(): 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] reduce_fli.calc_star_stats(img_files, output_stats='stats_open.fits') #closed loop fnum = np.arange(47, 57) img_files = [reduce_dir + 'obj{0:03d}_clean.fits'.format(ii) for ii in fnum] reduce_fli.calc_star_stats(img_files, output_stats='stats_closed.fits') return
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
def calc_star_stats_open(): reduce_dir = '/Volumes/g/lu/data/imaka/2017_01_10/fli/reduce/pleiades/' stats_dir = '/Volumes/g/lu/data/imaka/2017_01_10/fli/reduce/stats/' # 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_old_name = [ reduce_dir + 'obj{0:03d}_clean.fits'.format(ii) for ii in fnum ] #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 img_files_new_name = [ reduce_dir + 'obj_o{0:03d}_clean.fits'.format(ii) for ii in fnum ] img_files = img_files_old_name + img_files_new_name reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_open.fits') return
def calc_star_stats(): # Open Loop img_files = [ data_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum_o ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_open.fits') # Closed Loop img_files = [ data_dir + "obj{0:04d}_c_clean.fits".format(ii) for ii in fnum_C ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closed.fits') return
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
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
def calc_star_stats(): data_dir = root_dir + 'reduce/FLD2_2/' stats_dir = root_dir + 'reduce/stats/' util.mkdir(stats_dir) # Open Loop fnum = [4, 5, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45] fnum += [51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 85, 88, 89] fnum += [92, 95, 99, 103, 107, 110, 113, 116, 119, 122, 125, 128] fnum += [ 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, 167, 170 ] img_files = [ data_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_open.fits') # Closed Loop fnum = [96, 100, 104] img_files = [ data_dir + 'obj{0:04d}_c_clean.fits'.format(ii) for ii in fnum ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closed.fits') # Closed A fnum = [6, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53] fnum += [56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 87, 91, 94, 98, 102, 106] fnum += [109, 112, 115, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145] fnum += [148, 151, 154, 157, 160, 163, 166, 169] img_files = [ data_dir + "obj{0:04d}_cA_clean.fits".format(ii) for ii in fnum ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closedA.fits') # Closed B fnum = [10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58] fnum += [ 61, 64, 67, 70, 73, 76, 79, 82, 86, 90, 93, 97, 101, 105, 108, 111 ] fnum += [ 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153 ] fnum += [156, 159, 162, 165, 168, 171] img_files = [ data_dir + "obj{0:04d}_cB_clean.fits".format(ii) for ii in fnum ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closedB.fits') return
def calc_star_stats_closed(): reduce_dir = '/Volumes/g/lu/data/imaka/2017_01_10/fli/reduce/pleiades/' stats_dir = '/Volumes/g/lu/data/imaka/2017_01_10/fli/reduce/stats/' # Old Naming Scheme fnum1 = [ 8, 9, 12, 13, 16, 17, 22, 23, 26, 27, 32, 33, 36, 37, 42, 43, 48, 49, 52, 53, 58, 59 ] fnum2 = [ 62, 63, 66, 67, 72, 73, 76, 77, 80, 81, 86, 87, 90, 91, 94, 95, 100, 101, 104, 105 ] fnum = fnum1 + fnum2 img_files_old_name = [ reduce_dir + 'obj{0:03d}_clean.fits'.format(ii) for ii in fnum ] #New Naming Scheme fnum1 = [ 108, 109, 114, 115, 118, 119, 122, 123, 128, 129, 132, 133, 136, 137, 142, 143, 146 ] fnum2 = [ 147, 150, 151, 156, 157, 160, 161, 164, 165, 170, 171, 174, 175, 178, 179, 182, 183 ] fnum3 = [ 188, 189, 192, 193, 196, 197, 200, 201, 206, 207, 210, 211, 214, 215, 218, 219, 224 ] fnum4 = [225, 228, 229, 232, 233, 236, 237, 242, 243, 246, 247, 250, 251] fnum = fnum1 + fnum2 + fnum3 + fnum4 img_files_new_name = [ reduce_dir + 'obj_c{0:03d}_clean.fits'.format(ii) for ii in fnum ] img_files = img_files_old_name + img_files_new_name reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closed.fits') return
def calc_star_stats_ttf(): reduce_dir = '/Volumes/g/lu/data/imaka/2017_01_11/fli/reduce/' stats_dir = '/Volumes/g/lu/data/imaka/2017_01_11/fli/reduce/stats/' 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.calc_star_stats(img_files, output_stats=stats_dir + 'stats_ttf.fits') return
def analyze_stacks(): open_img_files = [stacks_dir + 'orion_stack_open.fits'] closed_img_files = [stacks_dir + 'orion_stack_closed_LS.fits', \ stacks_dir + 'orion_stack_closed_B2.fits'] #Find stars in image #reduce_fli.find_stars(open_img_files, fwhm=10, threshold=3, 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) reduce_fli.find_stars(closed_img_files, fwhm=7, threshold=3, 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) # 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
def calc_star_stats(): data_dir = root_dir + 'reduce/FLD2_2/' stats_dir = root_dir + 'reduce/stats/' # Open Loop fnum = [14, 17, 29, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59] fnum += [62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92] img_files = [ data_dir + 'obj{0:04d}_o_clean.fits'.format(ii) for ii in fnum ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_open.fits') # Closed A fnum = [12, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55] fnum += [58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91] img_files = [ data_dir + "obj{0:04d}_cA_clean.fits".format(ii) for ii in fnum ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closedA.fits') # Closed D fnum = [18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63] fnum += [66, 69, 72, 75, 78, 81, 84, 87, 90, 93] img_files = [ data_dir + "obj{0:04d}_cD_clean.fits".format(ii) for ii in fnum ] reduce_fli.calc_star_stats(img_files, output_stats=stats_dir + 'stats_closedD.fits') return
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
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] 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
def analyze_stacks(): data_dir = root_dir + 'reduce/pleiades/' img_files = [ data_dir + 'pleiades_stack_open_r.fits', data_dir + 'pleiades_stack_tt_r.fits', data_dir + 'pleiades_stack_closed_r.fits', data_dir + 'pleiades_stack_open_i.fits', data_dir + 'pleiades_stack_tt_i.fits', data_dir + 'pleiades_stack_closed_i.fits' ] 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_stacks.fits') return
def analyze_stacks(): open_img_files = [stacks_dir + 'FLD2_stack_open.fits'] closed_img_files = [ stacks_dir + 'FLD2_stack_threeWFSLS_B2_c.fits', stacks_dir + 'FLD2_stack_threeWFSMean_B2_c.fits', stacks_dir + 'FLD2_stack_threeWFS_LS.fits' ] #Find stars in image reduce_fli.find_stars(open_img_files, fwhm=9, 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=20, bottom_slice=0) reduce_fli.find_stars(closed_img_files, fwhm=4, 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=20, 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