コード例 #1
0
 def test_load_trajectory_log_from_file_object(self):
     path = get_file_from_cloud_test_repo(
         ['mlc_logs', 'tlogs', 'dynamic_imrt.bin'])
     ref_log = TrajectoryLog(path)
     with open(path, 'rb') as f:
         t = TrajectoryLog(f)
     self.assertIsInstance(t, TrajectoryLog)
     self.assertEqual(t.num_beamholds, ref_log.num_beamholds)
コード例 #2
0
ファイル: test_logs.py プロジェクト: keremgolbasi/pylinac
    def test_txt_file_also_loads_if_around(self):
        # has a .txt file
        log_with_txt = osp.join(
            TEST_DIR, 'mixed_types',
            "Anonymous_4DC Treatment_JST90_TX_20140712094246.bin")

        log = TrajectoryLog(log_with_txt)
        self.assertIsNotNone(log.txt)
        self.assertIsInstance(log.txt, dict)
        self.assertEqual(log.txt['Patient ID'], 'Anonymous')

        # DOESN'T have a txt file
        log_no_txt = osp.join(
            TEST_DIR, 'tlogs',
            "Anonymous_4DC Treatment_JS0_TX_20140712095629.bin")

        log = TrajectoryLog(log_no_txt)
        self.assertIsNone(log.txt)
コード例 #3
0
    def test_txt_file_also_loads_if_around(self):
        # has a .txt file
        _ = get_folder_from_cloud_test_repo(['mlc_logs', 'mixed_types'])
        log_with_txt = get_file_from_cloud_test_repo([
            'mlc_logs', 'mixed_types',
            "Anonymous_4DC Treatment_JST90_TX_20140712094246.bin"
        ])

        log = TrajectoryLog(log_with_txt)
        self.assertIsNotNone(log.txt)
        self.assertIsInstance(log.txt, dict)
        self.assertEqual(log.txt['Patient ID'], 'Anonymous')

        # DOESN'T have a txt file
        _ = get_folder_from_cloud_test_repo(['mlc_logs', 'tlogs'])
        log_no_txt = get_file_from_cloud_test_repo([
            'mlc_logs', 'tlogs',
            "Anonymous_4DC_Treatment_JS0_TX_20140712095629.bin"
        ])

        log = TrajectoryLog(log_no_txt)
        self.assertIsNone(log.txt)
コード例 #4
0
ファイル: test_logs.py プロジェクト: keremgolbasi/pylinac
 def test_destination(self):
     tlog_file = osp.join(
         ANONYMOUS_DEST_FOLDER,
         'PatientID_4DC Treatment_JST90_TX_20140712094246.bin')
     tlog = TrajectoryLog(tlog_file)
     tlog.anonymize(destination=ANONYMOUS_DEST_FOLDER)  # shouldn't raise
コード例 #5
0
ファイル: test_logs.py プロジェクト: keremgolbasi/pylinac
 def setUpClass(cls):
     cls.log = TrajectoryLog.from_demo()
     cls.log.fluence.gamma.calc_map()
コード例 #6
0
 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)
コード例 #7
0
 def setUpClass(cls):
     cls.tlog = TrajectoryLog.from_demo()
     cls.dlog = Dynalog.from_demo()
コード例 #8
0
 def test_calc_gamma_early_fails(self):
     log = TrajectoryLog.from_demo()
     with self.assertRaises(ValueError):
         log.fluence.gamma.plot_map()
コード例 #9
0
 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)
コード例 #10
0
 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)
コード例 #11
0
 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)
コード例 #12
0
ファイル: test_logs.py プロジェクト: wangdajiang/pylinac
 def test_dynamic_imrt_log(self):
     tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'dynamic_imrt.bin'))
     self.assertTrue(tlog.treatment_type, DYNAMIC_IMRT)
コード例 #13
0
ファイル: test_logs.py プロジェクト: wangdajiang/pylinac
 def test_static_imrt_log(self):
     tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'static_imrt.bin'))
     self.assertTrue(tlog.treatment_type, STATIC_IMRT)
コード例 #14
0
ファイル: test_logs.py プロジェクト: wangdajiang/pylinac
 def test_vmat_log(self):
     tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'vmat.bin'))
     self.assertTrue(tlog.treatment_type, VMAT)
コード例 #15
0
ファイル: test_logs.py プロジェクト: wangdajiang/pylinac
 def test_imaging_log(self):
     tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'imaging.bin'))
     self.assertTrue(tlog.treatment_type, IMAGING)
コード例 #16
0
ファイル: test_logs.py プロジェクト: wangdajiang/pylinac
 def test_publish_pdf_w_imaging_log(self):
     imaging_tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs',
                                           'imaging.bin'))
     with self.assertRaises(ValueError), tempfile.TemporaryFile() as t:
         imaging_tlog.publish_pdf(t)