@@ -183,7 +183,7 @@ def test_angles_averaging_LPRec_i12_119647_preview(
183183 cmd_mpirun ,
184184 i12_119647 ,
185185 angles_averaging ,
186- FBP3d_tomobar_k11_38730_npz ,
186+ angle_average_LPrec_i12_119647_npz ,
187187 output_folder ,
188188):
189189
@@ -213,38 +213,39 @@ def test_angles_averaging_LPRec_i12_119647_preview(
213213 output , error = process .communicate ()
214214 print (output )
215215
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 = FBP3d_tomobar_k11_38730_npz["data"]
224- # axis_slice = FBP3d_tomobar_k11_38730_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 = "FBP3d_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
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 = "FBP3d_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+
248249
249250# ########################################################################
250251
0 commit comments