How to use func_t2 method in locust

Best Python code snippet using locust

graphs.py

Source: graphs.py Github

copy

Full Screen

1import matplotlib.pyplot as plt2from numpy import linspace, meshgrid, arange3import constants as const4def FunctionLevelRoute(f, xst1, xst2, axis = 'horizontal', name = None):5 x = linspace(const.interval['x1'][0] * 1.5, const.interval['x1'][1] * 1.5, 1000)6 y = linspace(const.interval['x2'][0] * 1.5, const.interval['x2'][1] * 1.5, 1000)7 X, Y = meshgrid(x, y)8 Z = f([X, Y])9 levels = linspace(10 min(min(f([xst1[0], xst1[1]])), min(f([xst2[0], xst2[1]]))),11 max(max(f([xst1[0], xst1[1]])), max(f([xst2[0], xst2[1]]))),12 const.levels13 )14 fig = plt.figure()15 fig.suptitle(name)16 # T1 contour17 plt.subplot(1, 2, 1) if axis == 'horizontal' else plt.subplot(2, 1, 1)18 plt.xlabel('X1')19 plt.ylabel('X2')20 plt.plot(xst1[0], xst1[1], 'o--', color = 'magenta', label = 'Route for T1', zorder = 5)21 plt.plot(xst2[0], xst2[1], 'o--', color = 'blueviolet', alpha = 0.3, label = 'Route for T2', zorder = 4)22 plt.contour(X, Y, Z, levels, colors = 'purple', zorder = 3)23 plt.contourf(X, Y, Z, levels, cmap = 'RdPu', zorder = 2, alpha = 0.7)24 plt.legend()25 plt.grid(zorder = 1)26 # T2 contour27 plt.subplot(1, 2, 2) if axis == 'horizontal' else plt.subplot(2, 1, 2)28 plt.xlabel('X1')29 plt.ylabel('X2')30 plt.plot(xst1[0], xst1[1], 'o--', color = 'magenta', alpha = 0.3, label = 'Route for T1', zorder = 4)31 plt.plot(xst2[0], xst2[1], 'o--', color = 'blueviolet', label = 'Route for T2', zorder = 5)32 plt.contour(X, Y, Z, levels, colors = 'purple', zorder = 3)33 contourf = plt.contourf(X, Y, Z, levels, cmap = 'RdPu', zorder = 2, alpha = 0.7)34 plt.legend()35 plt.grid(zorder = 1)36 fig.subplots_adjust(right = 0.85)37 colorbar_ax = fig.add_axes([0.9, 0.15, 0.025, 0.7])38 fig.colorbar(contourf, cax = colorbar_ax)39 plt.show()40def Xk(xst1, xst2, name = None):41 x1_t1 = xst1[0]42 x2_t1 = xst1[1]43 K_t1 = range(len(x1_t1))44 plt.figure().suptitle(name)45 # X1 T1 graph46 plt.subplot(2, 2, 1)47 plt.xlabel('K')48 plt.ylabel('X1')49 plt.title('X1 steps for T1')50 plt.grid()51 if len(K_t1) < 10:52 plt.xticks(arange(len(x1_t1), step = 1))53 plt.plot(K_t1, x1_t1, 'o--')54 plt.plot(K_t1, x2_t1, 'ko--', color = 'grey', alpha = 0.3)55 plt.legend(['X1', 'X2'])56 # X2 T1 graph57 plt.subplot(2, 2, 2)58 plt.xlabel('K')59 plt.ylabel('X2')60 plt.title('X2 steps for T1')61 plt.grid()62 if len(K_t1) < 10:63 plt.xticks(arange(len(x2_t1), step = 1))64 plt.plot(K_t1, x2_t1, 'o--')65 plt.plot(K_t1, x1_t1, 'o--', color = 'grey', alpha = 0.3)66 plt.legend(['X2', 'X1'])67 x1_t2 = xst2[0]68 x2_t2 = xst2[1]69 K_t2 = range(len(x1_t2))70 # X1 T2 graph71 plt.subplot(2, 2, 3)72 plt.xlabel('K')73 plt.ylabel('X1')74 plt.title('X1 steps for T2')75 plt.grid()76 if len(K_t2) < 10:77 plt.xticks(arange(len(x1_t2), step = 1))78 plt.plot(K_t2, x1_t2, 'o--')79 plt.plot(K_t2, x2_t2, 'ko--', color = 'grey', alpha = 0.3)80 plt.legend(['X1', 'X2'])81 # X2 T2 graph82 plt.subplot(2, 2, 4)83 plt.xlabel('K')84 plt.ylabel('X2')85 plt.title('X2 steps for T2')86 plt.grid()87 if len(K_t2) < 10:88 plt.xticks(arange(len(x2_t2), step = 1))89 plt.plot(K_t2, x2_t2, 'o--')90 plt.plot(K_t2, x1_t2, 'o--', color = 'grey', alpha = 0.3)91 plt.legend(['X2', 'X1'])92 plt.show()93def Xs(xs, name = None):94 plt.xlabel('Xs2')95 plt.ylabel('Xs1')96 plt.title(name)97 plt.grid()98 plt.plot(xs[1], xs[0], 'o-')99 plt.legend([f'X steps'])100 plt.show()101def FunctionK(f, xst1, xst2, func_num, name = None):102 func_t1 = [f([xst1[0][i], xst1[1][i]]) for i in range(len(xst1[0]))]103 K_t1 = range(len(func_t1))104 func_t2 = [f([xst2[0][i], xst2[1][i]]) for i in range(len(xst2[0]))]105 K_t2 = range(len(func_t2))106 plt.figure().suptitle(name)107 # T2 graph108 plt.subplot(1, 2, 1)109 plt.xlabel('K')110 plt.ylabel('F(x1, x2)')111 plt.grid()112 plt.plot(K_t1, func_t1, 'mo-')113 plt.plot(K_t2, func_t2, 'mo-', alpha = 0.3)114 plt.legend(['Function values for T1',115 'Function values for T2'])116 # T2 graph117 plt.subplot(1, 2, 2)118 plt.xlabel('K')119 plt.ylabel('F(x1, x2)')120 plt.grid()121 plt.plot(K_t1, func_t1, 'mo-', alpha = 0.3)122 plt.plot(K_t2, func_t2, 'mo-')123 plt.legend([f'Function values for T1',124 f'Function values for T2'])125 plt.show()126def Fk(f1, xs1, f2, xs2):127 tmp_func1 = [f1([xs1[0][i], xs1[1][i]]) for i in range(1, len(xs1[0]))]128 tmp_func2 = [f2([xs2[0][i], xs2[1][i]]) for i in range(1, len(xs2[0]))]129 if len(tmp_func1) < len(tmp_func2):130 for i in range(len(tmp_func1), len(tmp_func2)):131 tmp_func1.append(tmp_func1[-1])132 elif len(tmp_func2) < len(tmp_func1):133 for i in range(len(tmp_func2), len(tmp_func1)):134 tmp_func2.append(tmp_func2[-1])135 K = range(max(len(tmp_func1), len(tmp_func2)))136 # F1 graph137 plt.subplot(1, 2, 1)138 plt.xlabel('K')139 plt.ylabel('Function 1')140 plt.title('Function 1 values')141 plt.grid()142 plt.plot(K, tmp_func1, 'mo--')143 plt.plot(K, tmp_func2, 'ko--', color = 'grey', alpha = 0.3)144 plt.legend(['Function 1', 'Function 2'])145 # F2 graph146 plt.subplot(1, 2, 2)147 plt.xlabel('K')148 plt.ylabel('Function 2')149 plt.title('Function 2 values')150 plt.grid()151 plt.plot(K, tmp_func2, 'mo--')152 plt.plot(K, tmp_func1, 'o--', color = 'grey', alpha = 0.3)153 plt.legend(['Function 2', 'Function 1'])...

Full Screen

Full Screen

iron_source.py

Source: iron_source.py Github

copy

Full Screen

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();...

Full Screen

Full Screen

Exam_16.3g.py

Source: Exam_16.3g.py Github

copy

Full Screen

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))...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

How To Handle Dynamic Dropdowns In Selenium WebDriver With Java

Joseph, who has been working as a Quality Engineer, was assigned to perform web automation for the company’s website.

Top 17 Resources To Learn Test Automation

Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on a new technology so soon.

Migrating Test Automation Suite To Cypress 10

There are times when developers get stuck with a problem that has to do with version changes. Trying to run the code or test without upgrading the package can result in unexpected errors.

Website Testing: A Detailed Guide

Websites and web apps are growing in number day by day, and so are the expectations of people for a pleasant web experience. Even though the World Wide Web (WWW) was invented only in 1989 (32 years back), this technology has revolutionized the world we know back then. The best part is that it has made life easier for us. You no longer have to stand in long queues to pay your bills. You can get that done within a few minutes by visiting their website, web app, or mobile app.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run locust automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful