FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Aether/srcPython/logfile_read.py at refs/heads/develop · AetherModel/Aether · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
AetherModel
/
Aether
Public
Notifications
You must be signed in to change notification settings
Fork
31
Star
25
Code
Issues
21
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Aether
/
srcPython
/
logfile_read.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
39 lines (31 loc) · 1.11 KB
Breadcrumbs
Aether
/
srcPython
/
logfile_read.py
Copy path
File metadata and controls
executable file
·
39 lines (31 loc) · 1.11 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
from
glob
import
glob
import
csv
import
matplotlib
.
pyplot
as
plt
import
datetime
as
dt
filelist
=
sorted
(
glob
(
'UA/output/*log*.txt'
))
file
=
filelist
[
0
]
# Initialize lists to hold time and temperature values
time_values
=
[]
temp_values
=
[]
# Read the file and process the data
with
open
(
file
,
'r'
)
as
file
:
reader
=
csv
.
DictReader
(
file
,
delimiter
=
' '
)
start
=
None
first_line
=
True
for
row
in
reader
:
if
first_line
:
start
=
dt
.
datetime
(
int
(
row
[
'year'
]),
int
(
row
[
'month'
]),
int
(
row
[
'day'
]),
int
(
row
[
'hour'
]),
int
(
row
[
'minute'
]),
int
(
row
[
'second'
]))
first_line
=
False
current
=
dt
.
datetime
(
int
(
row
[
'year'
]),
int
(
row
[
'month'
]),
int
(
row
[
'day'
]),
int
(
row
[
'hour'
]),
int
(
row
[
'minute'
]),
int
(
row
[
'second'
]))
duration
=
current
-
start
time_values
.
append
(
int
(
duration
.
seconds
))
temp_values
.
append
(
float
(
row
[
'max_temp'
]))
# Create the plot
plt
.
plot
(
time_values
,
temp_values
)
plt
.
xlabel
(
'Time (s)'
)
plt
.
ylabel
(
'Temperature'
)
plt
.
title
(
'Time vs Temperature'
)
plotFile
=
'log.png'
print
(
' Outputting file : '
,
plotFile
)
plt
.
savefig
(
plotFile
)
Back
|
FazBrowse Home
|
New Git URL