From 1595a350aa9988aa357de97349b5729d0469d864 Mon Sep 17 00:00:00 2001 From: Sander Roet Date: Fri, 23 Aug 2024 15:29:36 +0200 Subject: [PATCH] add test for tophat filer extraction and plotting --- tests/test_tmjob.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/test_tmjob.py b/tests/test_tmjob.py index c5fcf9a2..9a15b66b 100644 --- a/tests/test_tmjob.py +++ b/tests/test_tmjob.py @@ -630,7 +630,7 @@ def test_tm_job_half_precision(self): self.assertEqual(s.dtype, np.float16) self.assertEqual(a.dtype, np.float32) - def test_extraction(self): + def test_extractions(self): _ = self.job.start_job(0, return_volumes=True) # extract particles after running the job @@ -755,6 +755,23 @@ def test_extraction(self): create_plot=False, ) + # Test exraction with tophat filter and plotting + df, scores = extract_particles( + job, + 5, + 100, + tomogram_mask_path=TEST_EXTRACTION_MASK_INSIDE, + create_plot=True, + tophat_filter=True, + ) + self.assertNotEqual( + len(scores), + 0, + msg="We expected a detected particle with a extraction mask that " + "covers the object.", + ) + # We don't look for the plots, they might be skipped if no plotting is available + def test_get_defocus_offsets(self): tilt_angles = list(range(-51, 54, 3)) x_offset_um = 200 * 13.79 * 1e-4