Best Python code snippet using tempest_python
field-SiAgSi.py
Source:field-SiAgSi.py
...145 s2 = patches.Arc((0, 0), 2.0*inner_r, 2.0*inner_r, angle=0.0, zorder=2,146 theta1=0.0, theta2=360.0, linewidth=1, color='black')147 s3 = patches.Arc((0, 0), 2.0*outer_r, 2.0*outer_r, angle=0.0, zorder=2,148 theta1=0.0, theta2=360.0, linewidth=1, color='black')149 axs[m,n].add_patch(s1)150 axs[m,n].add_patch(s2) 151 axs[m,n].add_patch(s3) 152 # axs[0,0].add_patch(s1)153 # axs[0,0].add_patch(s2)154 # axs[0,0].add_patch(s3)155 # axs[1,0].add_patch(s1)156 # axs[1,0].add_patch(s2)157 # axs[1,0].add_patch(s3)158 # axs[0,1].add_patch(s1)159 # axs[0,1].add_patch(s2)160 # axs[0,1].add_patch(s3)161 # axs[1,1].add_patch(s1)162 # axs[1,1].add_patch(s2)163 # axs[1,1].add_patch(s3)164 165 # for m in (0,1):166 # for n in (0,1):167 # print(m)168 # print(n)169 # axs[m,n].add_patch(s1)170 # axs[m,n].add_patch(s2) 171 # axs[m,n].add_patch(s3) 172 # End of drawing173 plt.savefig("SiAgSi.png")174 plt.draw()175 plt.show()176 plt.clf()177 plt.close()178finally:179 np.savetxt("field.txt", result, fmt = "%.5f")...
plotTrajectories.py
Source:plotTrajectories.py
...44 rect1 = Rectangle((-20,10),40,30,linewidth=1,edgecolor='k',facecolor='k')45 rect2 = Rectangle((-70,10),20,60,linewidth=1,edgecolor='k',facecolor='k')46 rect3 = Rectangle((-70,-40),90,20,linewidth=1,edgecolor='k',facecolor='k')47 rect4 = Rectangle((50,-70),20,110,linewidth=1,edgecolor='k',facecolor='k')48 plt.gca().add_patch(rect)49 plt.gca().add_patch(rect1)50 plt.gca().add_patch(rect2)51 plt.gca().add_patch(rect3)52 plt.gca().add_patch(rect4)53 # Plot trajectories54 plt.plot(xy[0][0],xy[0][1], "r-", label="Trajectory 1")55 plt.plot(xy[10][0],xy[10][1], "g-", label="Trajectory 2")56 plt.plot(xy[20][0],xy[20][1], "b-", label="Trajectory 3")57 plt.plot(xy[30][0],xy[30][1], "c-", label="Trajectory 4")58 59 plt.title("Robot trajectory on Maze 1", fontsize=font_size)60 plt.xlabel("Robot X (cm)", fontsize=font_size)61 plt.ylabel("Robot Y (cm)", fontsize=font_size)62 plt.xticks(fontsize=font_size)63 plt.yticks(fontsize=font_size)64 plt.xlim(-105, 160)65 plt.ylim(-105, 105)66 plt.gca().invert_yaxis()67 plt.legend(loc="upper right", fontsize=font_size)68 plt.tight_layout()69 else:70 # Draw Maze71 topLeft = Rectangle((-100,-100),60,30,linewidth=2,edgecolor='k',facecolor='k')72 topMiddle = Rectangle((-10,-100),60,30,linewidth=2,edgecolor='k',facecolor='k')73 topRight = Rectangle((80,-130),20,80,linewidth=2,edgecolor='k',facecolor='k')74 middleRight = Rectangle((80,-20),20,60,linewidth=2,edgecolor='k',facecolor='k')75 middleLeft1 = Rectangle((-100,10),90,30,linewidth=2,edgecolor='k',facecolor='k')76 middleLeft2 = Rectangle((-100,-40),120,20,linewidth=2,edgecolor='k',facecolor='k')77 bottomRight = Rectangle((50,70),50,30,linewidth=2,edgecolor='k',facecolor='k')78 bottomMiddle = Rectangle((-35,70),55,30,linewidth=2,edgecolor='k',facecolor='k')79 bottomLeft = Rectangle((-100,70),35,30,linewidth=2,edgecolor='k',facecolor='k')80 gym = Rectangle((101.5,-110),27,30,linewidth=1,edgecolor='m',facecolor='m',label="Gym")81 home = Rectangle((65,102),27,26,linewidth=1,edgecolor='r',facecolor='r',label="Home")82 restaurant = Rectangle((-128.5,46),27,30,linewidth=1,edgecolor='g',facecolor='g',label="Restaurant")83 college = Rectangle((-80,-128),27,26,linewidth=1,edgecolor='b',facecolor='b',label="College")84 library = Rectangle((21.5,-17),27,30,linewidth=1,edgecolor='c',facecolor='c',label="Library")85 plt.gca().add_patch(topLeft)86 plt.gca().add_patch(topMiddle)87 plt.gca().add_patch(topRight)88 plt.gca().add_patch(middleRight)89 plt.gca().add_patch(middleLeft1)90 plt.gca().add_patch(middleLeft2)91 plt.gca().add_patch(bottomRight)92 plt.gca().add_patch(bottomMiddle)93 plt.gca().add_patch(bottomLeft)94 plt.gca().add_patch(gym)95 plt.gca().add_patch(home)96 plt.gca().add_patch(college)97 plt.gca().add_patch(restaurant)98 plt.gca().add_patch(library)99 # Vertical walls100 # Left101 vy1 = range(10,101)102 vx1 = [-100]*len(vy1)103 # Middle104 vy2 = range(-20,101)105 vx2 = [20]*len(vy2)106 # Right107 if name == "maze2_trajectory_updated":108 vy3 = range(-130, 41)109 else:110 vy3 = range(-70, 41)111 vx3 = [50]*len(vy3)112 # Horizontal wall...
Plot_anpassung_distanz_umap.py
Source:Plot_anpassung_distanz_umap.py
...34cir7 = plt.Circle((X[7], Y[7]), 0.5, color='black',fill=False)35cir8 = plt.Circle((X[8], Y[8]), 0.5, color='black',fill=False)36cir9 = plt.Circle((X[9], Y[9]), 0.5, color='black',fill=False)37ax1.set_aspect('equal', adjustable='datalim')38ax1.add_patch(cir)39ax1.add_patch(cir1)40ax1.add_patch(cir2)41ax1.add_patch(cir3)42ax1.add_patch(cir4)43ax1.add_patch(cir5)44ax1.add_patch(cir6)45ax1.add_patch(cir7)46ax1.add_patch(cir8)47ax1.add_patch(cir9)48ax1.set_axis_off()49ax1.set_title('(1)', fontdict={'fontsize': 8, 'fontweight': 'medium'})50a = np.array([[X[0],Y[0]],51 [X[1],Y[1]],52 [X[2],Y[2]],53 [X[3],Y[3]],54 [X[4],Y[4]],55 [X[5],Y[5]],56 [X[6],Y[6]],57 [X[7],Y[7]],58 [X[8],Y[8]],59 [X[9],Y[9]]])60dis =np.linalg.norm(a - a[:,None], axis=-1)61# Kreise abhängig des Abstandes zu k-sten Nachbarn festlegen - k = 262ax2.scatter(X, Y)63cir = plt.Circle((X[0], Y[0]), np.sort(dis[0])[2], color='black',fill=False)64cir1 = plt.Circle((X[1], Y[1]), np.sort(dis[1])[2], color='black',fill=False)65cir2 = plt.Circle((X[2], Y[2]), np.sort(dis[2])[2], color='black',fill=False)66cir3 = plt.Circle((X[3], Y[3]), np.sort(dis[3])[2], color='black',fill=False)67cir4 = plt.Circle((X[4], Y[4]), np.sort(dis[4])[2], color='black',fill=False)68cir5 = plt.Circle((X[5], Y[5]), np.sort(dis[5])[2], color='black',fill=False)69cir6 = plt.Circle((X[6], Y[6]), np.sort(dis[6])[2], color='black',fill=False)70cir7 = plt.Circle((X[7], Y[7]), np.sort(dis[7])[2], color='black',fill=False)71cir8 = plt.Circle((X[8], Y[8]), np.sort(dis[8])[2], color='black',fill=False)72cir9 = plt.Circle((X[9], Y[9]), np.sort(dis[9])[2], color='black',fill=False)73ax2.set_aspect('equal', adjustable='datalim')74ax2.add_patch(cir)75ax2.add_patch(cir1)76ax2.add_patch(cir2)77ax2.add_patch(cir3)78ax2.add_patch(cir4)79ax2.add_patch(cir5)80ax2.add_patch(cir6)81ax2.add_patch(cir7)82ax2.add_patch(cir8)83ax2.add_patch(cir9)84ax2.set_axis_off()85ax2.set_title('(2.)', fontdict={'fontsize': 8, 'fontweight': 'medium'})86#plt.savefig('explanation_umap.png', format='png', dpi=1200)...
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!!