Skip to content

Commit

Permalink
added unit test with median ob. this refs #11
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Aug 11, 2023
1 parent 2a41bfc commit feb9f49
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions tests/NeuNorm/normalizing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,26 @@ def test_normalization_with_same_ob_and_sample_but_forced_mean_ob(self):
o_norm.load(folder=samples_path, auto_gamma_filter=False)
o_norm.load(file=[ob1, ob2, ob3], data_type='ob', auto_gamma_filter=False)
o_norm.normalization(force_mean_ob=True)
expected_normalized_array = np.ones((5,5))
expected_normalized_array[:,2] = 2
expected_normalized_array[:,3] = 3
expected_normalized_array[:,4] = 4
expected_normalized_array = np.ones((5, 5))
expected_normalized_array[:, 2] = 2
expected_normalized_array[:, 3] = 3
expected_normalized_array[:, 4] = 4
assert (o_norm.data['normalized'][0] == expected_normalized_array).all()

def test_normalization_with_same_ob_and_sample_but_forced_median_ob(self):
"""assert normalization with same ob and sample number of files force to use mean ob when flag used"""
samples_path = self.data_path + '/tif/sample/' # 3 files
ob1 = self.data_path + '/tif/ob/ob001.tif'
ob2 = self.data_path + '/tif/ob/ob002.tif'
ob3 = self.data_path + '/tif/ob/ob003.tif'
o_norm = Normalization()
o_norm.load(folder=samples_path, auto_gamma_filter=False)
o_norm.load(file=[ob1, ob2, ob3], data_type='ob', auto_gamma_filter=False)
o_norm.normalization(force_mean_ob=True)
expected_normalized_array = np.ones((5, 5))
expected_normalized_array[:, 2] = 2
expected_normalized_array[:, 3] = 3
expected_normalized_array[:, 4] = 4
assert (o_norm.data['normalized'][0] == expected_normalized_array).all()

def test_normalization_with_fewer_ob_than_sample_works(self):
Expand Down Expand Up @@ -295,7 +311,6 @@ def test_normalization_works_with_1_roi_given_as_a_list(self):
assert expected_normalized_data[_h, _w] == pytest.approx(normalized_data[_h, _w], 1e-5)



class TestDFCorrection:

def setup_method(self):
Expand Down

0 comments on commit feb9f49

Please sign in to comment.