@@ -46,7 +46,20 @@ class TestSingleSimulation:
4646 def single_simulation (self , al_phase ):
4747 gen = SimulationGenerator (accelerating_voltage = 200 )
4848 rot = Rotation .from_axes_angles ([1 , 0 , 0 ], 45 , degrees = True )
49- coords = DiffractingVector (phase = al_phase , xyz = [[1 , 0 , 0 ]])
49+ coords = DiffractingVector (
50+ phase = al_phase ,
51+ xyz = [
52+ [1 , 0 , 0 ],
53+ [2 , 0 , 0 ],
54+ [3 , 3 , 0 ],
55+ [- 4 , 0 , 0 ],
56+ [- 5 , 0 , 0 ],
57+ [- 6 , 0 , 0 ],
58+ [- 7 , 0 , 0 ],
59+ [- 8 , 0 , 0 ],
60+ ],
61+ intensity = [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ],
62+ )
5063 sim = Simulation2D (
5164 phases = al_phase , simulation_generator = gen , coordinates = coords , rotations = rot
5265 )
@@ -91,12 +104,12 @@ def test_polar_flatten(self, single_simulation):
91104 theta_templates ,
92105 intensities_templates ,
93106 ) = single_simulation .polar_flatten_simulations ()
94- assert r_templates .shape == (1 , 1 )
95- assert theta_templates .shape == (1 , 1 )
96- assert intensities_templates .shape == (1 , 1 )
107+ assert r_templates .shape == (1 , 8 )
108+ assert theta_templates .shape == (1 , 8 )
109+ assert intensities_templates .shape == (1 , 8 )
97110
98111 def test_polar_flatten_axes (self , single_simulation ):
99- radial_axes = np .linspace (0 , 1 , 10 )
112+ radial_axes = np .linspace (0 , 7 , 5 )
100113 theta_axes = np .linspace (0 , 2 * np .pi , 10 )
101114 (
102115 r_templates ,
@@ -105,9 +118,13 @@ def test_polar_flatten_axes(self, single_simulation):
105118 ) = single_simulation .polar_flatten_simulations (
106119 radial_axes = radial_axes , azimuthal_axes = theta_axes
107120 )
108- assert r_templates .shape == (1 , 1 )
109- assert theta_templates .shape == (1 , 1 )
110- assert intensities_templates .shape == (1 , 1 )
121+ assert r_templates .shape == (1 , 8 )
122+ assert theta_templates .shape == (1 , 8 )
123+ assert intensities_templates .shape == (1 , 8 )
124+ # The last 2 elements should be zero
125+ np .testing .assert_array_equal (r_templates [:, 6 :], 0 )
126+ np .testing .assert_array_equal (theta_templates [:, 6 :], 0 )
127+ np .testing .assert_array_equal (intensities_templates [:, 6 :], 0 )
111128
112129 def test_deepcopy (self , single_simulation ):
113130 copied = single_simulation .deepcopy ()
0 commit comments