Project

Data File parsing Using Python

"""
Demaonstrating file parsing in Python
"""
#import modules
import matplotlib.pyplot as plt 


# Basic initialization
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, linewidth =3)
plt.show()

plt.plot(volume , pressure, linewidth =3)
plt.show()

Engine data file :

https://drive.google.com/file/d/1L8GY56d-M8mB1KfceM-xVhGNvnCIqxjm/view

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.