def get_stdevmeans(muV2, muV3): V2stdevs, V2means, V3stdevs, V3means = [], [], [], [] for mv2, mv3 in zip(muV2, muV3): sd2, m2 = taf.find_std(mv2) V2stdevs.append(sd2) V2means.append(m2) sd3, m3 = taf.find_std(mv3) V3stdevs.append(sd3) V3means.append(m3) stdevmeans_values = [V2stdevs[0], V2means[0], V2stdevs[1], V2means[1], V2stdevs[2], V2means[2], V3stdevs[0], V3means[0], V3stdevs[1], V3means[1], V3stdevs[2], V3means[2]] return stdevmeans_values
ytrue = np.array([ -0.00305743, -0.03733417, 0.01302122, -0.00308733, -0.03736407, 0.01299132 ]) if arcsec: xinput, yinput = xinput * 3600.0, yinput * 3600.0 xtrue, ytrue = xtrue * 3600.0, ytrue * 3600.0 #xinput = np.array([ 468.44835572, 361.14052769, 403.66867649, 468.17048236, 360.83387397, 403.31142531]) #yinput = np.array([ -10.9953641, -134.41040845, 46.88318515, -11.082975, -134.50232193, 46.7519372]) #xtrue = np.array([ 468.45129306, 361.10923464, 403.66779144, 468.17840512, 360.8363467, 403.39490349]) #ytrue = np.array([ -10.99576619, -134.39204083, 46.88737556, -11.10340575, -134.49967787, 46.77973516]) # Determine the standard deviation for each array diffx = xtrue - xinput diffy = ytrue - yinput sigma_x, mean_x = taf.find_std(diffx) sigma_y, mean_y = taf.find_std(diffy) # debug print('These are the initial arrays: ') print(' xinput = ', xinput) print(' yinput = ', yinput) print(' original_means: deltaX = ', mean_x, ' deltaY = ', mean_y) print(' original_std_devs: sigmaX = ', sigma_x, ' sigmaY = ', sigma_y) abs_thres_data = abs_threshold_rejection( abs_threshold, niter, xinput, yinput, xtrue,
if 'shifted' in case: list_file = "simuTA20150528-F140X-S50-K-AB23-shifted.list" positions_file = "simuTA20150528-F140X-S50-K-AB23-shifted_positions.fits" if "scene2" in case: # Read the text file just written to get the offsets from the "real" positions of the fake stars path2listfile = main_path_infiles+"Scene_2_AB1823" list_file = "simuTA20150528-F140X-S50-K-AB18to23.list" positions_file = "simuTA20150528-F140X-S50-K-AB18to23_positions.fits" if 'shifted' in case: list_file = "simuTA20150528-F140X-S50-K-AB18to23-shifted.list" positions_file = "simuTA20150528-F140X-S50-K-AB18to23-shifted_positions.fits" lf = os.path.join(path2listfile,list_file) pf = os.path.join(path2listfile,positions_file) print (case) print (pf) star_number, xpos_arcsec, ypos_arcsec, factor, mag, bg_method = taf.read_listfile(lf, detector, background_method) _, true_x, true_y, trueV2, trueV3 = taf.read_positionsfile(pf, detector) # Select appropriate set of stars to test according to chosen detector if detector == 491: stars_detector = stars_491 elif detector == 492: stars_detector = stars_492 # offset lists x3offst, x5offst, x7offst = [], [], [] y3offst, y5offst, y7offst = [], [], [] studied_stars = [] # Start the loop in the given directory if not just_read_text_file:
xlabel, ylabel, plot_title=plot_title, labels_list=labels_list, xlims=xlims, ylims=ylims, print_side_string=print_side_string, print_side_values=print_side_values, save_plot=save_plot, show_plot=show_plot, destination=destination) # calculate mean of the thetas and standard deviation of the thetas theta_stdevs, theta_means = [], [] for th in theta: sd, m = taf.find_std(th) theta_stdevs.append(sd) theta_means.append(m) print_side_values = [ theta_stdevs[0], theta_stdevs[1], theta_stdevs[2], theta_means[0], theta_means[1], theta_means[2] ] # Thetas plot #v2theta_plot(cwincase, muV2, theta, save_plot=save_plot, show_plot=show_plot, destination=None) #v3theta_plot(cwincase, muV3, theta, save_plot=save_plot, show_plot=show_plot, destination=None) destination = results_path theta_plot(cwincase, theta, save_plot=save_plot, show_plot=show_plot, destination=destination,
101, 103, 105, 108, 109, 111, 113, 114, 133, 136, 147, 150, 157, 158, 161, 181, 184, 185, 186, 194, 199 ] detector = 491 scene = 1 arcsecs = True bkgd_method = 'frac' shutters = 'rapid' noise = 'real' verbose = True debug = False scene2study = "Scene" + str(scene) + "_" # get benckmark values benchmark_data, magnitudes = TAf.read_star_param_files(scene2study) bench_P1, bench_P2 = benchmark_data allbench_starP1, allbench_xP1, allbench_yP1, allbench_V2P1, allbench_V3P1, allbench_xLP1, allbench_yLP1 = bench_P1 allbench_starP2, allbench_xP2, allbench_yP2, allbench_V2P2, allbench_V3P2, allbench_xLP2, allbench_yLP2 = bench_P2 allbench_stars = allbench_starP1.tolist() # get the index for the sample stars star_idx_list = [] for st in stars_sample: st_idx = allbench_stars.index(st) star_idx_list.append(st_idx) # get the benchmark for star sample bench_starP1, bench_xP1, bench_yP1, bench_V2P1, bench_V3P1, bench_xLP1, bench_yLP1 = np.array( []), np.array([]), np.array([]), np.array([]), np.array([]), np.array( []), np.array([])
positions_file = "simuTA20150528-F140X-S50-K-AB23_positions.fits" if 'shifted' in dir2test: list_file = "simuTA20150528-F140X-S50-K-AB23-shifted.list" positions_file = "simuTA20150528-F140X-S50-K-AB23-shifted_positions.fits" if "Scene_2" in dir2test: # Read the text file just written to get the offsets from the "real" positions of the fake stars path2listfile = "../PFforMaria/Scene_2_AB1823" list_file = "simuTA20150528-F140X-S50-K-AB18to23.list" positions_file = "simuTA20150528-F140X-S50-K-AB18to23_positions.fits" if 'shifted' in dir2test: list_file = "simuTA20150528-F140X-S50-K-AB18to23-shifted.list" positions_file = "simuTA20150528-F140X-S50-K-AB18to23-shifted_positions.fits" lf = os.path.join(path2listfile,list_file) pf = os.path.join(path2listfile,positions_file) bench_star, xpos_arcsec, ypos_arcsec, factor, mag, bg_method = taf.read_listfile(lf, detector, background_method) _, true_x, true_y, trueV2, trueV3 = taf.read_positionsfile(pf, detector) """ *** WE ARE NOT USING THIS PART RIGHT NOW BECAUSE THE star_parameters.txt FILES HAVE THE SAME DATA FOR BOTH DETECTORS. # Read fits table with benchmark data from the star parameters file to compare results # xL: x-coordinate of the left edge of the postge stamp in the full image (range 0-2047) # xR: x-coord of right edge of the postage stamp # yL: y-coord of the lower edge of the postage stamp # yU: y-coord of the upper edge of the postage stamp star_param_txt = os.path.join(dir2test,"star parameters.txt") if detector ==492: star_param_txt = os.path.join(dir2test,"star parameters_492.txt") benchmark_data = np.loadtxt(star_param_txt, skiprows=3, unpack=True)
backgnd_subtraction_method, background_method, bg_value, bg_frac, debug ] recursive_centroids_info = [ xwidth_list, ywidth_list, checkbox_size, max_iter, threshold, determine_moments, display_master_img, vlim ] display_centroids_info = [case, show_disp, save_centroid_disp] if analyze_all_frac_values: for bgf in bg_frac: bg_corr_info = [ backgnd_subtraction_method, background_method, bg_value, bgf, debug ] x_centroids, y_centroids = taf.find_centroid( fits_file, bg_corr_info, recursive_centroids_info, display_centroids_info, x_centroids, y_centroids, fits_names, output_file_path, centroids_info, verbose) else: x_centroids, y_centroids = taf.find_centroid( fits_file, bg_corr_info, recursive_centroids_info, display_centroids_info, x_centroids, y_centroids, fits_names, output_file_path, centroids_info, verbose) # Write the results in a text file output_file = os.path.join(output_file_path, case + bg_choice + ".txt") line0 = "Centroid indexing starting at 1 !" if len(xwidth_list) == 1: line0a = "{:<50} {:>16} {:>20}".format("Fits file name", "Background", "Centroid window = 5") line0b = "{:>63} {:>10} {:>16}".format(background_method, "x", "y")