def create_frames(self): self.p_frame = tk.Frame(self.master) self.p_frame.pack(side='left') self.w_frame = tk.Frame(self.master) self.w_frame.pack(side='right') self.plots = plots.Plots(figsize=(11, 9), dpi=75) self.canvas = FigureCanvasTkAgg(self.plots, master=self.p_frame) self.canvas.draw() self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
def create_plots(data, results, modulus, output_dir): print("Creating Plots...") save_loc = Path(output_dir, "plots") modulus = int(modulus) * 10**6 #Create Models... N = 2000000 Nf = np.linspace(1, N, N) #Cycles to Failure Variable Rf = 2 * Nf #Reversals to Failure Variable plastic_SL = (results[3] * (Rf**results[4])) #Plastic Strain-Life elastic_SL = ( (results[0] / modulus) * (Rf**results[1])) #Elastic Strain-Life total_SL = plastic_SL + elastic_SL #Total Strain-Life stresslife = (results[6] * (Nf**results[7])) #Stress-Life #Plot Plastic Strain-Life... plots.Plots(None, save_loc).fatigue_loglog(data['MaxCycles'], data['PlasticAmp'], Rf, plastic_SL, "P") #Plot Elastic Strain-Life... plots.Plots(None, save_loc).fatigue_loglog(data['MaxCycles'], data['ElasticAmp'], Rf, elastic_SL, "E") #Plot Stress-Life... c = 10**-6 plots.Plots(None, save_loc).fatigue_loglog(data['MaxCycles'], data['StressRange'] * c, Nf, stresslife * c, "S") #Plot Strain Amp vs Cycles... StrainLife = total_SL * 100 plots.Plots(None, save_loc).fatigue_semilogX(data['MaxCycles'], data['StrainAmp'] * 100, Nf, StrainLife) #Plot total strain-life plots.Plots(None, save_loc).total_strain_life(Nf, plastic_SL, elastic_SL, total_SL)
def __init__(self, num_samples=None): if num_samples is not None: self.plotting = plots.Plots(N, num_samples, L) ### simulation variables self.an = numpy.zeros(N) # modal displacements self.adn = numpy.zeros(N) # modal velocities; "d" is for "dot" # positions self.x0 = 0 # bow or pluck self.x1 = 0 # finger self.x2 = 0 self.x3 = 0 self.phix0 = phi(self.x0) self.phix1 = phi(self.x1) self.phix2 = phi(self.x2) self.phix3 = phi(self.x3) self.K0 = 0 self.K1 = 0 self.K2 = 0 self.K3 = 0 self.R0 = 0 self.R1 = 0 self.R3 = 0 self.ypluck = 0 self.plucks_left = False self.release = False self.x_finger = 0 self.x_pluck = 0 self.K_pluck = 0 self.K_finger = 0 self.R_pluck = 0 self.R_finger = 0 # bowing stuff self.Fb = False self.vb = 0 self.bowstate = 0 # 0=stick, 1=slip self.debug_max_dv0h = 0 self.debug_prev_dv = 0 self.debug_prev_v0h = 0 self.debug_dv = 0 self.debug_print_state = False self.debug_tick = 0 self.debug_plucks = 0 self.debug_slips = 0
def plot0(): """ Plots the intensity/interference pattern. """ fig = plt.figure(figsize=(9, 6)) ax00 = plt.subplot2grid((10, 1), (0, 0), rowspan=8) pattern00 = ax00.errorbar(x, intensity_values[0][0], yerr=intensity_values[0][1], fmt='g-', linewidth=1, label='measurements') fitted_pattern00 = ax00.errorbar(x, intensity_values_fit[0][0], yerr=intensity_values_fit[0][1], fmt='b-', linewidth=1, label='fitted') title00 = ax00.set_title( "$i$ = %i, $\lambda$ = %i, $stroke$ = %0.4f$\mu m$, $voltage$ = %0.2fV" % (0, fitted_cos_period[0][0], stroke_values[0][0], voltages[0]), fontsize=16) ax00.set_xlim(x[0], x[-1]) ax00.set_ylim(smallest_intensity(intensity_values_fit), largest_intensity(intensity_values_fit)) ax00.legend() ax00.tick_params(labelsize=16) ax00.set_ylabel('$Intensity$', fontsize=18) ax00.set_xlabel('$Distance$ $(Pixel)$', fontsize=18) ax00.legend(fontsize=18) axcolor = 'lightgoldenrodyellow' ax_slider = plt.axes([0.15, 0.1, 0.65, 0.03], facecolor=axcolor) slide = Slider(ax_slider, 'i', 0, no_of_images - 1, valinit=0, valfmt='%i') plot_list = plots.Plots() plot_list.adderrorbar(pattern00) plot_list.adderrorbar(fitted_pattern00) def update(val): """ Allows the change of interference pattern with the slider. """ val = int(val) plot_list.removeerrorbar(n=-1) plot_list.removeerrorbar(n=-1) pattern00 = ax00.errorbar(x, intensity_values[val][0], yerr=intensity_values[val][1], fmt='g-', linewidth=1, label='measurements') fitted_pattern00 = ax00.errorbar(x, intensity_values_fit[val][0], yerr=intensity_values_fit[val][1], fmt='b-', linewidth=1, label='fitted') plot_list.adderrorbar(pattern00) plot_list.adderrorbar(fitted_pattern00) title00.set_text( "$i$ = %i, $\lambda$ = %0.5f, $stroke$ = %0.4f$\mu m$, $voltage$ = %0.2fV" % (val, fitted_cos_period[0][val], stroke_values[0][val], voltages[val])) plt.draw() return slide.on_changed(update) return slide
if __name__ == '__main__': print("\n\t\tДанные для входа находятся в файле 'account.txt'" + "\n") print("\t\tДанные записываются в формате ->app_id login password" + "\n") # Авторизация a = sing_in.SignIn() session_vk = a.authorization_vk() print("Авторизация прошла успешно\n") print("Начинаем парсинг группы...\n") p = parsing.Parsing() result_parsing = p.parsing(session_vk) print("Парсинг выполнен успешно\n") f = filter.Filter(result_parsing) man, girl = f.filter_sex() print("В группе мужчин =", man, " и девушек =", girl, "\n") birth_data_age = [] birth_data_count = [] birth_data_age, birth_data_count = f.filter_bdate() pl = plots.Plots() pl.round_plot(birth_data_age, birth_data_count) print("\nДиаграмма построена\n") input("\nНажмите Enter, чтобы выйти\n")
def mono_analysis( input_dir, output_dir, files, channels, stress_bool, geo_bool ): with open((str(output_dir) + '/Monotonic_Output.csv'),'w', newline='') as f: thewriter = csv.writer(f,delimiter=',') thewriter.writerow([ 'File Name','Start Position (mm)','End Position (mm)', 'Nominal Extension(mm)','Poissons Ratio','Tensile Modulus (GPa)', '0.2% Offset Strength (MPa)','0.2% Offset Strain (m/m)', 'Max Load (kN)','Yield Stress (MPa)','Yield Strain(m/m)', 'Ult. True Strength (MPa)','Engineering Fracture Strength (MPa)', 'Ult. True Ductility (m/m)','Max Axial Strain (%)', 'Max Transverse Strain (%)' ]) print("Beginning Analysis Iteration...") runs = [] names = [] for filename in files: this_file = Path(input_dir,filename) name = str(filename) print(" Reading File ",name) #Create Instance... run = Monotonic( channels, stress_bool, geo_bool, this_file ) #Get positions... p1, p2, ext = run.get_positions() #Get true stress and strain... true_stress, true_strain = run.get_true() #Get elastic modulus and Poissons ratio... poissons, emod = run.get_modulus_and_poissons() #get 0.2% offset strain and stress... offset_strain, offset_stress = run.get_offset(emod) #Get yield point(max of stress-strain curve)... yield_stress, yield_strain, max_load = run.get_yield() #Get fracture stress and strain... engr_frac_strength, max_ax_str, max_tr_str = run.get_engr_fracture() #Get ultimate true stress/strain... max_true_stress = max(true_stress) max_true_strain = max(true_strain) #Write values to file for each test... thewriter.writerow([ name, p1, p2, ext, poissons, emod*10**-9, offset_stress*10**-6, offset_strain,max_load/1000, yield_stress*10**-6, yield_strain, max_true_stress*10**-6, engr_frac_strength*10**-6, max_true_strain, max_ax_str*100, max_tr_str*100 ]) #make Individual Test Plot... plots.Plots( name[:-4],Path(str(output_dir),'plots') ).mono_test_plot( run.ax_str,run.stress,true_strain,true_stress ) runs.append(run) names.append(name[:-4]) print("Saving Results...") #Plots... print("Creating Plots...") plots.Plots( name[:-4],Path(str(output_dir),'plots') ).mono_all_plot(runs,names)
plotname = os.path.basename(args.flight) elif args.aura_flight: plotname = os.path.basename(args.aura_flight) elif args.px4_sdlog2: plotname = os.path.basename(args.px4_sdlog2) elif args.sentera_flight: plotname = os.path.basename(args.sentera_flight) elif args.sentera2_flight: plotname = os.path.basename(args.sentera2_flight) elif args.umn_flight: plotname = os.path.basename(args.umn_flight) else: plotname = "plotname not set correctly" # plots plt = plots.Plots(plotname) # plot onboard filter data_ob = data_store.data_store() for filterpt in data['filter']: data_ob.append_from_filter(filterpt) plt.update(data_ob, 'On Board', c='g', alpha=0.5) # plot gps data_gps = data_store.data_store() for gpspt in data['gps']: data_gps.append_from_gps(gpspt) plt.update(data_gps, 'GPS', marker='*', c='g', alpha=0.5) # find the range of gps time stamps that represent some significant # amount of velocity
import plots p = plots.Plots() #p.tweet_intensity() # Figura 2 #p.tweets_and_users_by_month() # Figura 3 #p.time_intervals() # Figura 5 #p.time_intervals_detail() # Figura 5 detalle #p.distance_between_tweets_and_pois() # Figura 6 #p.avg_stddev_distance_to_POI() # Figura 6 #p.time_gap_between_consecutive_tweets() # Figura 7 #p.time_distribution() # Figura 8 p.avg_distance_and_interval() # Scatter distancia vs intervalo #p.avg_distance_and_interval_detail() # Scatter distancia vs intervalo #p.users_by_month() #p.tweets_by_month()