How to use the pylinac.log_analyzer.TrajectoryLog function in pylinac

To help you get started, we’ve selected a few pylinac examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jrkerns / pylinac / tests_basic / test_logs.py View on Github external
def test_tlog_file(self):
        tlog = osp.join(TEST_DIR, 'tlogs', 'dynamic_imrt.bin')
        self.assertIsInstance(load_log(tlog), TrajectoryLog)
github jrkerns / pylinac / tests_basic / test_logs.py View on Github external
def test_imaging_log(self):
        tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'imaging.bin'))
        self.assertTrue(tlog.treatment_type, IMAGING)
github jrkerns / pylinac / tests_basic / test_logs.py View on Github external
def test_not_logs(self):
        # throw an error for files that aren't logs
        test_tlog = osp.join(TEST_DIR, 'tlogs', "Anonymous_4DC Treatment_JS0_TX_20140712095629.bin")
        not_a_file = test_tlog.replace(".bin", 'blahblah.bin')
        self.assertRaises(IOError, TrajectoryLog, not_a_file)
        not_a_log = osp.join(osp.dirname(__file__), 'test_files', 'VMAT', 'DRGSmlc-105-example.dcm')
        self.assertRaises(IOError, TrajectoryLog, not_a_log)
github jrkerns / pylinac / tests_basic / test_logs.py View on Github external
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)
github jrkerns / pylinac / tests_basic / test_logs.py View on Github external
def test_not_logs(self):
        # throw an error for files that aren't logs
        test_tlog = osp.join(TEST_DIR, 'tlogs', "Anonymous_4DC Treatment_JS0_TX_20140712095629.bin")
        not_a_file = test_tlog.replace(".bin", 'blahblah.bin')
        self.assertRaises(IOError, TrajectoryLog, not_a_file)
        not_a_log = osp.join(osp.dirname(__file__), 'test_files', 'VMAT', 'DRGSmlc-105-example.dcm')
        self.assertRaises(IOError, TrajectoryLog, not_a_log)
github jrkerns / pylinac / tests_basic / test_logs.py View on Github external
def test_vmat_log(self):
        tlog = TrajectoryLog(osp.join(TEST_DIR, 'tlogs', 'vmat.bin'))
        self.assertTrue(tlog.treatment_type, VMAT)
github jrkerns / pylinac / tests_basic / test_logs.py View on Github external
def test_calc_gamma_early_fails(self):
        log = TrajectoryLog.from_demo()
        with self.assertRaises(ValueError):
            log.fluence.gamma.plot_map()
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
def run_demo():
        """Run the Trajectory log demo."""
        tlog = TrajectoryLog.from_demo()
        tlog.report_basic_parameters()
        tlog.plot_summary()
github jrkerns / pylinac / pylinac / log_analyzer.py View on Github external
* VMAT
            * Dynamic IMRT
            * Static IMRT
            * Imaging
        """
        if isinstance(self, TrajectoryLog):  # trajectory log
            gantry_std = max(subbeam.gantry_angle.actual.std() for subbeam in self.subbeams)
            if np.isnan(gantry_std):
                return IMAGING
        else:
            gantry_std = self.axis_data.gantry.actual.std()
        if gantry_std > 0.5:
            return VMAT
        elif self.axis_data.mu.actual.max() <= 2.1:
            return IMAGING
        elif self.axis_data.mlc.num_moving_leaves == 0 and isinstance(self, TrajectoryLog):
            return STATIC_IMRT
        else:
            return DYNAMIC_IMRT