From 3b7f502f244c0fb449d262e3448d0e3577b9691e Mon Sep 17 00:00:00 2001 From: Ziwen Liu Date: Fri, 5 Jan 2024 15:09:30 -0800 Subject: [PATCH] specify the parameters used and test --- tests/models/test_inplane_oriented_thick_pol3D.py | 6 ++++-- waveorder/models/inplane_oriented_thick_pol3d.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/models/test_inplane_oriented_thick_pol3D.py b/tests/models/test_inplane_oriented_thick_pol3D.py index 4027102..bb929a6 100644 --- a/tests/models/test_inplane_oriented_thick_pol3D.py +++ b/tests/models/test_inplane_oriented_thick_pol3D.py @@ -17,8 +17,9 @@ def test_calculate_transfer_function(): @pytest.mark.parametrize(*_DEVICE) -def test_apply_inverse_transfer_function(device): - input_shape = (5, 10, 5, 5) +@pytest.mark.parametrize("estimate_bg", [True, False]) +def test_apply_inverse_transfer_function(device, estimate_bg): + input_shape = (5, 10, 100, 100) czyx_data = torch.rand(input_shape, device=device) intensity_to_stokes_matrix = ( @@ -31,6 +32,7 @@ def test_apply_inverse_transfer_function(device): results = inplane_oriented_thick_pol3d.apply_inverse_transfer_function( czyx_data=czyx_data, intensity_to_stokes_matrix=intensity_to_stokes_matrix, + remove_estimated_background=estimate_bg, ) assert len(results) == 4 diff --git a/waveorder/models/inplane_oriented_thick_pol3d.py b/waveorder/models/inplane_oriented_thick_pol3d.py index aefbaaf..031856d 100644 --- a/waveorder/models/inplane_oriented_thick_pol3d.py +++ b/waveorder/models/inplane_oriented_thick_pol3d.py @@ -133,7 +133,9 @@ def apply_inverse_transfer_function( # Estimate the background and subtract background_corrected_stokes[ stokes_index - ] -= correction.estimate_background(z_projection, normalize=False) + ] -= correction.estimate_background( + z_projection, order=2, block_size=32 + ) # Project to 2D (typically for SNR reasons) if project_stokes_to_2d: