def test_randomNorm(): N = 10; M = 10; dN = 6 l = 1; d = l*2e-3 np.random.seed(7) sim = Simulation(N, dN, M, l, d, random_fun='normal', test=True) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["animation_vertices"]) == 98
def test_random10(): N = 10; M = 10; dN = 6 l = 1; d = l*2e-3 np.random.seed(4) sim = Simulation(N, dN, M, l, d, random_fun='uni square', test=True) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["animation_vertices"]) == 108
def test_randomNormTable(): N = 10; M = 10; dN = 6 l = 1; d = l*2e-3 np.random.seed(7) vertices = np.random.normal(0,l,size=(N,2)) sim = Simulation(N, dN, M, l, d, vertices, test=True) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["animation_vertices"]) == 98
def test_random10Table(): N = 10; M = 10; dN = 6 l = 1; d = l*2e-3 np.random.seed(4) vertices = np.random.random(size=(N,2))*2*l-l sim = Simulation(N, dN, M, l, d, vertices, test=True) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["animation_vertices"]) == 108
def test_classStraight(): vertices = [np.array([0, 1])] N = len(vertices) M = 10 dN = len(vertices) l = 1 d = l * 2e-3 sim = Simulation(N, dN, M, l, d, vertices=vertices, test=True) output = sim.run() assert len(output["active_vertices"]) == 0
def test_classTwoToPlay(): vertices = [np.array([1, 1]), np.array([1, -1])] N = len(vertices) M = 10 dN = len(vertices) l = 1 d = l * 2e-3 sim = Simulation(N, dN, M, l, d, vertices=vertices, test=True) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["animation_segments_index"]) == 102
def test_classSimultaneous_growing(): #powstają dziwne ścieżki oraz pętle vertices = [np.array([1, 1]), np.array([1, -1]), np.array([0.5, 0.5])] N = len(vertices) M = 10 dN = len(vertices) l = 1 d = l * 2e-3 sim = Simulation(N, dN, M, l, d, vertices=vertices, test=True) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["animation_segments_index"]) == 91
def test_random_mini(): l = 1 d = l * 2e-3 N = 10 M = 10 dN = 6 np.random.seed(4) vertices = RPwC(l, 4, 0.4) sim = Simulation(N, dN, M, l, d, vertices=vertices.T, test=True) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["animation_vertices"]) == 82
def test_simultaneous_breach(): #jak wyżej vertices = [ np.array([1, 1]), np.array([1, -1]), np.array([0.45, 0.5]), np.array([0.45, -0.5]) ] N = len(vertices) M = 10 dN = len(vertices) l = 1 d = l * 2e-3 sim = Simulation(N, dN, M, l, d, vertices=vertices, test=True) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["animation_segments_index"]) == 82
def test_classAsymetricLoop(): vertices = [np.array([0.5, 0])] segments = [(0, 0), (0.75, 0)] N = len(vertices) M = 10 dN = len(vertices) l = 1 d = l * 2e-3 sim = Simulation(N, dN, M, l, d, vertices=vertices, test=True, initial_segments=segments) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["segments"]) == 377
def test_classLackOfLoopsCentered(): vertices = [np.array([0, 1])] segments = [(0, 0), (2e-3, 0), (-2e-3, 0), (2 * 2e-3, 0), (-2 * 2e-3, 0)] N = len(vertices) M = 10 dN = len(vertices) l = 1 d = l * 2e-3 sim = Simulation(N, dN, M, l, d, vertices=vertices, test=True, initial_segments=segments) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["segments"]) == 505
def test_classLoopsVsMulti( ): #dwie ścieżki nachodzą na siebie. Nie powoduje błędów vertices = [np.array([0.5, 0]), np.array([0.2, 0])] segments = [(0, 0), (0.75, 0)] N = len(vertices) M = 10 dN = len(vertices) l = 1 d = l * 2e-3 sim = Simulation(N, dN, M, l, d, vertices=vertices, test=True, initial_segments=segments) output = sim.run() assert len(output["active_vertices"]) == 0 assert len(output["segments"]) > 300
def main(): # N_tab = [5000, 3500, 2000, 1000, 500, 200] N_tab = [1500, 1200, 600, 300] N_tab = N_tab[::-1] M = 10 dN = 6 l = 1 d = l * 2e-3 alpha = 1.0 for j in tqdm(range(100)): np.random.seed(j * 3) name = f'seed{j*3}' # array = RPwC(l, 9, alpha, 0.009).T array = random_vertex(1, 'uni_square', max(N_tab)) for i in range(len(N_tab)): N = N_tab[i] folder_anim = f'../wyniki/symulacje/wyniki_z_kwietnia/uniform/n{N}/anim' folder_data = f'../wyniki/symulacje/wyniki_z_kwietnia/uniform/n{N}/data' sim = Simulation(N, dN, M, l, d, vertices=array) animation_segments, animation_index, animation_vertices, lines = sim.run( ) save_dict = { 'animation_segments': animation_segments, 'animation_index': animation_index, 'animation_vertices': animation_vertices, 'lines': lines } save_sim(folder_data, name, save_dict) # s = 0 tuple_of_arguments = (animation_segments[:animation_index[-1]], animation_vertices[-1], folder_anim, f'{name}.png', None) save_pic(tuple_of_arguments)