To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit ba70da61 authored by dkammer's avatar dkammer
Browse files

add plot script

parent 639ee84a
#!/usr/bin/env python3
import sys
import numpy as np
import matplotlib.pyplot as plt
def plot(sname):
data = []
with open(sname+".dat",'r') as fl:
lines = fl.readlines()
for line in lines:
data.append([float(i) for i in line.strip().split()])
data = np.array(data)
fig = plt.figure()
ax = fig.add_subplot(311)
ax.plot(data[:,0],data[:,2],label='kin')
ax.legend(loc='best')
ax.set_ylabel('energy')
ax = fig.add_subplot(312)
ax.plot(data[:,0],data[:,3],label='pot')
ax.legend(loc='best')
ax.set_ylabel('energy')
ax = fig.add_subplot(313)
ax.plot(data[:,0],data[:,4],label='tot')
ax.legend(loc='best')
ax.set_xlabel('iter')
ax.set_ylabel('energy')
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(data[:,0],data[:,1],label='temperature')
ax.legend(loc='best')
ax.set_xlabel('iter')
ax.set_ylabel('temperature')
plt.show()
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.exit('Missing argument! usage: ./basic_example.plot.py <sim-name>')
sname = str(sys.argv[1])
plot(sname)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment