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
a857511b
Commit
a857511b
authored
2 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
improvements in analysis
- use list of measurements instead of start/end - use naming scheme - code formatting
parent
71119df0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Python_script/analysis.py
+22
-19
22 additions, 19 deletions
Python_script/analysis.py
with
22 additions
and
19 deletions
Python_script/analysis.py
+
22
−
19
View file @
a857511b
...
...
@@ -2,6 +2,7 @@ import pandas as pd
import
matplotlib.pyplot
as
plt
import
math
def
extract_stable_data
(
datafile
):
datapoint
=
{}
#df is a pandas data frame
...
...
@@ -15,59 +16,61 @@ def extract_stable_data(datafile):
datapoint
[
'
phase_var
'
]
=
phases
.
var
()
magnitudes
=
df
.
loc
[
df
[
'
EQUILIBRIUM_INDICATOR
'
]
==
31
,
'
S21_MAGNITUDE
'
]
datapoint
[
'
magnitude_mean
'
]
=
magnitudes
.
mean
()
datapoint
[
'
magnitude_var
'
]
=
magnitudes
.
var
()
datapoint
[
'
magnitude_mean
'
]
=
magnitudes
.
mean
()
datapoint
[
'
magnitude_var
'
]
=
magnitudes
.
var
()
temperatures
=
df
.
loc
[
df
[
'
EQUILIBRIUM_INDICATOR
'
]
==
31
,
'
READBACK_TEMPERATURE
'
]
datapoint
[
'
temperature_mean
'
]
=
temperatures
.
mean
()
datapoint
[
'
temperature_var
'
]
=
temperatures
.
var
()
datapoint
[
'
temperature_mean
'
]
=
temperatures
.
mean
()
datapoint
[
'
temperature_var
'
]
=
temperatures
.
var
()
humidities
=
df
.
loc
[
df
[
'
EQUILIBRIUM_INDICATOR
'
]
==
31
,
'
READBACK_HUMIDITY
'
]
datapoint
[
'
humidity_mean
'
]
=
humidities
.
mean
()
datapoint
[
'
humidity_var
'
]
=
humidities
.
var
()
datapoint
[
'
humidity_mean
'
]
=
humidities
.
mean
()
datapoint
[
'
humidity_var
'
]
=
humidities
.
var
()
return
datapoint
#FIXME: Come up with a naming scheme
def
plot_temperature_sweep
(
start_temp
,
stop_temp
,
humidity
,
basename
):
temps
=
[]
# FIXME: Come up with a naming scheme
def
plot_temperature_sweep
(
temperatures
,
humidity
,
basename
):
temps_from_data
=
[]
phases
=
[]
phase_vars
=
[]
magnitudes
=
[]
magnitude_vars
=
[]
for
temp
in
range
(
start_temp
,
stop_temp
+
1
)
:
datafile
=
str
(
temp
)
+
'
deg_
'
+
str
(
humidity
)
+
'
rh
_
'
+
basename
+
'
.csv
'
for
temp
in
temperatures
:
datafile
=
basename
+
'
_
'
+
str
(
temp
)
+
'
deg_
'
+
str
(
humidity
)
+
'
rh.csv
'
print
(
datafile
)
datapoint
=
extract_stable_data
(
datafile
)
if
datapoint
is
None
:
continue
temps
.
append
(
datapoint
[
'
temperature_mean
'
])
temps
_from_data
.
append
(
datapoint
[
'
temperature_mean
'
])
phases
.
append
(
datapoint
[
'
phase_mean
'
])
phase_vars
.
append
(
datapoint
[
'
phase_var
'
])
magnitudes
.
append
(
datapoint
[
'
magnitude_mean
'
])
magnitude_vars
.
append
(
datapoint
[
'
magnitude_var
'
])
magnitudes_db
=
[
20
*
math
.
log10
(
x
)
for
x
in
magnitudes
]
#approximate formula for small errors (linear approximation)
magnitude_vars_db
=
[
20
/
math
.
log
(
10
)
*
dx
/
x
for
x
,
dx
in
zip
(
magnitudes
,
magnitude_vars
)]
magnitudes_db
=
[
20
*
math
.
log10
(
x
)
for
x
in
magnitudes
]
#
approximate formula for small errors (linear approximation)
magnitude_vars_db
=
[
20
/
math
.
log
(
10
)
*
dx
/
x
for
x
,
dx
in
zip
(
magnitudes
,
magnitude_vars
)]
fig
,
ax1
=
plt
.
subplots
()
plt
.
title
(
'
Temperature sweep at
'
+
str
(
humidity
)
+
'
% r.h.
'
)
plt
.
title
(
basename
+
'
:
Temperature sweep at
'
+
str
(
humidity
)
+
'
% r.h.
'
)
ax1
.
errorbar
(
temps
,
phases
,
phase_vars
,
marker
=
'
+
'
,
linewidth
=
0
)
ax1
.
errorbar
(
temps
_from_data
,
phases
,
phase_vars
,
marker
=
'
+
'
,
linewidth
=
0
)
ax1
.
set_xlabel
(
'
temperature [deg C]
'
)
ax1
.
set_ylabel
(
'
S21 phase [deg]
'
,
color
=
'
blue
'
)
ax2
=
ax1
.
twinx
()
ax2
.
errorbar
(
temps
,
magnitudes_db
,
magnitude_vars_db
,
marker
=
'
x
'
,
color
=
'
red
'
,
linewidth
=
0
)
ax2
.
errorbar
(
temps
_from_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
plt
.
show
()
if
__name__
==
'
__main__
'
:
plot_temperature_sweep
(
20
,
30
,
40
,
'
tempsweep1
'
)
plot_temperature_sweep
(
range
(
20
,
30
+
1
)
,
40
,
'
tempsweep1
'
)
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