예제 #1
0
def test_plot_ti_dhdl():
    '''Just test if the plot runs'''
    bz = load_benzene().data
    dHdl_coul = pd.concat([extract_dHdl(xvg, T=300) for xvg in bz['Coulomb']])
    ti_coul = TI()
    ti_coul.fit(dHdl_coul)
    assert isinstance(plot_ti_dhdl(ti_coul), matplotlib.axes.Axes)
    fig, ax = plt.subplots(figsize=(8, 6))
    assert isinstance(plot_ti_dhdl(ti_coul, ax=ax), matplotlib.axes.Axes)
    assert isinstance(plot_ti_dhdl(ti_coul, labels=['Coul']),
                      matplotlib.axes.Axes)
    assert isinstance(plot_ti_dhdl(ti_coul, labels=['Coul'], colors=['r']),
                      matplotlib.axes.Axes)
    dHdl_vdw = pd.concat([extract_dHdl(xvg, T=300) for xvg in bz['VDW']])
    ti_vdw = TI().fit(dHdl_vdw)
    assert isinstance(plot_ti_dhdl([ti_coul, ti_vdw]), matplotlib.axes.Axes)
    ti_coul.dhdl = pd.DataFrame.from_dict({
        'fep': range(100)
    },
                                          orient='index',
                                          columns=np.arange(100) / 100).T
    assert isinstance(plot_ti_dhdl(ti_coul), matplotlib.axes.Axes)
예제 #2
0
 def test_plot_ti_dhdl_unknown(self, estimaters):
     ti, mbar = estimaters
     with pytest.raises(ValueError):
         fig = plot_ti_dhdl(ti, units='ddd')
예제 #3
0
 def test_plot_ti_dhdl_kcal(self, estimaters):
     ti, mbar = estimaters
     ax = plot_ti_dhdl(ti, units='kcal/mol')
     assert isinstance(ax, matplotlib.axes.Axes)
     plt.close(ax.figure)