How to use stddev method in pytest-benchmark

Best Python code snippet using pytest-benchmark

main.py

Source:main.py Github

copy

Full Screen

...31 32 elif(file == "standard deviation"):33 file2=str(input("Please enter concentration number\n"))34 if(file2 == '1'):35 stddev(loc1, 1)36 elif(file2 == '2'):37 stddev(loc1, 2)38 elif(file2 == '3'):39 stddev(loc1, 3)40 elif(file2 == '4'):41 stddev(loc1, 4)42 elif(file2 == '5'):43 stddev(loc1, 5)44 elif(file2 == '6'):45 stddev(loc1, 6)46 elif(file2 == '7'):47 stddev(loc1, 7)48 elif(file2 == '8'):49 stddev(loc1, 8)50 51 52 elif(file == "polynomial regression"):53 approxP(loc1)54 elif(file == "single"):55 singleWell(loc1)56 elif(file == "all"):57 allWells(loc1)58 elif(file == "groups"):59 groupWells(loc1)60 elif(file == "concentrations"):61 concenWells(loc1)62 elif(file == "triplicate"):63 tripWells(loc1)64 elif(file == "everything"):65 singleWell(loc1)66 allWells(loc1)67 groupWells(loc1)68 concenWells(loc1)69 tripWells(loc1)70 else:71 print('Invalid. Try again')72 73 elif(file == '2'):74 file=str(input("Please enter which graph you would like to see\n"))75 76 if(file == 'sigmoid'):77 x = pd.read_excel(loc2, usecols="B")78 x = np.array(x).reshape(-1)79 g2 = pd.read_excel(loc2, usecols="C:CT")80 #sigresults holds: [a1, a2, b1, b2, c1, c2, error1, error2]81 sigresults = train(x, g2)82 test(x, g2, sigresults)83 84 85 elif(file == "standard deviation"):86 file2=str(input("Please enter concentration number\n"))87 if(file2 == '1'):88 stddev(loc2, 1)89 elif(file2 == '2'):90 stddev(loc2, 2)91 elif(file2 == '3'):92 stddev(loc2, 3)93 elif(file2 == '4'):94 stddev(loc2, 4)95 elif(file2 == '5'):96 stddev(loc2, 5)97 elif(file2 == '6'):98 stddev(loc2, 6)99 elif(file2 == '7'):100 stddev(loc2, 7)101 elif(file2 == '8'):102 stddev(loc2, 8)103 104 elif(file == "polynomial regression"):105 approxP(loc2)106 elif(file == "single"):107 singleWell(loc2)108 elif(file == "all"):109 allWells(loc2)110 elif(file == "groups"):111 groupWells(loc2)112 elif(file == "concentrations"):113 concenWells(loc2)114 elif(file == "triplicate"):115 tripWells(loc2)116 elif(file == "everything"):117 singleWell(loc2)118 allWells(loc2)119 groupWells(loc2)120 concenWells(loc2)121 tripWells(loc2)122 else:123 print('Invalid. Try again')124 125 elif(file == '3'):126 file=str(input("Please enter which graph you would like to see\n"))127 128 if(file == 'sigmoid'):129 x = pd.read_excel(loc3, usecols="B")130 x = np.array(x).reshape(-1)131 g2 = pd.read_excel(loc3, usecols="C:CT")132 #sigresults holds: [a1, a2, b1, b2, c1, c2, error1, error2]133 sigresults = train(x, g2)134 test(x, g2, sigresults)135 136 elif(file == "standard deviation"):137 file2=str(input("Please enter concentration number\n"))138 if(file2 == '1'):139 stddev(loc3, 1)140 elif(file2 == '2'):141 stddev(loc3, 2)142 elif(file2 == '3'):143 stddev(loc3, 3)144 elif(file2 == '4'):145 stddev(loc3, 4)146 elif(file2 == '5'):147 stddev(loc3, 5)148 elif(file2 == '6'):149 stddev(loc3, 6)150 elif(file2 == '7'):151 stddev(loc3, 7)152 elif(file2 == '8'):153 stddev(loc3, 8)154 155 elif(file == "polynomial regression"):156 approxP(loc3) 157 elif(file == "single"):158 singleWell(loc3)159 elif(file == "all"):160 allWells(loc3)161 elif(file == "groups"):162 groupWells(loc3)163 elif(file == "concentrations"):164 concenWells(loc3)165 elif(file == "triplicate"):166 tripWells(loc3)167 elif(file == "everything"):168 singleWell(loc3)169 allWells(loc3)170 groupWells(loc3)171 concenWells(loc3)172 tripWells(loc3)173 else:174 print('Invalid. Try again')175 176 elif(file == '4'):177 file=str(input("Please enter which graph you would like to see\n"))178 179 if(file == 'sigmoid'):180 x = pd.read_excel(loc4, usecols="B")181 x = np.array(x).reshape(-1)182 g2 = pd.read_excel(loc4, usecols="C:CT")183 #sigresults holds: [a1, a2, b1, b2, c1, c2, error1, error2]184 sigresults = train(x, g2)185 test(x, g2, sigresults)186 187 elif(file == "standard deviation"):188 file2=str(input("Please enter concentration number\n"))189 if(file2 == '1'):190 stddev(loc4, 1)191 elif(file2 == '2'):192 stddev(loc4, 2)193 elif(file2 == '3'):194 stddev(loc4, 3)195 elif(file2 == '4'):196 stddev(loc4, 4)197 elif(file2 == '5'):198 stddev(loc4, 5)199 elif(file2 == '6'):200 stddev(loc4, 6)201 elif(file2 == '7'):202 stddev(loc4, 7)203 elif(file2 == '8'):204 stddev(loc4, 8)205 206 elif(file == "polynomial regression"):207 approxP(loc4) 208 elif(file == "single"):209 singleWell(loc4)210 elif(file == "all"):211 allWells(loc4)212 elif(file == "groups"):213 groupWells(loc4)214 elif(file == "concentrations"):215 concenWells(loc4)216 elif(file == "triplicate"):217 tripWells(loc4)218 elif(file == "everything"):219 singleWell(loc4)220 allWells(loc4)221 groupWells(loc4)222 concenWells(loc4)223 tripWells(loc4)224 else:225 print('Invalid. Try again')226 227 elif(file == '5'):228 file=str(input("Please enter which graph you would like to see\n"))229 230 if(file == 'sigmoid'):231 x = pd.read_excel(loc5, usecols="B")232 x = np.array(x).reshape(-1)233 g2 = pd.read_excel(loc5, usecols="C:CT")234 #sigresults holds: [a1, a2, b1, b2, c1, c2, error1, error2]235 sigresults = train(x, g2)236 test(x, g2, sigresults)237 238 elif(file == "standard deviation"):239 file2=str(input("Please enter concentration number\n"))240 if(file2 == '1'):241 stddev(loc5, 1)242 elif(file2 == '2'):243 stddev(loc5, 2)244 elif(file2 == '3'):245 stddev(loc5, 3)246 elif(file2 == '4'):247 stddev(loc5, 4)248 elif(file2 == '5'):249 stddev(loc5, 5)250 elif(file2 == '6'):251 stddev(loc5, 6)252 elif(file2 == '7'):253 stddev(loc5, 7)254 elif(file2 == '8'):255 stddev(loc5, 8)256 257 elif(file == "polynomial regression"):258 approxP(loc5) 259 elif(file == "single"):260 singleWell(loc5)261 elif(file == "all"):262 allWells(loc5)263 elif(file == "groups"):264 groupWells(loc5)265 elif(file == "concentrations"):266 concenWells(loc5)267 elif(file == "triplicate"):268 tripWells(loc5)269 elif(file == "everything"):270 singleWell(loc5)271 allWells(loc5)272 groupWells(loc5)273 concenWells(loc5)274 tripWells(loc5)275 else:276 print('Invalid. Try again')277 278 elif(file == '6'):279 file=str(input("Please enter which graph you would like to see\n"))280 281 if(file == 'sigmoid'):282 x = pd.read_excel(loc6, usecols="B")283 x = np.array(x).reshape(-1)284 g2 = pd.read_excel(loc6, usecols="C:CT")285 #sigresults holds: [a1, a2, b1, b2, c1, c2, error1, error2]286 sigresults = train(x, g2)287 test(x, g2, sigresults)288 289 elif(file == "standard deviation"):290 file2=str(input("Please enter concentration number\n"))291 if(file2 == '1'):292 stddev(loc6, 1)293 elif(file2 == '2'):294 stddev(loc6, 2)295 elif(file2 == '3'):296 stddev(loc6, 3)297 elif(file2 == '4'):298 stddev(loc6, 4)299 elif(file2 == '5'):300 stddev(loc6, 5)301 elif(file2 == '6'):302 stddev(loc6, 6)303 elif(file2 == '7'):304 stddev(loc6, 7)305 elif(file2 == '8'):306 stddev(loc6, 8)307 308 elif(file == "polynomial regression"):309 approxP(loc6) 310 elif(file == "single"):311 singleWell(loc6)312 elif(file == "all"):313 allWells(loc6)314 elif(file == "groups"):315 groupWells(loc6)316 elif(file == "concentrations"):317 concenWells(loc6)318 elif(file == "triplicate"):319 tripWells(loc6)320 elif(file == "everything"):321 singleWell(loc6)322 allWells(loc6)323 groupWells(loc6)324 concenWells(loc6)325 tripWells(loc6)326 else:327 print('Invalid. Try again')328 329 elif(file == '7'):330 file=str(input("Please enter which graph you would like to see\n"))331 332 if(file == 'sigmoid'):333 x = pd.read_excel(loc7, usecols="B")334 x = np.array(x).reshape(-1)335 g2 = pd.read_excel(loc7, usecols="C:CT")336 #sigresults holds: [a1, a2, b1, b2, c1, c2, error1, error2]337 sigresults = train(x, g2)338 test(x, g2, sigresults)339 340 elif(file == "standard deviation"):341 file2=str(input("Please enter concentration number\n"))342 if(file2 == '1'):343 stddev(loc7, 1)344 elif(file2 == '2'):345 stddev(loc7, 2)346 elif(file2 == '3'):347 stddev(loc7, 3)348 elif(file2 == '4'):349 stddev(loc7, 4)350 elif(file2 == '5'):351 stddev(loc7, 5)352 elif(file2 == '6'):353 stddev(loc7, 6)354 elif(file2 == '7'):355 stddev(loc7, 7)356 elif(file2 == '8'):357 stddev(loc7, 8)358 359 elif(file == "polynomial regression"):360 approxP(loc7) 361 elif(file == "single"):362 singleWell(loc7)363 elif(file == "all"):364 allWells(loc7)365 elif(file == "groups"):366 groupWells(loc7)367 elif(file == "concentrations"):368 concenWells(loc7)369 elif(file == "triplicate"):370 tripWells(loc7)371 elif(file == "everything"):...

