def single_fitting(are_four_col): """ Gets parameters from window, executes fitting for the chosen file (four or two columns depending on argument's value) displays fitting curves and data points from file :param are_four_col: :return: """ # LOADING DATA AND AGGREGATION save_btn.place_forget() data = None if are_four_col: data = load_files.load_mapping_file(file_name.get()) else: data = load_files.load_two_column_file(file_name.get()) omega = data[2] intensity = data[3] is_bg_active = active_bg.get() result = ns.find_grain_diameter( omega, intensity, float(min_size.get()), float(max_size.get()) + float(size_step.get()), float(size_step.get()), True, read_params(), is_bg_active, ) global f f.clf() f = result[4] f.suptitle(file_name.get().split("/")[-1]) global canvas canvas = FigureCanvasTkAgg(f, master=root) canvas.get_tk_widget().place(x=0, y=30) canvas.get_tk_widget().configure(border=0, width=650, height=450) map_rbtn_one.place_forget() map_rbtn_two.place_forget() map_rbtn_three.place_forget() map_rbtn_four.place_forget() map_param_rbtn_one.place_forget() map_param_rbtn_two.place_forget() map_param_rbtn_three.place_forget() map_param_rbtn_four.place_forget() save_btn.place(x=545, y=1)
def single_fitting(are_four_col): """ Gets parameters from window, executes fitting for the chosen file (four or two columns depending on argument's value) displays fitting curves and data points from file :param are_four_col: :return: """ # LOADING DATA AND AGGREGATION save_btn.place_forget() data = None if are_four_col: data = load_files.load_mapping_file(file_name.get()) else: data = load_files.load_two_column_file(file_name.get()) omega = data[2] intensity = data[3] is_bg_active = active_bg.get() result = ns.find_grain_diameter( omega, intensity, float(min_size.get()), float(max_size.get()) + float(size_step.get()), float(size_step.get()), True, read_params(), is_bg_active) global f f.clf() f = result[4] f.suptitle(file_name.get().split('/')[-1]) global canvas canvas = FigureCanvasTkAgg(f, master=root) canvas.get_tk_widget().place(x=0, y=30) canvas.get_tk_widget().configure(border=0, width=650, height=450) map_rbtn_one.place_forget() map_rbtn_two.place_forget() map_rbtn_three.place_forget() map_rbtn_four.place_forget() map_param_rbtn_one.place_forget() map_param_rbtn_two.place_forget() map_param_rbtn_three.place_forget() map_param_rbtn_four.place_forget() save_btn.place(x=545, y=1)
def calibrate(): # LOADING DATA AND AGGREGATION save_btn.place_forget() data = load_files.load_two_column_file(file_name.get()) omega = data[2] intensity = data[3] result = fo.perform_fitting(omega, intensity, float(min_size.get()), float(max_size.get()) + float(size_step.get())) sigma_1.delete(0, tk.END) sigma_1.insert(0, result[0][0]) sigma_1.config(foreground="green") sigma_0_1.delete(0, tk.END) sigma_0_1.insert(0, result[0][1]) sigma_0_1.config(foreground="green") amplitude_1.delete(0, tk.END) amplitude_1.insert(0, result[0][2]) amplitude_1.config(foreground="green") global f f.clf() f = result[1] f.suptitle( "omega:{0:.4f}[cm^-1] hwhm:{1:.4f}[cm^-1] inten:{2:.4}[arb]".format( result[0][0], result[0][1], result[0][2] ) ) global canvas canvas = FigureCanvasTkAgg(f, master=root) canvas.get_tk_widget().place(x=0, y=30) canvas.get_tk_widget().configure(border=0, width=650, height=450) map_rbtn_one.place_forget() map_rbtn_two.place_forget() map_rbtn_three.place_forget() map_rbtn_four.place_forget() map_param_rbtn_one.place_forget() map_param_rbtn_two.place_forget() map_param_rbtn_three.place_forget() map_param_rbtn_four.place_forget() save_btn.place(x=545, y=1)
def calibrate(): # LOADING DATA AND AGGREGATION save_btn.place_forget() data = load_files.load_two_column_file(file_name.get()) omega = data[2] intensity = data[3] result = fo.perform_fitting(omega, intensity, float(min_size.get()), float(max_size.get()) + float(size_step.get())) sigma_1.delete(0, tk.END) sigma_1.insert(0, result[0][0]) sigma_1.config(foreground="green") sigma_0_1.delete(0, tk.END) sigma_0_1.insert(0, result[0][1]) sigma_0_1.config(foreground="green") amplitude_1.delete(0, tk.END) amplitude_1.insert(0, result[0][2]) amplitude_1.config(foreground="green") global f f.clf() f = result[1] f.suptitle( "omega:{0:.4f}[cm^-1] hwhm:{1:.4f}[cm^-1] inten:{2:.4}[arb]". format(result[0][0], result[0][1], result[0][2])) global canvas canvas = FigureCanvasTkAgg(f, master=root) canvas.get_tk_widget().place(x=0, y=30) canvas.get_tk_widget().configure(border=0, width=650, height=450) map_rbtn_one.place_forget() map_rbtn_two.place_forget() map_rbtn_three.place_forget() map_rbtn_four.place_forget() map_param_rbtn_one.place_forget() map_param_rbtn_two.place_forget() map_param_rbtn_three.place_forget() map_param_rbtn_four.place_forget() save_btn.place(x=545, y=1)