Exemple #1
0
class TestLogPlottingSaving(TestCase):
    """Test the plotting methods and plot saving methods."""
    tlog = MachineLog.from_demo_trajectorylog()
    dlog = MachineLog.from_demo_dynalog()

    def test_save_tlog_to_csv(self):
        save_file(self.tlog.to_csv)

    def test_plot_axes(self):
        for methodname in ('plot_actual', 'plot_expected', 'plot_difference'):
            method = getattr(self.tlog.axis_data.gantry, methodname)
            method()  # shouldn't raise

    def test_save_axes(self):
        for methodname in ('save_plot_actual', 'save_plot_expected',
                           'save_plot_difference'):
            # save matplotlib figures
            method = getattr(self.tlog.axis_data.gantry, methodname)
            save_file(method)

            # save MPLD3 HTML
            save_file(method, interactive=True, as_file_object='str')

    def test_fluence_plotting(self):
        # raise error if map hasn't yet been calc'ed.
        with self.assertRaises(AttributeError):
            self.dlog.fluence.actual.plot_map()

        self.dlog.fluence.actual.calc_map()
        self.dlog.fluence.actual.plot_map()
        self.dlog.fluence.gamma.calc_map()
        self.dlog.fluence.gamma.histogram()
        self.dlog.fluence.gamma.plot_histogram()
        self.dlog.fluence.gamma.plot_passfail_map()

    def test_saving_fluence_plots(self):
        self.dlog.fluence.gamma.calc_map()
        save_file(self.dlog.fluence.gamma.save_map)
        save_file(self.dlog.fluence.gamma.save_histogram)

    def test_save_summary(self):
        self.tlog.fluence.gamma.calc_map()
        save_file(self.tlog.save_summary)
Exemple #2
0
 def setUpClass(cls):
     cls.log = MachineLog.from_demo_trajectorylog()
     cls.log.fluence.gamma.calc_map()
Exemple #3
0
 def setUpClass(cls):
     cls.log = MachineLog.from_demo_trajectorylog()
     cls.log.fluence.gamma.calc_map()