Full Screen

Full Screen

figure15_helpers.py

Source:figure15_helpers.py Github

copy

Full Screen

...10 lst = [float(s)]11 elif type(s) == list:12 lst = s13 return sum(lst)/len(lst)14def stddev(s):15 '''Compute stddev of list or string of values. Adapted from avg().'''16 if ',' in s:17 lst = [float(f) for f in s.split(',')]18 elif type(s) == str:19 lst = [float(s)]20 elif type(s) == list:21 lst = s22 return np.std(lst)23def figure15a_paper_data():24 '''Populate data struct for plot, using data from figure 15a in paper.25 For plotBarClusters() below. Fill in "Mininet ..." fields with test data.26 Extracted manually from paper using this tool:27 http://arohatgi.info/WebPlotDigitizer/app/28 '''...

Full Screen

Full Screen

noise.py

Source:noise.py Github

copy

Full Screen

1import numpy as np2class AdaptiveParamNoiseSpec(object):3 def __init__(self, initial_stddev=0.1, desired_action_stddev=0.1, adoption_coefficient=1.01):4 self.initial_stddev = initial_stddev5 self.desired_action_stddev = desired_action_stddev6 self.adoption_coefficient = adoption_coefficient7 self.current_stddev = initial_stddev8 def adapt(self, distance):9 if distance > self.desired_action_stddev:10 # Decrease stddev.11 self.current_stddev /= self.adoption_coefficient12 else:13 # Increase stddev.14 self.current_stddev *= self.adoption_coefficient15 def get_stats(self):16 stats = {17 'param_noise_stddev': self.current_stddev,18 }19 return stats20 def __repr__(self):21 fmt = 'AdaptiveParamNoiseSpec(initial_stddev={}, desired_action_stddev={}, adoption_coefficient={})'22 return fmt.format(self.initial_stddev, self.desired_action_stddev, self.adoption_coefficient)23class ActionNoise(object):24 def reset(self):25 pass26class NormalActionNoise(ActionNoise):27 def __init__(self, mu, sigma):28 self.mu = mu29 self.sigma = sigma30 def __call__(self):31 return np.random.normal(self.mu, self.sigma)32 def __repr__(self):33 return 'NormalActionNoise(mu={}, sigma={})'.format(self.mu, self.sigma)34# Based on http://math.stackexchange.com/questions/1287634/implementing-ornstein-uhlenbeck-in-matlab35class OrnsteinUhlenbeckActionNoise(ActionNoise):36 def __init__(self, mu, sigma, theta=.15, dt=1e-2, x0=None):37 self.theta = theta38 self.mu = mu39 self.sigma = sigma40 self.dt = dt41 self.x0 = x042 self.reset()43 def __call__(self):44 x = self.x_prev + self.theta * (self.mu - self.x_prev) * self.dt + self.sigma * np.sqrt(self.dt) * np.random.normal(size=self.mu.shape)45 self.x_prev = x46 return x47 def reset(self):48 self.x_prev = self.x0 if self.x0 is not None else np.zeros_like(self.mu)49 def __repr__(self):...

Full Screen

Full Screen

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 pytest-benchmark 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