How to use getAvg method in autotest

Best Python code snippet using autotest_python

Bottom_uchannel_measurements.py

Source:Bottom_uchannel_measurements.py Github

copy

Full Screen

2import math3import Al_utils4def get_L1_hole_ball():5 L1_hole_ball = np.empty([3])6 L1_hole_ball[0] = Al_utils.getAvg(np.array([228.01042]))7 L1_hole_ball[1] = Al_utils.getAvg(np.array([095.26798]))8 L1_hole_ball[2] = Al_utils.getAvg(np.array([-005.16258]))9 return L1_hole_ball10def get_L3_hole_ball():11 L3_hole_ball = np.empty([3])12 L3_hole_ball[0] = Al_utils.getAvg(np.array([227.42535]))13 L3_hole_ball[1] = Al_utils.getAvg(np.array([295.25953]))14 L3_hole_ball[2] = Al_utils.getAvg(np.array([-005.11076]))15 return L3_hole_ball16def get_L3_slot_ball():17 L3_slot_ball = np.empty([3])18 L3_slot_ball[0] = Al_utils.getAvg(np.array([-009.09437]))19 L3_slot_ball[1] = Al_utils.getAvg(np.array([294.63087]))20 L3_slot_ball[2] = Al_utils.getAvg(np.array([-005.05414]))21 return L3_slot_ball22def get_L1_slot_ball():23 L1_slot_ball = np.empty([3])24 L1_slot_ball[0] = Al_utils.getAvg(np.array([-008.64929]))25 L1_slot_ball[1] = Al_utils.getAvg(np.array([094.62686]))26 L1_slot_ball[2] = Al_utils.getAvg(np.array([-005.09499]))27 return L1_slot_ball28def get_ubasis():29 return Al_utils.make_uch_basis(get_L1_hole_ball(),get_L3_hole_ball(),get_L1_slot_ball(),get_L3_slot_ball())30def get_ball_plane():31 ball_plane = np.empty([5])32 ball_plane[0] = Al_utils.getAvg(np.array([138.71886]))33 ball_plane[1] = Al_utils.getAvg(np.array([-089.97994]))34 ball_plane[2] = Al_utils.getAvg(np.array([109.42303]))35 ball_plane[3] = Al_utils.getAvg(np.array([194.94631]))36 ball_plane[4] = Al_utils.getAvg(np.array([-005.10562]))37 return ball_plane38def get_ball_plane_normal():39 return normal_vector(math.radians(ball_plane()[3]),math.radians(ball_plane()[4]))40def get_L0_base_plane():41 L0_base_plane = np.empty([5])42 L0_base_plane[0] = Al_utils.getAvg(np.array([-052.85242]))43 L0_base_plane[1] = Al_utils.getAvg(np.array([033.38944]))44 L0_base_plane[2] = Al_utils.getAvg(np.array([-043.02304]))45 L0_base_plane[3] = Al_utils.getAvg(np.array([-026.69071]))46 L0_base_plane[4] = Al_utils.getAvg(np.array([089.95514]))47 return L0_base_plane48def get_L0_base_normal():49 return Al_utils.normal_vector(math.radians(get_L0_base_plane()[3]),math.radians(get_L0_base_plane()[4]))50def get_L1_base_plane():51 L1_base_plane = np.empty([5])52 L1_base_plane[0] = Al_utils.getAvg(np.array([000.16933]))53 L1_base_plane[1] = Al_utils.getAvg(np.array([028.70117]))54 L1_base_plane[2] = Al_utils.getAvg(np.array([-043.39205]))55 L1_base_plane[3] = Al_utils.getAvg(np.array([-173.04428]))56 L1_base_plane[4] = Al_utils.getAvg(np.array([-089.95476]))57 return L1_base_plane58def get_L1_base_normal():59 return Al_utils.normal_vector(math.radians(get_L1_base_plane()[3]),math.radians(get_L1_base_plane()[4]))60def get_L2_base_plane():61 L2_base_plane = np.empty([5])62 L2_base_plane[0] = Al_utils.getAvg(np.array([099.37643]))63 L2_base_plane[1] = Al_utils.getAvg(np.array([006.55192]))64 L2_base_plane[2] = Al_utils.getAvg(np.array([-052.94695]))65 L2_base_plane[3] = Al_utils.getAvg(np.array([029.38887]))66 L2_base_plane[4] = Al_utils.getAvg(np.array([089.98048]))67 return L2_base_plane68def get_L2_base_normal():69 return Al_utils.normal_vector(math.radians(get_L2_base_plane()[3]),math.radians(get_L2_base_plane()[4]))70def get_L3_base_plane():71 L3_base_plane = np.empty([5])72 L3_base_plane[0] = Al_utils.getAvg(np.array([199.20859]))73 L3_base_plane[1] = Al_utils.getAvg(np.array([004.68735]))74 L3_base_plane[2] = Al_utils.getAvg(np.array([-054.42996]))75 L3_base_plane[3] = Al_utils.getAvg(np.array([169.79848]))76 L3_base_plane[4] = Al_utils.getAvg(np.array([089.97868]))77 return L3_base_plane78def get_L3_base_normal():79 return Al_utils.normal_vector(math.radians(get_L3_base_plane()[3]),math.radians(get_L3_base_plane()[4]))80def get_L0_slot_pin():81 L0_slot_pin = np.empty([3])82 L0_slot_pin[0] = Al_utils.getAvg(np.array([-050.06542]))83 L0_slot_pin[1] = Al_utils.getAvg(np.array([083.15080]))84 L0_slot_pin[2] = Al_utils.getAvg(np.array([-040.52812]))85 return Al_utils.project_point_to_plane(L0_slot_pin,np.array([get_L0_base_plane()[0],get_L0_base_plane()[1],get_L0_base_plane()[2]]),get_L0_base_normal())86def get_L0_hole_pin():87 L0_hole_pin = np.empty([3])88 L0_hole_pin[0] = Al_utils.getAvg(np.array([-049.95689]))89 L0_hole_pin[1] = Al_utils.getAvg(np.array([-026.08166]))90 L0_hole_pin[2] = Al_utils.getAvg(np.array([-040.53846]))91 return Al_utils.project_point_to_plane(L0_hole_pin,np.array([get_L0_base_plane()[0],get_L0_base_plane()[1],get_L0_base_plane()[2]]),get_L0_base_normal())92def get_L0_pin_basis():93 return Al_utils.make_pin_basis(get_L0_hole_pin(),get_L0_slot_pin(),get_L0_base_normal())94def get_L1_slot_pin():95 L1_slot_pin = np.empty([3])96 L1_slot_pin[0] = Al_utils.getAvg(np.array([000.08896]))97 L1_slot_pin[1] = Al_utils.getAvg(np.array([083.00259]))98 L1_slot_pin[2] = Al_utils.getAvg(np.array([-040.90393]))99 return Al_utils.project_point_to_plane(L1_slot_pin,np.array([get_L1_base_plane()[0],get_L1_base_plane()[1],get_L1_base_plane()[2]]),get_L1_base_normal())100def get_L1_hole_pin():101 L1_hole_pin = np.empty([3])102 L1_hole_pin[0] = Al_utils.getAvg(np.array([000.02759]))103 L1_hole_pin[1] = Al_utils.getAvg(np.array([-026.20199]))104 L1_hole_pin[2] = Al_utils.getAvg(np.array([-040.80448]))105 return Al_utils.project_point_to_plane(L1_hole_pin,np.array([get_L1_base_plane()[0],get_L1_base_plane()[1],get_L1_base_plane()[2]]),get_L1_base_normal())106def get_L1_pin_basis():107 return Al_utils.make_pin_basis(get_L1_hole_pin(),get_L1_slot_pin(),get_L1_base_normal())108def get_L2_slot_pin():109 L2_slot_pin = np.empty([3])110 L2_slot_pin[0] = Al_utils.getAvg(np.array([109.56114]))111 L2_slot_pin[1] = Al_utils.getAvg(np.array([095.24083]))112 L2_slot_pin[2] = Al_utils.getAvg(np.array([-050.66193]))113 return Al_utils.project_point_to_plane(L2_slot_pin,np.array([get_L2_base_plane()[0],get_L2_base_plane()[1],get_L2_base_plane()[2]]),get_L2_base_normal())114def get_L2_hole_pin():115 L2_hole_pin = np.empty([3])116 L2_hole_pin[0] = Al_utils.getAvg(np.array([109.59399]))117 L2_hole_pin[1] = Al_utils.getAvg(np.array([-095.22943]))118 L2_hole_pin[2] = Al_utils.getAvg(np.array([-050.61693]))119 return Al_utils.project_point_to_plane(L2_hole_pin,np.array([get_L2_base_plane()[0],get_L2_base_plane()[1],get_L2_base_plane()[2]]),get_L2_base_normal())120def get_L2_pin_basis():121 return Al_utils.make_pin_basis(get_L2_hole_pin(),get_L2_slot_pin(),get_L2_base_normal())122def get_L3_slot_pin():123 L3_slot_pin = np.empty([3])124 L3_slot_pin[0] = Al_utils.getAvg(np.array([209.57712]))125 L3_slot_pin[1] = Al_utils.getAvg(np.array([095.21149]))126 L3_slot_pin[2] = Al_utils.getAvg(np.array([-052.13761]))127 return Al_utils.project_point_to_plane(L3_slot_pin,np.array([get_L3_base_plane()[0],get_L3_base_plane()[1],get_L3_base_plane()[2]]),get_L3_base_normal())128def get_L3_hole_pin():129 L3_hole_pin = np.empty([3])130 L3_hole_pin[0] = Al_utils.getAvg(np.array([209.60144]))131 L3_hole_pin[1] = Al_utils.getAvg(np.array([-095.27477]))132 L3_hole_pin[2] = Al_utils.getAvg(np.array([-052.14511]))133 return Al_utils.project_point_to_plane(L3_hole_pin,np.array([get_L3_base_plane()[0],get_L3_base_plane()[1],get_L3_base_plane()[2]]),get_L3_base_normal())134def get_L3_pin_basis():135 return Al_utils.make_pin_basis(get_L3_hole_pin(),get_L3_slot_pin(),get_L3_base_normal())136def get_L0_axial_backedge():137 L0_axial_backedge = np.empty([5])138 L0_axial_backedge[0] = Al_utils.getAvg(np.array([-046.00619]))139 L0_axial_backedge[1] = Al_utils.getAvg(np.array([028.31449]))140 L0_axial_backedge[2] = Al_utils.getAvg(np.array([007.87054]))141 L0_axial_backedge[3] = Al_utils.getAvg(np.array([089.98729]))142 L0_axial_backedge[4] = Al_utils.getAvg(np.array([000.28382]))143 return L0_axial_backedge144def get_L0_axial_backedge_normal():145 return Al_utils.normal_vector(math.radians(get_L0_axial_backedge()[3]),math.radians(get_L0_axial_backedge()[4]))146def get_L0_stereo_frontedge():147 L0_stereo_frontedge = np.empty([5])148 L0_stereo_frontedge[0] = Al_utils.getAvg(np.array([-054.05355]))149 L0_stereo_frontedge[1] = Al_utils.getAvg(np.array([029.07547]))150 L0_stereo_frontedge[2] = Al_utils.getAvg(np.array([008.05889]))151 L0_stereo_frontedge[3] = Al_utils.getAvg(np.array([090.01825]))152 L0_stereo_frontedge[4] = Al_utils.getAvg(np.array([005.73210]))153 return L0_stereo_frontedge154def get_L0_stereo_frontedge_normal():155 return Al_utils.normal_vector(math.radians(get_L0_stereo_frontedge()[3]),math.radians(get_L0_stereo_frontedge()[4]))156def get_L1_axial_backedge():157 L1_axial_backedge = np.empty([5])158 L1_axial_backedge[0] = Al_utils.getAvg(np.array([004.12062]))159 L1_axial_backedge[1] = Al_utils.getAvg(np.array([027.66142]))160 L1_axial_backedge[2] = Al_utils.getAvg(np.array([007.47369]))161 L1_axial_backedge[3] = Al_utils.getAvg(np.array([089.93871]))162 L1_axial_backedge[4] = Al_utils.getAvg(np.array([000.27258]))163 return L1_axial_backedge164def get_L1_axial_backedge_normal():165 return Al_utils.normal_vector(math.radians(get_L1_axial_backedge()[3]),math.radians(get_L1_axial_backedge()[4]))166def get_L1_stereo_frontedge():167 L1_stereo_frontedge = np.empty([5])168 L1_stereo_frontedge[0] = Al_utils.getAvg(np.array([-003.90185]))169 L1_stereo_frontedge[1] = Al_utils.getAvg(np.array([026.32962]))170 L1_stereo_frontedge[2] = Al_utils.getAvg(np.array([007.43349]))171 L1_stereo_frontedge[3] = Al_utils.getAvg(np.array([-089.99489]))172 L1_stereo_frontedge[4] = Al_utils.getAvg(np.array([-005.77888]))173 return L1_stereo_frontedge174def get_L1_stereo_frontedge_normal():175 return Al_utils.normal_vector(math.radians(get_L1_stereo_frontedge()[3]),math.radians(get_L1_stereo_frontedge()[4]))176def get_L2_axial_backedge():177 L2_axial_backedge = np.empty([5])178 L2_axial_backedge[0] = Al_utils.getAvg(np.array([103.97422]))179 L2_axial_backedge[1] = Al_utils.getAvg(np.array([025.96446]))180 L2_axial_backedge[2] = Al_utils.getAvg(np.array([007.11466]))181 L2_axial_backedge[3] = Al_utils.getAvg(np.array([-090.07016]))182 L2_axial_backedge[4] = Al_utils.getAvg(np.array([000.02069]))183 return L2_axial_backedge184def get_L2_axial_backedge_normal():185 return Al_utils.normal_vector(math.radians(get_L2_axial_backedge()[3]),math.radians(get_L2_axial_backedge()[4]))186def get_L2_stereo_frontedge():187 L2_stereo_frontedge = np.empty([5])188 L2_stereo_frontedge[0] = Al_utils.getAvg(np.array([095.62154])) 189 L2_stereo_frontedge[1] = Al_utils.getAvg(np.array([023.65861]))190 L2_stereo_frontedge[2] = Al_utils.getAvg(np.array([006.69231]))191 L2_stereo_frontedge[3] = Al_utils.getAvg(np.array([090.24821]))192 L2_stereo_frontedge[4] = Al_utils.getAvg(np.array([005.70024]))193 return L2_stereo_frontedge194def get_L2_stereo_frontedge_normal():195 return Al_utils.normal_vector(math.radians(get_L2_stereo_frontedge()[3]),math.radians(get_L2_stereo_frontedge()[4]))196def get_L3_axial_backedge():197 L3_axial_backedge = np.empty([5])198 L3_axial_backedge[0] = Al_utils.getAvg(np.array([204.14190]))199 L3_axial_backedge[1] = Al_utils.getAvg(np.array([030.59347]))200 L3_axial_backedge[2] = Al_utils.getAvg(np.array([005.66258]))201 L3_axial_backedge[3] = Al_utils.getAvg(np.array([089.91021]))202 L3_axial_backedge[4] = Al_utils.getAvg(np.array([000.03891]))203 return L3_axial_backedge204def get_L3_axial_backedge_normal():205 return Al_utils.normal_vector(math.radians(get_L3_axial_backedge()[3]),math.radians(get_L3_axial_backedge()[4]))206def get_L3_stereo_frontedge():207 L3_stereo_frontedge = np.empty([5])208 L3_stereo_frontedge[0] = Al_utils.getAvg(np.array([195.61621]))209 L3_stereo_frontedge[1] = Al_utils.getAvg(np.array([031.22585]))210 L3_stereo_frontedge[2] = Al_utils.getAvg(np.array([005.99629]))211 L3_stereo_frontedge[3] = Al_utils.getAvg(np.array([089.99429]))212 L3_stereo_frontedge[4] = Al_utils.getAvg(np.array([005.74861]))213 return L3_stereo_frontedge214def get_L3_stereo_frontedge_normal():215 return Al_utils.normal_vector(math.radians(get_L3_stereo_frontedge()[3]),math.radians(get_L3_stereo_frontedge()[4]))216def get_wire_par():217 wire_par = np.empty([5])218 wire_par[0] = Al_utils.getAvg(np.array([-081.49162]))219 wire_par[1] = Al_utils.getAvg(np.array([017.13384]))220 wire_par[2] = Al_utils.getAvg(np.array([015.83889]))221 wire_par[3] = Al_utils.getAvg(np.array([-089.87309]))222 wire_par[4] = Al_utils.getAvg(np.array([000.00876]))223 return wire_par224def get_wire_par_normal():225 return Al_utils.normal_vector(math.radians(get_wire_par()[3]),math.radians(get_wire_par()[4]))226def get_wire_diag():227 wire_diag = np.empty([5])228 wire_diag[0] = Al_utils.getAvg(np.array([-081.89325]))229 wire_diag[1] = Al_utils.getAvg(np.array([016.51584]))230 wire_diag[2] = Al_utils.getAvg(np.array([015.74494]))231 wire_diag[3] = Al_utils.getAvg(np.array([-089.9457]))232 wire_diag[4] = Al_utils.getAvg(np.array([008.91128]))233 return wire_diag234def get_wire_diag_normal():...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

