def forceDistribution(this, z0, z1, bins, simulation = -1, states = "all", label = ''): length = this.stateNumbers[simulation]; runName = this.simulations[simulation]; f, r = mda.forceDistribution(z0, z1, bins, runName, length, states, label); plt.figure(10); plt.plot(r, f); plt.savefig("/home/andre/Dropbox/plot/radialForceDistribution_%s.pdf"%label, bbox_inches = 'tight'); plt.close();
def forceDistribution(this, bins, senderMark, direction, simulation = -1, states = "all", label = ''): length = this.stateNumbers[simulation]; runName = this.simulations[simulation]; r, data = mda.forceDistribution(runName, bins, senderMark, states, direction, length); fz = data[0, :]; fr = data[1, :]; ft = data[2, :]; plt.figure(10); plt.plot(r, fz, '-b'); plt.figure(11); plt.plot(r, fr, '-g'); plt.figure(12); plt.plot(r, ft, '-r'); plt.show();
def forceDistribution(this, bins, senderMark, direction, simulation = -1, states = "all", label = ''): length = this.stateNumbers[simulation]; runName = this.simulations[simulation]; x, y, data = mda.forceDistribution(runName, bins, senderMark, states, direction, length); save = this.path + "/data"; if(not os.path.exists(save)): os.makedirs(save) #end saveZ = save + "/z" + label; saveX = save + "/x" + label; saveY = save + "/y" + label; np.save(saveZ, data); np.save(saveX, x); np.save(saveY, y); X, Y = np.meshgrid(x, y) Z = data[0, :, :]; if(not noplt): from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter # import matplotlib.pyplot as plt # import numpy as np print np.shape(data), np.shape(x), np.shape(y); # print data[0, :, :]; fig = plt.figure() ax = fig.gca(projection = '3d') surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm, linewidth=0, antialiased=False) # ax.set_zlim(-1.01, 1.01) ax.zaxis.set_major_locator(LinearLocator(10)) ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f')) fig.colorbar(surf, shrink=0.5, aspect=5) plt.axis('off'); plt.show();