def test_to_profiles(self): path = get_file_from_cloud_test_repo(['9E-GA0.prs']) prof = SNCProfiler(path) profs = prof.to_profiles() self.assertEqual(len(profs), 4) self.assertIsInstance(profs[0], SingleProfile)
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()
def test_loading(self): path = get_file_from_cloud_test_repo(['9E-GA0.prs']) prof = SNCProfiler(path) self.assertEqual(len(prof.detectors), 254)
def test_invalid_file(self): invalid_file = get_file_from_cloud_test_repo( ['mlc_logs', 'Demo-subbeam-0-actual-fluence.npy']) with self.assertRaises(NotALogError): load_log(invalid_file)
def test_publish_pdf_w_imaging_log(self): imaging_tlog = TrajectoryLog( get_file_from_cloud_test_repo(['mlc_logs', 'tlogs', 'imaging.bin'])) with self.assertRaises(ValueError), tempfile.NamedTemporaryFile() as t: imaging_tlog.publish_pdf(t.name)
def test_tlog_file(self): tlog = get_file_from_cloud_test_repo( ['mlc_logs', 'tlogs', 'dynamic_imrt.bin']) self.assertIsInstance(load_log(tlog), TrajectoryLog)
def test_zip(self): zip_file = get_file_from_cloud_test_repo( ['mlc_logs', 'mixed_types.zip']) self.assertIsInstance(load_log(zip_file), MachineLogs)
def test_static_imrt_log(self): get_folder_from_cloud_test_repo(['mlc_logs', 'dlogs']) dlog = Dynalog( get_file_from_cloud_test_repo( ['mlc_logs', 'dlogs', 'A_static_imrt.dlg'])) self.assertTrue(dlog.treatment_type, TreatmentType.STATIC_IMRT)
def test_dynalog_file(self): dynalog = get_file_from_cloud_test_repo( ['mlc_logs', 'dlogs', 'A_static_imrt.dlg']) self.assertIsInstance(load_log(dynalog), Dynalog)
def test_vmat_log(self): get_folder_from_cloud_test_repo(['mlc_logs', 'dlogs']) dlog = Dynalog( get_file_from_cloud_test_repo(['mlc_logs', 'dlogs', 'A_vmat.dlg'])) self.assertTrue(dlog.treatment_type, TreatmentType.VMAT)
def test_dynamic_imrt_log(self): tlog = TrajectoryLog( get_file_from_cloud_test_repo( ['mlc_logs', 'tlogs', 'dynamic_imrt.bin'])) self.assertTrue(tlog.treatment_type, TreatmentType.DYNAMIC_IMRT.value)
def test_vmat_log(self): tlog = TrajectoryLog( get_file_from_cloud_test_repo(['mlc_logs', 'tlogs', 'vmat.bin'])) self.assertTrue(tlog.treatment_type, TreatmentType.VMAT.value)
def test_imaging_log(self): tlog = TrajectoryLog( get_file_from_cloud_test_repo(['mlc_logs', 'tlogs', 'imaging.bin'])) self.assertTrue(tlog.treatment_type, TreatmentType.IMAGING.value)
def test_loading_from_zip(self): img_zip = get_file_from_cloud_test_repo(['Starshot', 'set.zip']) star = Starshot.from_zip(img_zip) # shouldn't raise star.analyze()