1# Made by huge2# Hope this helps someone3# peace45from PIL import Image6from PIL import ImageDraw7from PIL import ImageFont8import sys910#main.py11#input12#style set1314def main():15 myFont = ImageFont.truetype('consola.ttf', 30)16 #SET STYLE SET BELOW:17 if sys.argv[2].isnumeric == False:18 print("Incorrect usage. Style set must be 1, 2, 3, 4 or 5")19 return20 elif int(sys.argv[2]) not in [1, 2, 3, 4, 5]:21 print("Incorrect usage. Style set must be 1, 2, 3, 4 or 5")22 return23 style_set = int(sys.argv[2])24 input_path = sys.argv[1]2526 im = Image.open(input_path) 27 pixels = im.getdata()28 width, height = im.size2930 newImg = Image.new(mode="RGB", size=(width * 2 + 200, height * 2 + 200))3132 Characters = ""33 DrawImg = ImageDraw.Draw(newImg)3435 if style_set == 1:36 Characters = ".`:,;'" + '_^"\></-!~=)(|j?}{ ][ti+l7v1%yrfcJ32uIC$zwo96sngaT5qpkYVOL40&mG8*xhedbZUSAQPFDXWK#RNEHBM@'37 elif style_set == 2:38 Characters = '`^\",:;Il!i~+_-?][}{1)(|\\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$#'39 elif style_set == 3:40 Characters = ".:-=+*#%@"41 elif style_set == 4:42 Characters = "_:*a8@"43 elif style_set == 5:44 Characters = "_:*8@"45 def GetChar(avg):46 avg = (avg * len(Characters)) // 25547 return Characters[int(avg)]4849 def GetAvg(number):50 return pixels[number][0] * 0.3 + pixels[number][1] * 0.59 + pixels[number][2] * 0.11 / 351 def GetAvgPixel(currentPixelIndex):52 avg1 = GetAvg(currentPixelIndex - width - 1) 53 avg2 = GetAvg(currentPixelIndex - width)54 avg3 = GetAvg(currentPixelIndex - width + 1)5556 avg4 = GetAvg(currentPixelIndex - 1)57 avg5 = GetAvg(currentPixelIndex)58 avg6 = GetAvg(currentPixelIndex + 1)5960 avg7 = GetAvg(currentPixelIndex + width - 1)61 avg8 = GetAvg(currentPixelIndex + width)62 avg9 = GetAvg(currentPixelIndex + width + 1)6364 return (avg1 + avg2 + avg3 + avg4 + avg5 + avg6 + avg7 + avg8 + avg9) / 96566 def GetBigAvg(num):67 Aavg1 = GetAvgPixel(num - width * 3 - 3)68 Aavg2 = GetAvgPixel(num - width * 3)69 Aavg3 = GetAvgPixel(num - width * 3 + 3)7071 Aavg4 = GetAvgPixel(num - 3)72 Aavg5 = GetAvgPixel(num)73 Aavg6 = GetAvgPixel(num + 3)7475 Aavg7 = GetAvgPixel(num + width * 3 - 3)76 Aavg8 = GetAvgPixel(num + width * 3)77 Aavg9 = GetAvgPixel(num + width * 3 + 3)7879 return (Aavg1 + Aavg2 + Aavg3 + Aavg4 + Aavg5 + Aavg6 + Aavg7 + Aavg8 + Aavg9) / 98081 OutPut = ""82 howmanytimes = 083 for y in range(0, height, 8):84 for x in range(0, width, 8):85 awgawg = 086 OutPut += GetChar(GetBigAvg(x + y * width))87 if x >= width - 8:88 DrawImg.text((0, 0 + howmanytimes * 17), OutPut, fill=(255, 255, 255), font=myFont)89 OutPut = ""90 howmanytimes += 191 break9293 im.close()94 newImg.save("output.png")95 print("Done")9697if __name__ == "__main__":98 if len(sys.argv) == 3: ...

