Best Python code snippet using locust
iron_source.py
Source:iron_source.py
1import ROOT2from array import array3ROOT.gROOT.SetBatch()4#ROOT.gStyle.SetOptFit(1011)5log = True6fileout = ROOT.TFile("Iron_source.root", "RECREATE")7V_g1t = array('f', [400, 395, 390, 385, 380, 375, 370, 365, 360, 355, 350, 345, 340, 335, 330, 325, 320, 315, 310, 305, 300, 295, 290, 285, 280, 275, 270, 265, 260, 250])#, 240, 200,225,235,180,150,175,100,125,75,50])8I_g1t = array('f', [0.033, 0.026, 0.0235, 0.02175, 0.0185, 0.0165, 0.015, 0.013, 0.01175, 0.0110, 0.00975, 0.0085, 0.00725, 0.00625, 0.00585, 0.00510, 0.00425, 0.00375, 0.00325, 0.00280, 0.00225, 0.0020, 0.0017, 0.0014, 0.0011, 0.0009, 0.00075, 0.0006, 0.0003, 0.000])#, -0.0005, -0.0003, -0.00015, -0.0008, -0.0009, -0.0007, -0.001, -0.0009, -0.001, -0.001])9V_g2t = array('f', [400, 395, 385, 370, 360, 350, 330, 310, 290, 270])10I_g2t = array('f', [0.0020, 0.0020, 0.0015, 0.00125, 0.0012, 0.001, 0.0008, 0.0007, 0.0006, 0.0005])11Err_Vg1t = array('f', [3]*len(V_g1t))12Err_Ig1t = array('f', [abs(i)*0.05 for i in I_g1t])13#print Err_Vg1t, Err_Ig1t14Err_Vg2t = array('f', [3]*len(V_g2t))15Err_Ig2t = array('f', [abs(i)*0.05 for i in I_g2t])16#print Err_Vg2t, Err_Ig2t17g_t1 = ROOT.TGraphErrors(len(V_g1t), V_g1t, I_g1t, Err_Vg1t, Err_Ig1t)18g_t1.SetName("G1T")19g_t1.SetTitle("Pico current monitor with the source; V_{G1T}[V]; I_{G1T}[uA]")20g_t1.SetLineColor(ROOT.kBlack)21g_t1.SetMarkerColor(ROOT.kBlack)22func_t1 = ROOT.TF1("func_t1", "[0]*x^[1]", 270, 400)23func_t1.SetParameters(3.4292E-27, 9.6048)24g_t1.Write()25g_t1.Fit(func_t1)26par1, par2 = func_t1.GetParameter(0), func_t1.GetParameter(1)27c1 = ROOT.TCanvas("g_t1", "c1", 50,50,700,600)28g_t1.Draw("AEP")29func_t1.Draw("SAME")30latex = ROOT.TLatex()31latex.SetTextSize(0.045);32latex.SetTextAlign(13)33latex.DrawLatex(320, max(I_g2t)/2,"I = %.3e*V^{%.3f}" %(par1, par2))34if log:35 c1.SetLogy(1)36c1.Print("g_t1_iron.png")37c1.Print("g_t1_iron.root")38g_t2 = ROOT.TGraphErrors(len(V_g2t), V_g2t, I_g2t, Err_Vg2t, Err_Ig2t)39g_t2.SetName("G2T")40g_t2.SetTitle("Pico current monitor with the source; V_{G2T}[V]; I_{G2T}[uA]")41g_t2.SetLineColor(ROOT.kBlue)42g_t2.SetMarkerColor(ROOT.kBlue)43func_t2 = ROOT.TF1("func_t2", "[0]*x^[1]", 270, 400)44func_t2.SetParameters(2.19031e-12, 3.42068)45g_t2.Write()46g_t2.Fit(func_t2)47par1, par2 = func_t2.GetParameter(0), func_t2.GetParameter(1)48c2 = ROOT.TCanvas("g_t2", "c1", 50,50,700,600)49g_t2.Draw("AEP")50func_t2.Draw("SAME")51latex = ROOT.TLatex()52latex.SetTextSize(0.045);53latex.SetTextAlign(13)54latex.DrawLatex(320, max(I_g2t)/4,"I = %.3e*V^{%.3f}" %(par1, par2))55if log:56 c2.SetLogy(1)57c2.Print("g_t2_iron.png")58c2.Print("g_t2_iron.root")59fileout.Close()60'''61 TF2 *v_pow = new TF2("v_pow", "expo", 320, 450);62 TCanvas* c_tt = new TCanvas("C_tt", "PICO output G3Top", 800, 550);63 g_t2.Draw("AEP");64 g_t2.Write();...
tkinter_button_bind.py
Source:tkinter_button_bind.py
...25 def func_flair(self, _event=None):26 user_in='FLAIR'27 root.destroy()28 29 def func_t1(self, _event=None):30 user_in='T1'31 root.destroy()32 33 def func_t2(self, _event=None):34 user_in='T2'35 root.destroy()36root = Tk()37root.title("SEE image and ENTER its information")38abc = MyClass(root)...
Exam_16.3g.py
Source:Exam_16.3g.py
1def compose(func_T1, func_T2):2 def func(x):3 return func_T1(func_T2(x))4 return func5def add3(x):6 return x + 37def mul7(x):8 return x * 79print(compose(mul7, add3)(1))10print(compose(add3, mul7)(2))11print(compose(mul7, str)(3))...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!