Example #1
0
 def test_load_from_file_object(self):
     path = osp.join(TEST_DIR, 'noisy_WL_30x5.zip')
     ref_w = WinstonLutz.from_zip(path)
     ref_w.analyze()
     with open(path, 'rb') as f:
         w = WinstonLutz.from_zip(f)
         w.analyze()
     self.assertIsInstance(w, WinstonLutz)
     self.assertEqual(w.gantry_iso_size, ref_w.gantry_iso_size)
Example #2
0
 def test_load_from_stream(self):
     path = osp.join(TEST_DIR, 'noisy_WL_30x5.zip')
     ref_w = WinstonLutz.from_zip(path)
     ref_w.analyze()
     with open(path, 'rb') as f:
         s = io.BytesIO(f.read())
         w = WinstonLutz.from_zip(s)
         w.analyze()
     self.assertIsInstance(w, WinstonLutz)
     self.assertEqual(w.gantry_iso_size, ref_w.gantry_iso_size)
def run_wl(path):
    """Function to pass to the process pool executor to process picket fence images."""
    try:
        my_wl = WinstonLutz.from_zip(path)
        if my_wl.gantry_iso_size > 3:
            raise ValueError
        return 'Success'
    except Exception as e:
        return 'Failure: {} @ {}'.format(e, path)
Example #4
0
 def setUpClass(cls):
     filename = cls.get_filename()
     if cls.zip:
         cls.wl = WinstonLutz.from_zip(filename, use_filenames=cls.use_filenames)
     else:
         cls.wl = WinstonLutz(filename, use_filenames=cls.use_filenames)
     if cls.print_results:
         print(cls.wl.results())
         print(cls.wl.bb_shift_vector)
Example #5
0
 def setUpClass(cls):
     filename = cls.get_filename()
     if cls.zip:
         cls.wl = WinstonLutz.from_zip(filename)
     else:
         cls.wl = WinstonLutz(filename)
Example #6
0
 def test_plot_wo_all_axes(self):
     # test that analyzing images w/o gantry images doesn't fail
     wl_zip = osp.join(TEST_FILES_DIR, 'Winston-Lutz', 'Naming.zip')
     wl = WinstonLutz.from_zip(wl_zip, use_filenames=True)
     wl.plot_summary()  # shouldn't raise
Example #7
0
 def test_bad_filenames(self):
     # tests_basic that using filenames with incorrect syntax will fail
     wl_dir = osp.join(TEST_FILES_DIR, 'Winston-Lutz', 'Bad Names.zip')
     with self.assertRaises(ValueError):
         wl = WinstonLutz.from_zip(wl_dir, use_filenames=True)
Example #8
0
 def setUpClass(cls):
     filename = cls.get_filename()
     if cls.zip:
         cls.wl = WinstonLutz.from_zip(filename)
     else:
         cls.wl = WinstonLutz(filename)
Example #9
0
 def test_bb_too_far_away_fails(self):
     """BB is >20mm from CAX"""
     file = get_file_from_cloud_test_repo([TEST_DIR, 'bb_too_far_away.zip'])
     wl = WinstonLutz.from_zip(file)
     with self.assertRaises(ValueError):
         wl.analyze()