Skip to content

Commit 94eaf88

Browse files
committed
adding working jenkins test
1 parent 53a8ec9 commit 94eaf88

2 files changed

Lines changed: 41 additions & 33 deletions

File tree

‎tests/conftest.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ def FBP2d_astra():
228228
def FBP3d_tomobar_denoising():
229229
return "docs/source/pipelines_full/FBP3d_tomobar_denoising.yaml"
230230

231+
231232
@pytest.fixture
232233
def angles_averaging():
233234
return "docs/source/pipelines_full/angles_averaging.yaml"
@@ -343,6 +344,12 @@ def FBP2d_astra_i12_119647_npz():
343344
return np.load("tests/test_data/raw_data/i12/FBP2d_astra_i12_119647.npz")
344345

345346

347+
@pytest.fixture
348+
def angle_average_LPrec_i12_119647_npz():
349+
# 10 slices numpy array
350+
return np.load("tests/test_data/raw_data/i12/angle_average_LPrec_i12_119647.npz")
351+
352+
346353
@pytest.fixture
347354
def FBP3d_tomobar_TVdenoising_i13_177906_npz():
348355
# 10 slices numpy array

‎tests/test_parallel_pipeline_big.py‎

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)