diff --git a/src/cdtools/datasets/ptycho_2d_dataset.py b/src/cdtools/datasets/ptycho_2d_dataset.py index 46d2ba7..6631cd6 100644 --- a/src/cdtools/datasets/ptycho_2d_dataset.py +++ b/src/cdtools/datasets/ptycho_2d_dataset.py @@ -380,7 +380,7 @@ class Ptycho2DDataset(CDataset): the dataset is downsampled with the data. The background is downsampled using the same method as the data. - If there is no quantum efficiency mask, then the mask is downsapled so + If there is no quantum efficiency mask, then the mask is downsampled so that any output pixel containing a masked pixel will be masked. If there is a quantum efficiency mask, then the quantum efficiency mask is downsampled using the same method as the data, and the mask is diff --git a/src/cdtools/tools/measurements/measurements.py b/src/cdtools/tools/measurements/measurements.py index 8ce41ae..c926568 100644 --- a/src/cdtools/tools/measurements/measurements.py +++ b/src/cdtools/tools/measurements/measurements.py @@ -196,22 +196,15 @@ def quadratic_background( sim_patterns : torch.Tensor A real MxN array storing the wavefield's intensities """ - - if detector_slice is None: - raw_intensity = measurement( - wavefield, - *args, - epsilon=epsilon, - oversampling=oversampling, - simulate_finite_pixels=simulate_finite_pixels) - else: - raw_intensity = measurement( - wavefield, - *args, - detector_slice=detector_slice, - epsilon=epsilon, - oversampling=oversampling, - simulate_finite_pixels=simulate_finite_pixels) + + raw_intensity = measurement( + wavefield, + *args, + detector_slice=detector_slice, + epsilon=epsilon, + oversampling=oversampling, + simulate_finite_pixels=simulate_finite_pixels + ) if qe_mask is None: output = raw_intensity + background**2 diff --git a/tests/tools/test_analysis.py b/tests/tools/test_analysis.py index 27c6a65..f0a1cf1 100644 --- a/tests/tools/test_analysis.py +++ b/tests/tools/test_analysis.py @@ -160,7 +160,7 @@ def test_standardize(): probe = probe * np.exp(-1j * np.angle(np.sum(probe))) assert np.isclose(1, np.sum(np.abs(probe)**2)/ len(probe.ravel())) - assert np.angle(np.sum(probe)) < 1e-7 + assert np.angle(np.sum(probe)) < 2e-7 obj = 30 * np.random.rand(230,240) * np.exp(1j * (np.random.rand(230,240) - 0.5)) obj_slice = np.s_[(obj.shape[0]//8)*3:(obj.shape[0]//8)*5, @@ -232,7 +232,7 @@ def test_synthesize_reconstructions(): probe = probe * np.exp(-1j * np.angle(np.sum(probe))) assert np.isclose(1, np.sum(np.abs(probe)**2)/ len(probe.ravel())) - assert np.abs(np.angle(np.sum(probe))) < 1e-7 + assert np.abs(np.angle(np.sum(probe))) < 2e-7 obj = 30 * np.random.rand(230,240) * np.exp(1j * (np.random.rand(230,240) - 0.5)) obj_slice = np.s_[(obj.shape[0]//8)*3:(obj.shape[0]//8)*5,