def spitnumpy(trajFileName, topology, Nconf): outfile = "comTraj" Nchol = trajIO.cholConc(topology) N, L, com_lipids, com_chol = trajIO.processTrajCOM(trajFileName, Nchol, c.NDIM, Nconf) com_lipids, com_chol = trajIO.translateZ(com_lipids, com_chol) trajIO.np.savez(outfile, L=L, com_lipids=com_lipids, com_chol=com_chol)
f.write(fmt % (time, data)) f.close() if __name__ == '__main__': name = 4 trajFileName = sys.argv[1] Nconf = int(sys.argv[2]) nlog = int(sys.argv[3]) Nblock = Nconf // nlog cutoff = 1.3 #anything above 20chol #maybe 1.3 for everything below? percentage = c.percentages['lipids']['lower'][name] if trajIO.rawOrCOM(trajFileName): Nchol = trajIO.cholConc(topology) N, L, com_lipids, com_chol = trajIO.processTrajCOM( trajFileName, Nchol, c.NDIM, Nconf) com_lipids, com_chol = trajIO.translateZ(com_lipids, com_chol) Nlipids = com_lipids.shape[0] else: L, com_lipids, com_chol = trajIO.decompress(trajFileName) com_lipids, com_chol = trajIO.translateZ(com_lipids, com_chol) #parameters del com_chol cluster_sizes = [name] name = str(cluster_sizes[0]) sys.stdout = open("norm" + name + ".txt", "w") times = list(range(1, 46))
import sys sys.path.append("../") from bilayer_clusters import trajIO from analysis import compress import numpy if __name__ == "__main__": trajFileName = "../data/temp20" chol = "../data/20chol.top" Nchol = trajIO.cholConc(chol) outfile = "../test/comTraj.npz" compress.spitnumpy(trajFileName,chol,100) N,L,com_lipids,com_chol = trajIO.processTrajCOM(trajFileName,Nchol,3,100) L_new,lipids_new,chol_new = trajIO.decompress(outfile) #print(numpy.array_equal(L,L_new)) #print(numpy.array_equal(com_lipids,lipids_new)) #print(numpy.array_equal(com_chol,chol_new)) print(lipids_new.shape) if numpy.array_equal(L,L_new) and numpy.array_equal(com_lipids,lipids_new) and numpy.array_equal(com_chol,chol_new): print("compressLoad test passed") else: print("compressLoad test failed")