printed too often what is read

This commit is contained in:
Markus Rosenstihl 2016-07-05 11:58:37 +02:00
parent c49a752ebd
commit a6109c65b9

View File

@ -8,13 +8,13 @@ class FileReader:
def read_datafile( path ): def read_datafile( path ):
# TODO analyze file (LF,MF, HF) and act accordingly # TODO analyze file (LF,MF, HF) and act accordingly
print "Skipping first 4 lines!" print "Skipping first 4 lines!"
data = np.loadtxt(path, skiprows=4) data = np.loadtxt(path, skiprows=4, comments="#")
numpat = re.compile('\d+\.\d+') numpat = re.compile('\d+\.\d+')
print "successfully read %s"%path print "successfully read %s"%path
try: try:
Temp = None Temp = None
print "Searching for temperature in %s (any line with 'Fixed or 'Temp', with float, i.e. 273.15K or 273.15)" % path
for i,line in enumerate(open(path).readlines()): for i,line in enumerate(open(path).readlines()):
print "Searching for temperature in %s (Line with 'Fixed or 'Temp', with float, i.e. 273.15K or 273.15)"%path
if re.search("Fixed", line) or re.search("Temp", line): if re.search("Fixed", line) or re.search("Temp", line):
print "Found line containing 'Fixed' or 'Temp' (line %i):"%i print "Found line containing 'Fixed' or 'Temp' (line %i):"%i
print line print line