def calibrate_array(self): self.file_list = basic_file_app.get_file_list(self.file_path) my_calibration = calibration_analytical_from_array.CalibrateArray( self.calibration_parameter, self.directory) for x in self.file_list: my_array = basic_file_app.load_2d_array(self.file_path + x, 0, 1, 2) my_calibration.set_input_array(my_array, x) my_calibration.main() my_calibration.save_data( "back: " + path_background + "RZP-structure:___" + rzp_structure_name, roi_list)
def px_shift(self): self.file_list = basic_file_app.get_file_list(self.new_dir) print(len(self.file_list)) reference = basic_file_app.load_2d_array( self.new_dir + '/' + self.file_list[0], 0, 1, 1) #print("new file list", self.file_list) for x in self.file_list[1:]: image_array = basic_file_app.load_2d_array(self.new_dir + '/' + x, 0, 1, 1) ShiftIt = px_shift_on_picture_array.PixelShift( reference, self.reference_points) corrected_array = ShiftIt.evaluate_shift_for_input_array( image_array) self.overwrite_original(x, corrected_array) plt.close()
def plot_them_all(path, column_x, column_y, skip_rows): file_list = basic_file_app.get_file_list(path) for x in file_list[7:13]: array = basic_file_app.load_2d_array(path + '/' + x, column_x, column_y, skip_rows) plt.figure(1) plt.plot(array[:, 0], -np.log(array[:, 1]) + 14, marker=".", markersize=3) plt.xlabel("eV") plt.ylabel("-log(signal) - const") plt.legend() plt.show()
def avg_of_stack(self): self.file_list = basic_file_app.get_file_list(self.directory) print("xxxxxxxxxxxxxx mean value of stack xxxxxxxxxxxxx") print(self.directory, "path") print(self.file_list) my_avg = basic_file_app.StackMeanValue(self.file_list, self.directory, 1, 2, 4) my_result = my_avg.get_result() plt.figure(10) plt.plot(my_result[:, 0], -np.log(my_result[:, 1]) + 16, label="my_avg") save_pic = os.path.join(self.directory, self.directory[4:] + "_mean" + ".png") plt.savefig(save_pic, bbox_inches="tight", dpi=500) return my_result
def batch_single_pictures_background(): for x in file_list_raws: open_stack_raws = basic_image_app.SingleImageOpen(x, path_picture) my_single_picture = open_stack_raws.return_single_image() scaled_straylight_correction = process_raw_images_sum_then_back.ImagePreProcessing( my_single_picture, x[:-4], my_background, "straylight", roi_list1) scaled_straylight_correction.main() scaled_straylight_correction.save_data( "single_image_sum_and_then_back") #batch_single_pictures_background() path = "data/SiN_105ms_variant_2/" binned_file_list = basic_file_app.get_file_list(path) reference_points = (1128, 980) def batch_pixel_correction(): reference_array = basic_file_app.load_2d_array(path + binned_file_list[0], 0, 1, 4) PixelCorrection = px_shift_on_picture_array.PixelShift( reference_array, reference_points) my_result = reference_array for x in binned_file_list[1:]: my_array = basic_file_app.load_2d_array(path + x, 0, 1, 4) corrected_array = PixelCorrection.evaluate_shift_for_input_array( my_array) my_result[:, 1] = my_result[:, 1] + corrected_array[:, 1]
def create_file_list(self): return basic_file_app.get_file_list(self.path)
result = np.vstack((header, header2, result)) save_name = os.path.join(new_dir, file_name + 'avg' + ".txt") np.savetxt(save_name, result, delimiter=' ', header='string', comments='', fmt='%s') my_path = "results_cal_5000ms_pos2/" avg_path = "results_avg" result_file_name = "20210628_5000ms_pos2_avg" #os.mkdir(avg_path) my_files = basic_file_app.get_file_list(my_path) #class(path, scale, column) -> skiprows in the code test = AvgOnStack1Column(my_path, 1., 2) my_avg = test.integrate_over_stack() #create x-axis from one of the files (path+name, column, skip-rows) my_x = basic_file_app.load_1d_array(my_path + '/' + my_files[0], 1, 6) my_error = test.standard_deviation() test.save_statistics(avg_path, result_file_name) #plt.scatter(my_x[:], my_avg[:]) plt.figure(1) plt.errorbar(my_x[:], my_avg[:], yerr=my_error, fmt="o", label=result_file_name)