Lowest curve plot below data cloudΒΆ

try pytraj online:

http://mybinder.org/badge.svg

../_images/lowest_curve.png
In [1]:
! head esurf_vs_rmsd.dat
2.14566	10.6364
1.80556	10.2486
1.70040	10.3254
1.82970	10.7363
2.52036	10.7145
2.57752	11.7054
2.21513	10.4196
2.38134	10.3821
2.26788	10.1739
2.73504	10.7062
In [2]:
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
import pytraj as pt
import numpy as np

# load energy and rmsd data
data = np.loadtxt('esurf_vs_rmsd.dat').T
data
Out[2]:
array([[  2.14566,   1.80556,   1.7004 , ...,   4.42627,   4.58734,
          4.1027 ],
       [ 10.6364 ,  10.2486 ,  10.3254 , ...,  10.8499 ,  11.1952 ,  11.58   ]])
In [3]:
lowest_data = pt.lowest_curve(data, points=10, step=0.2)
# skip final data points to have  nicer plot
lowest_data = lowest_data[:, :-5]
lowest_data
Out[3]:
array([[  0.34831   ,   0.54831   ,   0.74831   , ...,   7.34831   ,
          7.54831   ,   7.74831   ],
       [  9.38836   ,   9.20639   ,   9.16268   , ...,  13.88775714,
         13.6081    ,  14.8627    ]])

do plotting

In [4]:
%matplotlib inline
%config InlineBackend.figure_format = 'retina'  # high resolution
import matplotlib
matplotlib.rcParams['savefig.dpi'] = 2 * matplotlib.rcParams['savefig.dpi'] # larger image
In [5]:
from matplotlib import pyplot as plt

plt.plot(data[0], data[1], 'o', markersize=2., alpha=0.5)
plt.plot(lowest_data[0], lowest_data[1], linewidth=4.)
plt.xlabel('rmsd (angstrom)')
plt.ylabel('ESURF (kcal/mol)')
#plt.savefig('lowest_curve.png')
Out[5]:
<matplotlib.text.Text at 0x7f5931d53ac8>

(basic_tutorial_lowestcurve.ipynb; basic_tutorial_lowestcurve_evaluated.ipynb; basic_tutorial_lowestcurve.py)