Exemple #1
0
 def test_all_radii_give_same_wobble(self):
     """Test that the wobble stays roughly the same for all radii."""
     if self.test_all_radii:
         star = Starshot(self.star_file)
         for radius in np.linspace(0.9, 0.25, 8):
             star.analyze(radius=float(radius), min_peak_height=self.min_peak_height, recursive=self.recursive)
             self.assertAlmostEqual(star.wobble.diameter_mm, self.wobble_diameter_mm, delta=self.wobble_tolerance)
Exemple #2
0
 def test_all_radii_give_same_wobble(self):
     """Test that the wobble stays roughly the same for all radii."""
     if self.test_all_radii:
         star = Starshot(self.star_file)
         for radius in np.linspace(0.9, 0.25, 8):
             star.analyze(radius=float(radius), min_peak_height=self.min_peak_height, recursive=self.recursive)
             self.assertAlmostEqual(star.wobble.diameter_mm, self.wobble_diameter_mm, delta=self.wobble_tolerance)
Exemple #3
0
class Star_general_tests(unittest.TestCase):
    """Performs general tests (not demo specific)."""
    def setUp(self):
        self.star = Starshot()
        self.star.load_demo_image()

    def test_analyze_without_images(self):
        star = Starshot()
        self.assertRaises(AttributeError, star.analyze)
Exemple #4
0
 def test_image_inverted(self):
     """Check that the demo image was actually inverted, as it needs to be."""
     star = Starshot.from_demo_image()
     top_left_corner_val_before = star.image.array[0,0]
     star._check_image_inversion()
     top_left_corner_val_after = star.image.array[0,0]
     self.assertNotEqual(top_left_corner_val_before, top_left_corner_val_after)
Exemple #5
0
 def test_image_inverted(self):
     """Check that the demo image was actually inverted, as it needs to be."""
     star = Starshot.from_demo_image()
     top_left_corner_val_before = star.image.array[0,0]
     star._check_image_inversion()
     top_left_corner_val_after = star.image.array[0,0]
     self.assertNotEqual(top_left_corner_val_before, top_left_corner_val_after)
Exemple #6
0
 def test_fails_with_tight_tol(self):
     star = Starshot.from_demo_image()
     star.analyze(tolerance=0.1)
     self.assertFalse(star.passed)
Exemple #7
0
 def test_from_url(self):
     url = 'https://s3.amazonaws.com/assuranceqa-staging/uploads/imgs/10X_collimator_dvTK5Jc.jpg'
     Starshot.from_url(url)  # shouldn't raise
Exemple #8
0
 def test_analyze_without_images(self):
     star = Starshot()
     with self.assertRaises(AttributeError):
         star.analyze()
Exemple #9
0
 def setUp(self):
     self.star = Starshot.from_demo_image()
     self.star.analyze()
Exemple #10
0
 def test_from_url(self):
     url = 'https://s3.amazonaws.com/assuranceqa-staging/uploads/imgs/10X_collimator_dvTK5Jc.jpg'
     Starshot.from_url(url)  # shouldn't raise
Exemple #11
0
 def setUpClass(cls):
     cls.star = Starshot(cls.star_file)
     cls.star.analyze(recursive=cls.recursive, min_peak_height=cls.min_peak_height, fwhm=cls.fwxm)
Exemple #12
0
 def test_analyze_without_images(self):
     star = Starshot()
     with self.assertRaises(AttributeError):
         star.analyze()
Exemple #13
0
 def setUp(self):
     self.star = Starshot.from_demo_image()
     self.star.analyze()
Exemple #14
0
 def setUpClass(cls):
     img_dir = osp.join(test_file_dir, 'set')
     img_files = [osp.join(img_dir, filename) for filename in os.listdir(img_dir)]
     cls.star = Starshot.from_multiple_images(img_files)
     cls.star.analyze(radius=0.6)
Exemple #15
0
class Test_Star_Demo(unittest.TestCase, Star_Test):
    """Specific tests for the demo image"""
    wobble_diameter_mm = 0.35
    wobble_center = Point(1270, 1438)
    num_rad_lines = 4

    def setUp(self):
        self.star = Starshot()
        self.star.load_demo_image()

    def test_passed(self):
        self.star.analyze()
        super().test_passed()

    def test_failed_with_tight_tol(self):
        self.star.tolerance.value = 0.1
        self.star.analyze()
        self.assertFalse(self.star.passed)

    def test_wobble_center(self):
        self.star.analyze()
        super().test_wobble_center()

    def test_num_rad_lines(self):
        self.star.analyze()
        super().test_num_rad_lines()

    def test_wobble_diameter(self):
        self.star.analyze()
        super().test_wobble_diameter()

    def test_bad_inputs(self):
        self.star.analyze(radius=0.3, min_peak_height=0.1)
        self.test_wobble_center()
        self.test_wobble_diameter()

    def test_demo_runs(self):
        """Test that the demo runs without error."""
        # TODO: come up with decorator that adds show parameter
        self.star.run_demo()

    def test_image_inverted(self):
        """Check that the demo image was actually inverted, as it needs to be."""
        top_left_corner_val_before = self.star.image.array[0,0]
        self.star._check_image_inversion()
        top_left_corner_val_after = self.star.image.array[0,0]
        self.assertNotEqual(top_left_corner_val_before, top_left_corner_val_after)

    def test_SID_can_be_overridden_for_nonEPID(self):
        self.star.analyze(SID=400)
        self.assertNotEqual(self.star.wobble.diameter, self.wobble_diameter_mm*2)
Exemple #16
0
 def setUpClass(cls):
     img_dir = osp.join(test_file_dir, 'set')
     img_files = [osp.join(img_dir, filename) for filename in os.listdir(img_dir)]
     cls.star = Starshot.from_multiple_images(img_files)
     cls.star.analyze(radius=0.6)
Exemple #17
0
 def setUp(self):
     self.star = Starshot()
     self.star.load_demo_image()
Exemple #18
0
 def test_fails_with_tight_tol(self):
     star = Starshot.from_demo_image()
     star.analyze(tolerance=0.1)
     self.assertFalse(star.passed)