Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Climate Lab Test Stand
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MSK-SW
Low-Level Radio Frequency
Climate Lab
Climate Lab Test Stand
Commits
b3214a39
Commit
b3214a39
authored
2 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
change analysis to also allow humidity plots
parent
f423ece9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Python_script/analysis.py
+24
-14
24 additions, 14 deletions
Python_script/analysis.py
Python_script/prototype.py
+1
-1
1 addition, 1 deletion
Python_script/prototype.py
with
25 additions
and
15 deletions
Python_script/analysis.py
+
24
−
14
View file @
b3214a39
...
...
@@ -2,7 +2,6 @@ import pandas as pd
import
matplotlib.pyplot
as
plt
import
math
def
extract_stable_data
(
datafile
):
datapoint
=
{}
#df is a pandas data frame
...
...
@@ -30,20 +29,27 @@ def extract_stable_data(datafile):
return
datapoint
def
plot_temperature_sweep
(
temperatures
,
humidity
,
basename
):
temps_from_data
=
[]
# sweep_type is either 'temperature' or 'humidity'
def
plot_sweep
(
temperatures
,
humidities
,
basename
,
sweep_type
):
x_data
=
[]
phases
=
[]
phase_vars
=
[]
magnitudes
=
[]
magnitude_vars
=
[]
for
temp
in
temperatures
:
datafile
=
basename
+
'
_
'
+
str
(
temp
)
+
'
deg_
'
+
str
(
hum
idity
)
+
'
rh.csv
'
for
temp
,
hum
in
zip
(
temperatures
,
humidities
)
:
datafile
=
basename
+
'
_
'
+
str
(
temp
)
+
'
deg_
'
+
str
(
hum
)
+
'
rh.csv
'
print
(
datafile
)
datapoint
=
extract_stable_data
(
datafile
)
if
datapoint
is
None
:
continue
temps_from_data
.
append
(
datapoint
[
'
temperature_mean
'
])
if
sweep_type
==
'
temperature
'
:
x_data
.
append
(
datapoint
[
'
temperature_mean
'
])
elif
sweep_type
==
'
humidity
'
:
x_data
.
append
(
datapoint
[
'
humidity_mean
'
])
else
:
raise
Exception
(
'
Unknown sweep_type:
'
+
str
(
sweep_type
))
phases
.
append
(
datapoint
[
'
phase_mean
'
])
phase_vars
.
append
(
datapoint
[
'
phase_var
'
])
magnitudes
.
append
(
datapoint
[
'
magnitude_mean
'
])
...
...
@@ -55,14 +61,20 @@ def plot_temperature_sweep(temperatures, humidity, basename):
fig
,
ax1
=
plt
.
subplots
()
plt
.
title
(
basename
+
'
: Temperature sweep at
'
+
str
(
humidity
)
+
'
% r.h.
'
)
if
sweep_type
==
'
temperature
'
:
plt
.
title
(
basename
+
'
: Temperature sweep at
'
+
str
(
humidities
[
0
])
+
'
% r.h.
'
)
ax1
.
set_xlabel
(
'
temperature [deg C]
'
)
elif
sweep_type
==
'
humidity
'
:
plt
.
title
(
basename
+
'
: Humidity sweep at
'
+
str
(
temperatures
[
0
])
+
'
deg C
'
)
ax1
.
set_xlabel
(
'
relative humidity [%]
'
)
else
:
raise
Exception
(
'
Unknown sweep_type:
'
+
str
(
sweep_type
))
ax1
.
errorbar
(
temps_from_data
,
phases
,
phase_vars
,
marker
=
'
+
'
,
linewidth
=
0
)
ax1
.
set_xlabel
(
'
temperature [deg C]
'
)
ax1
.
errorbar
(
x_data
,
phases
,
phase_vars
,
marker
=
'
+
'
,
linewidth
=
0
)
ax1
.
set_ylabel
(
'
S21 phase [deg]
'
,
color
=
'
blue
'
)
ax2
=
ax1
.
twinx
()
ax2
.
errorbar
(
temps_from
_data
,
magnitudes_db
,
magnitude_vars_db
,
marker
=
'
x
'
,
color
=
'
red
'
,
linewidth
=
0
)
ax2
.
errorbar
(
x
_data
,
magnitudes_db
,
magnitude_vars_db
,
marker
=
'
x
'
,
color
=
'
red
'
,
linewidth
=
0
)
ax2
.
set_ylabel
(
'
S21 magnitude [dB]
'
,
color
=
'
red
'
)
fig
.
tight_layout
()
# otherwise the right y-label is slightly clipped
...
...
@@ -70,6 +82,4 @@ def plot_temperature_sweep(temperatures, humidity, basename):
if
__name__
==
'
__main__
'
:
plot_temperature_sweep
(
range
(
20
,
30
+
1
),
40
,
'
tempsweep1
'
)
plot_sweep
(
range
(
20
,
30
+
1
),
[
40
]
*
11
,
'
tempsweep1
'
,
'
temperature
'
)
This diff is collapsed.
Click to expand it.
Python_script/prototype.py
+
1
−
1
View file @
b3214a39
...
...
@@ -411,7 +411,7 @@ if __name__ == '__main__':
temp_extensions
=
[]
for
t
in
temperatures
:
temp_extensions
.
append
(
str
(
t
)
+
'
deg_
'
+
str
(
humidity
)
+
'
rh
'
)
analysis
.
plot_
temperature_
sweep
(
temperatures
,
humidity
,
output_basename
)
analysis
.
plot_sweep
(
temperatures
,
[
humidity
]
*
len
(
temperatures
)
,
output_basename
,
'
temperature
'
)
plot_output
(
output_basename
,
temp_extensions
,
args
.
plot
,
output_basename
+
'
: Temperature sweep
'
+
str
(
temperatures
[
0
])
+
'
degC to
'
+
str
(
temperatures
[
-
1
])
+
'
degC
'
)
print
(
str
(
temp_extensions
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment