@@ -176,6 +176,77 @@ def test_pipe_parallel_FBP3d_tomobar_k11_38730_in_memory_preview(
176176 assert res_norm < 1e-6
177177
178178
179+ # ########################################################################
180+ @pytest .mark .full_data_parallel
181+ def test_angles_averaging_LPRec_i12_119647_preview (
182+ get_files : Callable ,
183+ cmd_mpirun ,
184+ i12_119647 ,
185+ angles_averaging ,
186+ angle_average_LPrec_i12_119647_npz ,
187+ output_folder ,
188+ ):
189+
190+ change_value_parameters_method_pipeline (
191+ angles_averaging ,
192+ method = [
193+ "standard_tomo" ,
194+ "average_projection_frames" ,
195+ ],
196+ key = [
197+ "preview" ,
198+ "projection_averaging_factor" ,
199+ ],
200+ value = [
201+ {"detector_y" : {"start" : 800 , "stop" : 1200 }},
202+ 12 ,
203+ ],
204+ )
205+
206+ cmd_mpirun .insert (9 , i12_119647 )
207+ cmd_mpirun .insert (10 , angles_averaging )
208+ cmd_mpirun .insert (11 , output_folder )
209+
210+ process = Popen (
211+ cmd_mpirun , env = os .environ , shell = False , stdin = PIPE , stdout = PIPE , stderr = PIPE
212+ )
213+ output , error = process .communicate ()
214+ print (output )
215+
216+ files = get_files (output_folder )
217+
218+ #: check the generated reconstruction (hdf5 file)
219+ h5_files = list (filter (lambda x : ".h5" in x , files ))
220+ assert len (h5_files ) == 1
221+
222+ # load the pre-saved numpy array for comparison bellow
223+ data_gt = angle_average_LPrec_i12_119647_npz ["data" ]
224+ axis_slice = angle_average_LPrec_i12_119647_npz ["axis_slice" ]
225+ slices , sizeX , sizeY = np .shape (data_gt )
226+
227+ step = axis_slice // (slices + 2 )
228+ # store for the result
229+ data_result = np .zeros ((slices , sizeX , sizeY ), dtype = np .float32 )
230+
231+ path_to_data = "data/"
232+ h5_file_name = "LPRec3d_tomobar"
233+ for file_to_open in h5_files :
234+ if h5_file_name in file_to_open :
235+ h5f = h5py .File (file_to_open , "r" )
236+ index_prog = step
237+ for i in range (slices ):
238+ data_result [i , :, :] = h5f [path_to_data ][:, index_prog , :]
239+ index_prog += step
240+ h5f .close ()
241+ else :
242+ message_str = f"File name with { h5_file_name } string cannot be found."
243+ raise FileNotFoundError (message_str )
244+
245+ residual_im = data_gt - data_result
246+ res_norm = np .linalg .norm (residual_im .flatten ()).astype ("float32" )
247+ assert res_norm < 1e-6
248+
249+
179250# ########################################################################
180251
181252
0 commit comments