def main_process(): # get original path as str and list path = os.getcwd() list_path = path.split("/") del list_path[0] # get info from path date = list_path[-3] telescope = list_path[-5] # get filters from path temp = list_path[-1] temp_list = temp.split("_") filters = temp_list[0] # go to the dir of calibrate path_of_source = tat_datactrl.get_path("source") path_of_calibrate = "{0}/{1}/calibrate".format(path_of_source, telescope) os.chdir(path_of_calibrate) # get a list of all object in calibrate date_list = os.listdir(path_of_calibrate) # find the nearest date reference to original date.w result_date = match_date(date, date_list) if result_date == -1: print "date list has been zero, program ended" return -1 # determind the exptime of flat exptime = find_exptime(date, date_list, filters) if exptime == -1: print "date list has been zero" return -1 # defind the dir of median flat, if it doesn't exist , create it. path_of_median_flat = path_of_source + "/" + telescope + "/calibrate/" + result_date[ 1] + "/median_flat_" + filters + "_" + exptime print "path of median flat is :" + path_of_median_flat if os.path.isdir(path_of_median_flat): temp = "rm -r " + path_of_median_flat os.system(temp) temp = "mkdir -p " + path_of_median_flat os.system(temp) # get flat os.chdir(result_date[1]) print os.getcwd() number = get_flat_to(telescope, filters, result_date[1], path_of_median_flat) os.chdir("..") if number < 10: number = sub_process(telescope, filters, result_date, path_of_median_flat, date, date_list) if number < 10: print "The number of flat is not enough, no median flat create." return 0 os.chdir(path_of_median_flat) temp = "finddark.py" os.system(temp) temp = "rm Median_flat*" os.system(temp) temp = "median_flat.py " + filters os.system(temp) temp = 'cp Median_flat*n.fits ' + path os.system(temp) os.chdir(path)
def main_process(): # get original path as str and list path = os.getcwd() list_path = path.split("/") del list_path[0] # get info from path path_of_source = tat_datactrl.get_path("source") temp_path = path.split(path_of_source) temp_path_2 = temp_path[1].split("/") date = temp_path_2[3] telescope = temp_path_2[1] # get exptime from path temp = list_path[-1] temp_list = temp.split("_") exptime = temp_list[-1] # go to the dir of calibrate path_of_calibrate = path_of_source + "/" + telescope + "/calibrate" os.chdir(path_of_calibrate) # get a list of all object in calibrate obj_list = os.listdir(path_of_calibrate) # find the nearest date reference to original date. result_date = match_date(date, obj_list) # defind the dir of median dark, if it doesn't exist , create it path_of_median_dark = path_of_source + "/" + telescope + "/calibrate/" + result_date[ 1] + "/dark_" + exptime print "path of median dark is :" + path_of_median_dark if os.path.isdir(path_of_median_dark) == False: temp = "mkdir -p " + path_of_median_dark os.system(temp) # get dark os.chdir(result_date[1]) number = get_dark_to(telescope, exptime, result_date[1], path_of_median_dark) os.chdir("..") # check whether the number of dark is enough, if no, find other darks. if number >= 10: os.chdir(path_of_median_dark) temp = "median_fits dark" os.system(temp) Median_dark = "Median_dark_" + date + "_" + exptime + ".fits" print "The dark name is :" + Median_dark temp = "mv Median_dark.fits " + Median_dark os.system(temp) temp = "cp -R " + Median_dark + " " + path os.system(temp) else: del obj_list[result_date[0]] sub_process(path, telescope, obj_list, date, path_of_median_dark, exptime) os.chdir(path_of_median_dark) temp = "median_fits dark" os.system(temp) Median_dark = "Median_dark_" + date + "_" + exptime + ".fits" print "The dark name is :" + Median_dark temp = "mv Median_dark.fits " + Median_dark os.system(temp) temp = "cp -R " + Median_dark + " " + path os.system(temp)
list_name=argv[-1] # read fits name from list fits_list=tat_datactrl.readfile(list_name) # get property of images from path data_list = np.array([]) path = os.getcwd() list_path = path.split("/") scope_name = list_path[-5] date_name = list_path[-3] obj_name = list_path[-2] filter_name = list_path[-1] # write down header path_of_result = tat_datactrl.get_path("result") result_data_name = "{7}/limitation_magnitude_and_noise/{0}_{1}_{2}_{3}_{4}_{5}_{6}_N_to_t".format(obj_name, filter_name, date_name, scope_name, method, noise_unit, list_name, path_of_result) result_fig_name = "{7}/limitation_magnitude_and_noise/{0}_{1}_{2}_{3}_{4}_{5}_{6}_N_to_t.png".format(obj_name, filter_name, date_name, scope_name, method, noise_unit, list_name, path_of_result) result_file = open(result_data_name, "a") result_file.write(obj_name + "_Noise_to_time\n") result_file.write("filter: {0}\n".format(filter_name)) result_file.write("date: {0}\n".format(date_name)) result_file.write("scope: {0}\n".format(scope_name)) result_file.write("stack method: {0}\n".format(method)) result_file.write("list name: {0}\n".format(list_name)) # mention the noise has been normalize result_file.write("normalize noise: yes") if noise_unit == "count": result_file.write("fitting function: noise = base/np.power(exptime, pow_) + const\n") result_file.write("*************************************************************\n")
result_file.write("\t\t") result_file.write("\n") result_file.close() #-------------------------------------------- # main code VERBOSE = 0 # measure times start_time = time.time() # get property from argv list_name = argv[-1] fits_list = tat_datactrl.readfile(list_name) # path of data source path_of_source = tat_datactrl.get_path("result") path_of_data_source = "{0}/TAT_row_star_catalog/".format(path_of_source) os.chdir(path_of_data_source) row_star_catalog_list = glob.glob("*.tsv") # path of output path_of_output = "{0}/TAT_star_catalog/".format(path_of_source) os.chdir(path_of_output) # list of band for name in row_star_catalog_list: if VERBOSE > 0: print "--- current: {0} ---".format(name) # read a tsv file which haven't been prcoessed name_list = name.split("_") name_dir = "{0}{1}".format(path_of_data_source, name) temp_data = tat_datactrl.read_tsv_file(name_dir) date = name_list[1] band = "{0}_{1}".format(name_list[3], name_list[4])