Project

Data Analysis

\"\"\" 
	file parsing in python
\"\"\"
#modules
import matplotlib.pyplot as plt
#inputs as the serial of column
a=1
b=8
c=a-1
d=b-1
#basic initialization
line_count=1
first_col=[]
second_col=[]
name1=[]
name2=[]
#parsing starts here
lc=0
for name in open(\'engine_data.out\'):
	if \'#\' in name:
		if lc is 2:
			name1.append(name.split()[a])
			name2.append(name.split()[b])
		lc+=1

#assingning names of columns
filename1=name1[0]
filename2=name2[0]

try:
	for line in open(\'engine_data.out\'):
		if \'#\' not in line:
			first_col.append(float(line.split()[c]))
			second_col.append(float(line.split()[d]))
			line_count+=1
except:
	print(\"File not recognized. Please provide a valid CONVERGE output file.\")

plt.plot(first_col,linewidth=3)
plt.xlabel(filename1)
plt.savefig(filename1)


plt.plot(second_col,linewidth=3)
plt.xlabel(filename2)
plt.savefig(filename2)

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.