Beispiel #1
0
    def test_api(self):
        """Testing ElelectronDosPlotter API."""
        gsr_path = abidata.ref_file("si_scf_GSR.nc")
        gs_bands = ElectronBands.from_file(gsr_path)
        si_edos = gs_bands.get_edos()

        plotter = ElectronDosPlotter()
        plotter.add_edos("edos1", si_edos)
        with self.assertRaises(ValueError):
            plotter.add_edos("edos1", si_edos)
        plotter.add_edos("edos2",
                         gsr_path,
                         edos_kwargs=dict(method="gaussian",
                                          step=0.2,
                                          width=0.4))
        assert len(plotter.edos_list) == 2
        assert not plotter._can_use_basenames_as_labels()

        if self.has_matplotlib():
            assert plotter.combiplot(show=False)
            assert plotter.gridplot(show=False)

        if self.has_ipywidgets():
            assert plotter.ipw_select_plot() is not None

        if self.has_nbformat():
            assert plotter.write_notebook(nbpath=self.get_tmpname(text=True))
Beispiel #2
0
    def test_api(self):
        """Testing ElelectronDosPlotter API."""
        gsr_path = abidata.ref_file("si_scf_GSR.nc")
        gs_bands = ElectronBands.from_file(gsr_path)
        si_edos = gs_bands.get_edos()

        plotter = ElectronDosPlotter()
        plotter.add_edos("edos1", si_edos)
        with self.assertRaises(ValueError):
            plotter.add_edos("edos1", si_edos)
        plotter.add_edos("edos2", gsr_path, edos_kwargs=dict(method="gaussian", step=0.2, width=0.4))
        assert len(plotter.edos_list) == 2
        assert not plotter._can_use_basenames_as_labels()

        if self.has_matplotlib():
            assert plotter.combiplot(show=False)
            assert plotter.gridplot(show=False)

        if self.has_ipywidgets():
            assert plotter.ipw_select_plot() is not None

        if self.has_nbformat():
            assert plotter.write_notebook(nbpath=self.get_tmpname(text=True))