Skip to content

Instantly share code, notes, and snippets.

@Tyaedalis
Created July 31, 2017 21:37
Show Gist options
  • Save Tyaedalis/254caa7b46c5a011d75d35251acf88ec to your computer and use it in GitHub Desktop.
Save Tyaedalis/254caa7b46c5a011d75d35251acf88ec to your computer and use it in GitHub Desktop.
Eases the data collection process for ProcEngines.
from os import walk
files = []
for (dirpath, dirnames, filenames) in walk('./data/'):
files.extend(filenames)
break
for file in files:
t = []
with open('./data/' + file) as f:
for i, line in enumerate(f):
if i in [24, 25, 31, 35, 39]:
t.append(line.split())
Pc = t[0][1]
Tc = t[1][1]
Te = t[1][4]
Pe = t[0][4]
MW = t[3][4]
gamma = t[2][4]
Mach = t[4][5]
result = f'key = {Pc}, {Tc}, {Te}, {Pe}, {MW}, {gamma}, {Mach}\n'
with open('results.txt', 'a') as f:
f.write(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment