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
d7104a63
Commit
d7104a63
authored
1 year ago
by
Michael Pawelzik
Browse files
Options
Downloads
Patches
Plain Diff
test for module postplot
analysis functions for postplot added
parent
ba043c31
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
feat: introduce external sensors
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Python_script/PostPlot.py
+50
-7
50 additions, 7 deletions
Python_script/PostPlot.py
with
50 additions
and
7 deletions
Python_script/PostPlot.py
+
50
−
7
View file @
d7104a63
...
...
@@ -10,6 +10,7 @@ import sys
from
pathlib
import
Path
import
os
import
MeasurementPlot
import
curvefit_and_correlation
# after measurement has finished from stored csv-data a post plot of all temperature steps is plotted and store in
...
...
@@ -24,11 +25,11 @@ class PostPlot:
get_ipython
().
run_line_magic
(
'
matplotlib
'
,
'
qt
'
)
self
.
post
plot_obj
=
MeasurementPlot
.
MeasurementPlot
(
legend_loc
=
'
upper left
'
,
\
self
.
meas
plot_obj
=
MeasurementPlot
.
MeasurementPlot
(
legend_loc
=
'
upper left
'
,
\
legend_bbox_to_anchor
=
(
1.09
,
1
))
# set parameter figure of class to object parameter figure
self
.
fig
=
self
.
post
plot_obj
.
fig
self
.
fig
=
self
.
meas
plot_obj
.
fig
# read csv-file and import data to data frame
def
import_csv
(
self
,
csv_file
):
...
...
@@ -47,7 +48,7 @@ class PostPlot:
data_frame
.
reset_index
(
inplace
=
True
,
drop
=
True
)
# set y-Achlabel in all subplots to Time an in square brackets the selected time unit
for
element
in
self
.
post
plot_obj
.
ax1
:
for
element
in
self
.
meas
plot_obj
.
ax1
:
element
.
set_xlabel
(
"
Time [%s]
"
%
time_unit
)
# make a copy of data_frame in parameterlist without changing original during modification
...
...
@@ -66,7 +67,7 @@ class PostPlot:
postplot_data_frame
.
update
(
time_vals
)
# refresh subflots with data in data frame
self
.
post
plot_obj
.
draw
(
postplot_data_frame
,
pdf_name
=
''
)
self
.
meas
plot_obj
.
draw
(
postplot_data_frame
,
pdf_name
=
''
)
# cal PK2PK values of magnitude and phase
PK2PK
=
self
.
calc_mag_phase_pkpk_values
(
data_frame
)
...
...
@@ -77,11 +78,13 @@ class PostPlot:
def
edit_annotation_in_plot
(
self
,
annotate_string
=
''
,
anno_fontsize
=
16
):
self
.
fig
# update text of annotation in first subplot
self
.
post
plot_obj
.
annotation
.
set_text
(
annotate_string
)
self
.
meas
plot_obj
.
annotation
.
set_text
(
annotate_string
)
# edit annotation fontsize in first subplot
self
.
post
plot_obj
.
annotation
.
set_fontsize
(
anno_fontsize
)
self
.
meas
plot_obj
.
annotation
.
set_fontsize
(
anno_fontsize
)
def
calc_mag_phase_pkpk_values
(
self
,
data_frame
):
...
...
@@ -128,7 +131,7 @@ if __name__ == '__main__':
# set result path for post plot
Results_Path
=
r
'
C:\Users\pawelzik\Desktop\Results\
THRU_27
032023Copy
'
Results_Path
=
r
'
C:\Users\pawelzik\Desktop\Results\
JBY240_14
032023Copy
'
# set time unit for post post plot
...
...
@@ -142,10 +145,20 @@ if __name__ == '__main__':
# search all csv files in results folder
csv_file_list
=
list
(
Path
(
Results_Path
).
glob
(
"
**/*.csv
"
))
# choose annotation option
plot_correlation_coeff
=
False
plot_regression_coeff
=
False
# activate plot curvefitting
plot_trace_curvefit
=
False
# create postplot object, Michael
plot_obj
=
PostPlot
()
fit_corr_obj
=
curvefit_and_correlation
.
reg_and_corr
(
plot_obj
)
# empty data frame for concat the data frames from csv import to plot full transistion
concat_data_frame
=
pd
.
DataFrame
()
...
...
@@ -161,9 +174,36 @@ if __name__ == '__main__':
# concate datesframe for plotting full transistion data
concat_data_frame
=
pd
.
concat
([
concat_data_frame
,
data_frame
],
ignore_index
=
True
,
sort
=
False
)
# plot frame data
plot_obj
.
plot_frame_data
(
data_frame
,
title
,
time_unit
)
if
plot_correlation_coeff
==
True
:
# determine correlation coefficient between func 1 and func 2
corr_coeff
=
fit_corr_obj
.
calc_correlation
(
func_1
=
data_frame
.
S21_PHASE
,
\
func_2
=
data_frame
.
TEMP_DUT
)
# plot correlation coefficient
plot_obj
.
edit_annotation_in_plot
(
annotate_string
=
corr_coeff
)
elif
plot_regression_coeff
==
True
:
# start curvefit and determine coefficients best fit function
reg_coeff
=
fit_corr_obj
.
calc_regression_coeff_phase_S21
(
data_frame
,
time_unit
=
'
min
'
)
# plot regression coefficients
plot_obj
.
edit_annotation_in_plot
(
annotate_string
=
reg_coeff
)
plot_obj
.
edit_annotation_in_plot
(
annotate_string
=
reg_coeff
)
if
plot_trace_curvefit
==
True
:
fit_corr_obj
.
plot_phase_curve_fit
(
data_frame
=
data_frame
,
\
postplot_obj
=
plot_obj
.
measplot_obj
,
\
time_unit
=
time_unit
,
state
=
True
)
# set filename of post plot, Michael
filename
=
str
(
csv_file
.
stem
)
+
'
.pdf
'
...
...
@@ -175,6 +215,9 @@ if __name__ == '__main__':
# title of this plot will be always full transistion, Michel
plot_obj
.
plot_frame_data
(
concat_data_frame
,
'
Full Transistion
'
,
time_unit
)
fit_corr_obj
.
plot_phase_curve_fit
(
data_frame
=
concat_data_frame
,
\
postplot_obj
=
plot_obj
.
measplot_obj
,
\
time_unit
=
time_unit
,
state
=
False
)
# filename of plot that contains all steps of sweep is set to FullTransistion, Michael
filename
=
'
Full_Transistion
'
+
'
.pdf
'
...
...
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