How to use get_entries method in autotest

Best Python code snippet using autotest_python

dot_matmul.py

Source: dot_matmul.py Github

copy

Full Screen

...21 C_1, C_2, C_3, C_422 ).arrange_in_grid(buff=1.5)23 self.add(g2.to_edge(RIGHT))24 calculate = [25 [A_1.get_rows()[0], B_1.get_columns()[0], C_1.get_entries()[0]],26 [A_1.get_rows()[0], B_1.get_columns()[1], C_1.get_entries()[1]],27 [A_1.get_rows()[0], B_2.get_columns()[0], C_1.get_entries()[2]],28 [A_1.get_rows()[0], B_2.get_columns()[1], C_1.get_entries()[3]],29 [A_1.get_rows()[1], B_1.get_columns()[0], C_2.get_entries()[0]],30 [A_1.get_rows()[1], B_1.get_columns()[1], C_2.get_entries()[1]],31 [A_1.get_rows()[1], B_2.get_columns()[0], C_2.get_entries()[2]],32 [A_1.get_rows()[1], B_2.get_columns()[1], C_2.get_entries()[3]],33 [A_2.get_rows()[0], B_1.get_columns()[0], C_3.get_entries()[0]], 34 [A_2.get_rows()[0], B_1.get_columns()[1], C_3.get_entries()[1]],35 [A_2.get_rows()[0], B_2.get_columns()[0], C_3.get_entries()[2]],36 [A_2.get_rows()[0], B_2.get_columns()[1], C_3.get_entries()[3]],37 [A_2.get_rows()[1], B_1.get_columns()[0], C_4.get_entries()[0]],38 [A_2.get_rows()[1], B_1.get_columns()[1], C_4.get_entries()[1]],39 [A_2.get_rows()[1], B_2.get_columns()[0], C_4.get_entries()[2]],40 [A_2.get_rows()[1], B_2.get_columns()[1], C_4.get_entries()[3]]41 ]42 for a, b, c in calculate:43 rect1 = SurroundingRectangle(a)44 rect2 = SurroundingRectangle(b)45 rect3 = SurroundingRectangle(c)46 self.play(rect1.animate())47 self.play(rect2.animate())48 self.play(rect3.animate())49 self.wait(0.5)50 self.remove(rect1)51 self.remove(rect2)52 self.remove(rect3)53class MatrixMatmul(Scene):54 def construct(self):55 np.random.seed(42)56 A = np.random.randint(0,10,size=(2,2,2))57 A_1 = Matrix(A[0],v_buff=0.5, h_buff=0.5)58 A_2 = Matrix(A[1],v_buff=0.5, h_buff=0.5)59 B = np.random.randint(0,10,size=(2,2,2))60 B_1 = Matrix(B[0],v_buff=0.5, h_buff=0.5)61 B_2 = Matrix(B[1],v_buff=0.5, h_buff=0.5)62 C = np.matmul(A,B)63 C_1 = Matrix(C[0])64 C_2 = Matrix(C[1])65 g1 = Group(66 A_1, B_1, A_2, B_267 ).arrange_in_grid(buff=1)68 self.add(g1.to_edge(LEFT))69 g2 = Group(70 C_1, C_271 ).arrange_in_grid(buff=1)72 self.add(g2.to_edge(RIGHT))73 74 for i in range(A.shape[2]):75 rect1 = SurroundingRectangle(A_1.get_rows()[i],color=RED)76 rect2 = SurroundingRectangle(A_2.get_rows()[i])77 for j in range(B.shape[1]):78 rect3 = SurroundingRectangle(B_1.get_columns()[j],color=RED)79 rect4 = SurroundingRectangle(B_2.get_columns()[j])80 rect5 = SurroundingRectangle(C_1.get_entries()[j+(i*B.shape[1])],color=RED)81 rect6 = SurroundingRectangle(C_2.get_entries()[j+(i*B.shape[1])])82 self.play(rect1.animate())83 self.play(rect2.animate())84 self.play(rect3.animate())85 self.play(rect4.animate())86 self.play(rect5.animate())87 self.play(rect6.animate())88 self.wait(0.5)89 90 self.remove(rect3)91 self.remove(rect4)92 self.remove(rect5)93 self.remove(rect6)94 self.remove(rect1)95 self.remove(rect2)...

Full Screen

Full Screen

con_analysis_MvsW.py

Source: con_analysis_MvsW.py Github

copy

Full Screen

