def _plot_ND_FES(data, ax_labels, weights=None, bins=50, figsize=(4,4)):
r""" A wrapper for pyemmas FESs plotting function that can also plot 1D
Parameters
----------
data : list of numpy nd.arrays
ax_labels : list
Returns
-------
ax : :obj:`pylab.Axis` object
FES_data : numpy nd.array containing the FES (only for 1D data)
edges : tuple containimg the axes along which FES is to be plotted (only in the 1D case so far, else it's None)
"""
_plt.figure(figsize=figsize)
ax = _plt.gca()
idata = _np.vstack(data)
ax.set_xlabel(ax_labels[0])
if idata.shape[1] == 1:
h, edges = _np.histogramdd(idata, weights=weights, bins=bins, normed=True)
FES_data = -_np.log(h)
FES_data -= FES_data.min()
ax.plot(edges[0][:-1], FES_data)
ax.set_ylabel('$\Delta G / \kappa T $')
elif idata.shape[1] == 2:
_plot_free_energy(idata[:,0], idata[:,1], weights=weights, nbins=bins, ax=ax,
cmap='nipy_spectral'
)
ax.set_ylabel(ax_labels[1])
edges, FES_data = [None], None
# TODO: retrieve the actual edges from pyemma's "plot_free_energy"'s axes
else:
raise NotImplementedError('Can only plot 1D or 2D FESs, but data has %s columns' % _np.shape(idata)[0])
return ax, FES_data, edges
评论列表
文章目录