All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
""" 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]))…
Amith Ganta
updated on 28 Oct 2019
"""
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
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Quater car modelling using Matlab
Quarter Car model …
25 Sep 2023 03:07 PM IST
Pacjeka combined slip
Pacjeka Magic Tyre model Pacjeka Magic Tyre model was developed by Prof.Hans Bastiaan Pacejka and it is widely used to represent empirically and interpolate previously measured…
05 Jun 2023 02:04 PM IST
Longitudinal and Lateral brush tyre model using Matlab
Tyre Modeling A tyre model is a mathematical or an empirical representation of the mechanism…
16 May 2023 07:14 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.