How to use run_4 method in SeleniumBase

Best Python code snippet using SeleniumBase

final_project.py

Source:final_project.py Github

copy

Full Screen

...68lastW = W69run_4 = False70run_5 = False71run_6 = False72def run_4(b4):73 global run_474 run_4 = not run_475b4 = button(text = "air",pos = scene1.title_anchor,bind=run_4)76def run_5(b5):77 global run_578 run_5 = not run_579b5 = button(text = "water",pos = scene1.title_anchor,bind=run_5)80def run_6(b6):81 global run_682 run_6 = not run_683b6 = button(text = "glass",pos = scene1.title_anchor,bind=run_6)84#scene1.bind('keydown', keyinput) # setting for the binding function85#scene2.bind('keydown', keyinput) # setting for the binding function86def get_E_field(shape1 , medium):...

Full Screen

Full Screen

run-analysis.py

Source:run-analysis.py Github

copy

Full Screen

1import matplotlib.pyplot as plt2import numpy as np3import pandas as pd4import seaborn as sns5def ra_plot(run_1, run_2, run_3, run_4, window=10):6 run_avg_1 = run_1['average'].rolling(window).mean()7 run_avg_2 = run_2['average'].rolling(window).mean()8 run_avg_3 = run_3['average'].rolling(window).mean()9 run_avg_4 = run_4['average'].rolling(window).mean()10 run_avg_combo = pd.concat([run_avg_1,11 run_avg_2.reindex(run_avg_1.index),12 run_avg_3.reindex(run_avg_1.index),13 run_avg_4 .reindex(run_avg_1.index)], axis=1)14 run_avg_combo.set_axis(['average_1', 'average_2', 'average_3', 'average_4'], axis=1, inplace=True)15 run_avg_combo['min'] = run_avg_combo.min(axis=1)16 run_avg_combo['max'] = run_avg_combo.max(axis=1)17 run_avg_combo['average'] = run_avg_combo.mean(axis=1)18 plt.plot(run_avg_combo['average_1'], label='Run 1')19 plt.plot(run_avg_combo['average_2'], label='Run 2')20 plt.plot(run_avg_combo['average_3'], label='Run 3')21 plt.plot(run_avg_combo['average_4'], label='Run 4')22 plt.plot(run_avg_combo['average'], color='black', label='Average', linestyle='dashed')23 plt.fill_between(run_avg_combo.index, run_avg_combo['min'], run_avg_combo['max'], alpha=0.5, label='Range')24 plt.xlabel('Episode')25 plt.ylabel('Reward')26 # plt.title('Total Average Episode Reward')27 plt.legend()28 plt.savefig('graphs/total-average-episode-reward-window{}-new.png'.format(window))29 plt.show()30def sd_plot(run_1, run_2, run_3, run_4):31 run_1 = run_1.drop([' distance_to_target'], axis=1)32 run_combo = pd.concat([run_1,33 run_2['average'].reindex(run_1.index),34 run_3['average'].reindex(run_1.index),35 run_4['average'].reindex(run_1.index)], axis=1)36 run_combo.set_axis(['average_1', 'average_2', 'average_3', 'average_4'], axis=1, inplace=True)37 run_combo['min'] = run_combo.min(axis=1)38 run_combo['max'] = run_combo.max(axis=1)39 run_combo['average'] = run_combo.mean(axis=1)40 plt.plot(run_combo['average_1'], label='Run 1')41 plt.plot(run_combo['average_2'], label='Run 2')42 plt.plot(run_combo['average_3'], label='Run 3')43 plt.plot(run_combo['average_4'], label='Run 4')44 plt.plot(run_combo['average'], color='black', label='Average', linestyle='dashed')45 plt.fill_between(run_combo.index, run_combo['min'], run_combo['max'], alpha=0.5, label='Range')46 plt.xlabel('Episode')47 plt.ylabel('Reward')48 # plt.title('Total Average Episode Reward')49 plt.legend(loc='lower right')50 plt.savefig('graphs/total-average-episode-reward-minmax.png')51 plt.show()52def sd_plot_2(run_1, run_2, run_3, run_4):53 run_1 = run_1.drop(['episode'], axis=1)54 run_combo = pd.concat([run_1,55 run_2['average'].reindex(run_1.index),56 run_3['average'].reindex(run_1.index),57 run_4['average'].reindex(run_1.index)], axis=1)58 run_combo.set_axis(['average_1', 'average_2', 'average_3', 'average_4'], axis=1, inplace=True)59 run_combo['min'] = run_combo.min(axis=1)60 run_combo['max'] = run_combo.max(axis=1)61 run_combo['average'] = run_combo.mean(axis=1)62 plt.plot(run_combo['average_1'], label='Run 1')63 plt.plot(run_combo['average_2'], label='Run 2')64 plt.plot(run_combo['average_3'], label='Run 3')65 plt.plot(run_combo['average_4'], label='Run 4')66 plt.plot(run_combo['average'], color='black', label='Average', linestyle='dashed')67 plt.fill_between(run_combo.index, run_combo['min'], run_combo['max'], alpha=0.5, label='Range')68 plt.xlabel('Episode')69 plt.ylabel('Reward')70 # plt.title('Total Average Episode Reward')71 plt.legend(loc='lower right')72 plt.savefig('graphs/total-average-episode-reward-minmax-new.png')73 plt.show()74if __name__ == "__main__":75 sns.set()76 sns.set_style('whitegrid')77 run1 = pd.read_csv('data-files/run1a.csv')78 run2 = pd.read_csv('data-files/run2a.csv')79 run3 = pd.read_csv('data-files/run3a.csv')80 run4 = pd.read_csv('data-files/run4a.csv')81 runs = [run1, run2, run3, run4]82 run1 = run1.drop(['Steps_In_Episode',83 'Total_Steps',84 'Mean_Episode_Reward',85 'Mean_Reward_All',86 ' Memory_used',87 'Time_Elapsed',88 'Solved',89 'Solved.1'], axis=1)90 run1.set_axis(['episode', 'average'], axis=1, inplace=True)91 run2 = run2.drop(['Steps_In_Episode',92 'Total_Steps',93 'Mean_Episode_Reward',94 'Mean_Reward_All',95 ' Memory_used',96 'Time_Elapsed',97 'Solved',98 'Solved.1'], axis=1)99 run2.set_axis(['episode', 'average'], axis=1, inplace=True)100 run3 = run3.drop(['Steps_In_Episode',101 'Total_Steps',102 'Mean_Episode_Reward',103 'Mean_Reward_All',104 ' Memory_used',105 'Time_Elapsed',106 'Solved',107 'Solved.1'], axis=1)108 run3.set_axis(['episode', 'average'], axis=1, inplace=True)109 run4 = run4.drop(['Steps_In_Episode',110 'Total_Steps',111 'Mean_Episode_Reward',112 'Mean_Reward_All',113 ' Memory_used',114 'Time_Elapsed',115 'Solved',116 'Solved.1'], axis=1)117 run4.set_axis(['episode', 'average'], axis=1, inplace=True)118 sd_plot_2(run1, run2, run3, run4)119 ra_plot(run1, run2, run3, run4)120 ra_plot(run1, run2, run3, run4, window=100)121 '''122 run1 = pd.read_csv('data-files/run1.csv')123 run2 = pd.read_csv('data-files/run2.csv')124 run3 = pd.read_csv('data-files/run3.csv')125 run4 = pd.read_csv('data-files/run4.csv')126 frames = [run1, run2, run3, run4]127 long_file = pd.concat(frames)128 columns = long_file.columns129 mean = long_file[columns[2]].mean()130 print(mean)131 std = long_file[columns[2]].std()132 print(std)133 min = long_file[columns[2]].min()134 print(min)135 run1 = run1.drop(['total_timesteps'], axis=1)136 run1 = run1.groupby('episode').mean()137 run1['average'] = run1.expanding().mean()138 run2 = run2.drop(['total_timesteps'], axis=1)139 run2 = run2.groupby('episode').mean()140 run2['average'] = run2.expanding().mean()141 run3 = run3.drop(['total_timesteps'], axis=1)142 run3 = run3.groupby('episode').mean()143 run3['average'] = run3.expanding().mean()144 run4 = run4.drop(['total_timesteps'], axis=1)145 run4 = run4.groupby('episode').mean()146 run4['average'] = run4.expanding().mean()147 # ra_plot(run1, run2, run3, run4)148 # ra_plot(run1, run2, run3, run4, window=100)149 # sd_plot(run1, run2, run3, run4)...

Full Screen

Full Screen

part2.py

Source:part2.py Github

copy

Full Screen

1f = open("input.txt", "r")2data = f.read().split("\n")3data.pop()4def countTrees(data,right,down):5 num_rows = len(data)6 num_cols = len(data[0])7 num_trees = 08 x_pos = 09 x = 010 while x < num_rows - 1:11 x += down12 x_pos += right13 x_pos_mod = x_pos % num_cols14 if data[x][x_pos_mod] == '#':15 num_trees += 116 return num_trees17run_1 = countTrees(data,1,1)18run_2 = countTrees(data,3,1)19run_3 = countTrees(data,5,1)20run_4 = countTrees(data,7,1)21run_5 = countTrees(data,1,2)...

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