def test_make_otf(tmp_path): """Test that it can make an otf file from a psf.""" dest = str(tmp_path / "otf_test.tif") result = make_otf(PSF_PATH, dest) assert Path(result).exists() # make sure it matches the known OTF assert np.allclose(imread(result), imread(OTF_PATH), atol=0.05)
def setUp(self): self.raw = os.path.join(os.path.dirname(__file__), 'test_data', 'im_raw.tif') self.deskewed = os.path.join(os.path.dirname(__file__), 'test_data', 'im_deskewed.tif') self.raw = imread(self.raw) self.deskewed = imread(self.deskewed)
def test_make_otf(self): """ Test that it can make an otf file from a psf """ result = make_otf(self.psf, self.dest) self.assertTrue(os.path.isfile(result)) known = imread(self.otf) # make sure it matches the known OTF self.assertTrue(np.allclose(imread(result), known)) os.remove(self.dest)
def test_decon_wrapper_with_psf_array(self): """ test that we can deconvolve an image """ psf = imread(self.psf) decon_result = decon(self.deskewed, psf, **self.config) self.assertTrue(np.allclose(decon_result, self.stored_decon))
def test_rotate(self): """ test that rotateGPU rotates the image on the Y axis by some angle """ rotated = rotateGPU(self.deskewed, 0.3, dxdata=0.1, angle=31.5) stored_rot = os.path.join(os.path.dirname(__file__), 'test_data', 'im_rotated.tif') stored_rot = imread(stored_rot) self.assertTrue(np.allclose(rotated, stored_rot))
def setUp(self): self.raw = os.path.join(os.path.dirname(__file__), 'test_data', 'im_raw.tif') self.deskewed = os.path.join(os.path.dirname(__file__), 'test_data', 'im_deskewed.tif') self.stored_decon = os.path.join(os.path.dirname(__file__), 'test_data', 'im_decon.tif') self.otf = os.path.join(os.path.dirname(__file__), 'test_data', 'otf.tif') self.psf = os.path.join(os.path.dirname(__file__), 'test_data', 'psf.tif') self.raw = imread(self.raw) self.deskewed = imread(self.deskewed) self.stored_decon = imread(self.stored_decon) self.config = { 'dzdata': 0.3, 'deskew': 0, 'n_iters': 10, 'background': 98, }
def rotated_image(): return imread(str(DATA / "im_rotated.tif"))
def decon_image(): return imread(str(DATA / "im_decon.tif"))
def deskewed_image(): return imread(str(DATA / "im_deskewed.tif"))
def raw_image(): return imread(str(DATA / "im_raw.tif"))
def test_decon_wrapper_with_psf_array(deskewed_image, decon_image, config): """test that we can deconvolve an image with psf as array""" decon_result = decon(deskewed_image, imread(PSF_PATH), **config) npt.assert_allclose(decon_result, decon_image, atol=ATOL)