Full Screen

Full Screen

load_times.py

Source:load_times.py Github

copy

Full Screen

...14 os.mkdir(scorepath)15times = {}16with open('results/' + runid + '/predict_buyers.pkl', 'rb') as f:17 result = pickle.load(f)18 times['b'] = result.timer.getAvg()*100019 print(result.timer.getAvg())20with open('results/' + runid + '/predict_buyers_random.pkl', 'rb') as f:21 result = pickle.load(f)22 times['bR'] = result.timer.getAvg() * 100023with open('results/' + runid + '/predict_buyers_category.pkl', 'rb') as f:24 result = pickle.load(f)25 times['bC'] = result.timer.getAvg() * 100026with open('results/' + runid + '/predict_buyers_mining.pkl', 'rb') as f:27 result = pickle.load(f)28 times['bM'] = result.timer.getAvg() * 100029with open('results/' + runid + '/predict_buyers_hybrid.pkl', 'rb') as f:30 result = pickle.load(f)31 times['bH'] = result.timer.getAvg() * 100032############ PRODUCTS33with open('results/' + runid + '/predict_products.pkl', 'rb') as f:34 result = pickle.load(f)35 times['p'] = result.timer.getAvg() * 100036with open('results/' + runid + '/predict_products_random.pkl', 'rb') as f:37 result = pickle.load(f)38 times['pR'] = result.timer.getAvg() * 100039with open('results/' + runid + '/predict_products_category.pkl', 'rb') as f:40 result = pickle.load(f)41 times['pC'] = result.timer.getAvg() * 100042with open('results/' + runid + '/predict_products_mining.pkl', 'rb') as f:43 result = pickle.load(f)44 times['pM'] = result.timer.getAvg() * 100045print(times)46with open(scorepath + '/times.csv', 'w') as f:47 w = csv.writer(f)48 w.writerow(list(times.keys()))...

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 autotest 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