Challenge

Week 6 - Data analysis

"""

	Demonstrating file parsing in python

"""
# Import modules

import matplotlib.pyplot as plt 

# Basic Initialisation
line_count = 1
crank = []
pressure = []
temperature = []
volume = []

# File parsing starts here
for line in open('engine_data.out'):
	if '#' not in line:
		crank.append(float(line.split()[0]))
		pressure.append(float(line.split()[1]))
		temperature.append(float(line.split()[4]))		
		volume.append(float(line.split()[7]))
		line_count = line_count + 1

#figure
plt.plot(crank,pressure,linewidth = 3)
plt.show()
plt.plot(crank,temperature,color = 'red', linewidth = 3)
plt.show()
plt.plot(volume,pressure,linewidth = 3, color = 'green')
plt.show()

Fig. crank vs pressure plot

Fig. Crank vs temperature plot

Fig. Pressure vs volume plot

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.