...46 cc_shfl = np.zeros(N)47 for i in range(N):48 W_shfl = FG.shuffle_matrix(W)49 WTW_shfl = LA.sqrtm(W_shfl.T @ W_shfl)50 W_entr_shfl = FG.get_entries(WTW_shfl, diag=diag)51 cc_shfl[i] = np.corrcoef(W_entr_shfl, M_entries)[0, 1]52 return cc_shfl53def signif_sqrtWTW_M_LR(WL, WR, M_entries, N, diag):54 cc_shfl = np.zeros(N)55 for i in range(N):56 WL_shfl = FG.shuffle_matrix(WL)57 WR_shfl = FG.shuffle_matrix(WR)58 WTW_L_shfl = LA.sqrtm(WL_shfl.T @ WL_shfl)59 WTW_R_shfl = LA.sqrtm(WR_shfl.T @ WR_shfl)60 W_entr_shfl = np.concatenate([FG.get_entries(WTW_L_shfl, diag=diag),61 FG.get_entries(WTW_R_shfl, diag=diag)])62 cc_shfl[i] = np.corrcoef(W_entr_shfl, M_entries)[0, 1]63 return cc_shfl64def signif_sqrtWTW_M_LRbis(WL, WR, M_entries, N, diag):65 cc_shfl = np.zeros(N)66 for i in range(N):67 WL_shfl = FG.shuffle_matrix(WL)68 WR_shfl = FG.shuffle_matrix(WR)69 WTW_L_shfl = LA.sqrtm(WL_shfl.T @ WL_shfl)70 WTW_R_shfl = LA.sqrtm(WR_shfl.T @ WR_shfl)71 W_entr_shfl = np.concatenate([FG.get_entries(WTW_L_shfl, diag=diag),72 FG.get_entries(WTW_R_shfl, diag=diag)])73 cc_shfl[i] = np.corrcoef(W_entr_shfl,74 np.random.permutation(M_entries))[0, 1]75 return cc_shfl76# %%77# relationship between sqrt(WtW) and M (as theory, excluding the diagonal78# to which we have no access)79N = 1000080diag = False81# there is a unique symmetic square root82W_entries = np.concatenate([FG.get_entries(LA.sqrtm(WTW_L), diag=diag),83 FG.get_entries(LA.sqrtm(WTW_R), diag=diag)])84M_entries = np.concatenate([FG.get_entries(M_L, diag=diag),85 FG.get_entries(M_R, diag=diag)])86plt.figure()87plt.scatter(M_entries, W_entries)88plt.title('WTW vs M, L&R')89plt.show()90cc_real = np.corrcoef(W_entries, M_entries)[0, 1]91cc_shfl = signif_sqrtWTW_M_LR(W_f_L.values, W_f_R.values,92 M_entries, N, diag)93pval = np.mean(cc_shfl > cc_real)94print('sqrt(WTW) vs M, on LR, cc', cc_real, 'pval', pval)95cc_shfl = signif_sqrtWTW_M_LRbis(W_f_L.values, W_f_R.values,96 M_entries, N, diag)97pval = np.mean(cc_shfl > cc_real)98print('sqrt(WTW) vs M, on LR, shuffling M as well, cc', cc_real, 'pval', pval)99W_entries = FG.get_entries(LA.sqrtm(WTW_L), diag=diag)100M_entries = FG.get_entries(M_L, diag=diag)101plt.figure()102plt.scatter(M_entries, W_entries)103plt.title('sqrt(WTW) vs M, L')104plt.show()105cc_real = np.corrcoef(W_entries, M_entries)[0, 1]106cc_shfl = signif_sqrtWTW_M(W_f_L.values, M_entries, N, diag)107pval = np.mean(cc_shfl > cc_real)108print('sqrt(WTW) vs M, on L, cc', cc_real, 'pval', pval)109W_entries = FG.get_entries(LA.sqrtm(WTW_R), diag=diag)110M_entries = FG.get_entries(M_R, diag=diag)111plt.figure()112plt.scatter(M_entries, W_entries)113plt.title('sqrt(WTW) vs M, R')114plt.show()115cc_real = np.corrcoef(W_entries, M_entries)[0, 1]116cc_shfl = signif_sqrtWTW_M(W_f_R.values, M_entries, N, diag)117pval = np.mean(cc_shfl > cc_real)...

Full Screen

Full Screen

test_marker.py

Source: test_marker.py Github

copy

Full Screen

1def test_marker__measure_no_start_or_end(marker):2 marker.start("foobar")3 marker.end("foobar")4 marker.measure("foobar")5 assert len(marker.timeline.get_entries()) == 36 assert any([e.name == "measure:foobar" for e in marker.timeline.get_entries()])7def test_marker__measure_start_only(marker):8 marker.start("foobar")9 marker.end("foobar")10 marker.end("barbaz")11 marker.measure("barbaz", "foobar")12 assert len(marker.timeline.get_entries()) == 413 assert any([e.name == "measure:barbaz" for e in marker.timeline.get_entries()])14def test_marker__measure_different_start_and_end(marker):15 marker.start("foobar")16 marker.end("barbaz")17 marker.measure("barbaz", "foobar", "barbaz")18 assert len(marker.timeline.get_entries()) == 319 assert any([e.name == "measure:barbaz" for e in marker.timeline.get_entries()])20def test_marker__measure_no_marks(marker):21 marker.measure("foobar")22 assert len(marker.timeline.get_entries()) == 123 assert any([e.name == "measure:foobar" for e in marker.timeline.get_entries()])24def test_marker__context_manager(marker):25 with marker("foobar"):26 pass27 assert len(marker.timeline.get_entries()) == 228def test_marker__nested_context_manager(marker):29 with marker("foobar") as nested_marker:30 with nested_marker("barbaz"):31 pass32 assert len(marker.timeline.get_entries()) == 433def test_marker__decorator(marker):34 @marker.decorator("foobar")35 def mock_func():36 pass37 mock_func()...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Scala Testing: A Comprehensive Guide

Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.

What Agile Testing (Actually) Is

So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.

How To Choose The Right Mobile App Testing Tools

Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools

A Complete Guide To CSS Houdini

As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????

Appium Testing Tutorial For Mobile Applications

The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.

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