read line
arupmondal835 opened this issue · comments
Arup commented
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
import sys
#import pandas as pd
from pylab import plot, ylim, xlim, show, xlabel, ylabel, grid
from numpy import linspace, loadtxt, ones, convolve
filename= 'contacts.dat'
f = open(filename, "r")
lines = f.readlines()
time=[]
energy =[]
#running_std=[]
for line in lines:
line = line.strip()
line = line.split(" ")
line = [float(i) for i in line if i!=""]
time.append(int(line[0]))
energy.append(int(line[1]))
# running_std.append(np.std(energy))
print(time)
print(energy)
file = open("testfile.dat","w")
for i in range(len(time)):
file.write('%d %d\n'%(time[i], energy[i]))
file.close()