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
5c4f3465
Commit
5c4f3465
authored
2 years ago
by
Sai Lakhan Ekal
Browse files
Options
Downloads
Patches
Plain Diff
Add some comments for functions
Ploting window is now in PDF format not in png format
parent
d3b5cec7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Python_script/prototype.py
+19
-10
19 additions, 10 deletions
Python_script/prototype.py
with
19 additions
and
10 deletions
Python_script/prototype.py
+
19
−
10
View file @
5c4f3465
...
...
@@ -12,6 +12,7 @@ import VNA
import
virtual_time
import
json
TEMPERATURE_STABLE
=
0x1
HUMIDITY_STABLE
=
0x2
MAGNITUDE_STABLE
=
0x4
...
...
@@ -19,6 +20,7 @@ PHASE_STABLE = 0x8
MEASUREMENT_STABLE
=
0x10
# Class has only attributes which we are using in the read_data_function to read data from VNA and Chamber
class
MeasurementData
:
def
__init__
(
self
,
timestamp
,
temp
,
hum
,
power
,
frequency
,
s11
,
s21
,
s12
,
s22
):
self
.
timestamp
=
timestamp
...
...
@@ -66,6 +68,7 @@ class Measurements:
'
READBACK_HUMIDITY
'
,
'
RF_POWER
'
,
'
RF_FREQUENCY
'
,
'
DUT_IDENTIFIER
'
,
'
RUN_ID
'
,
'
EQUILIBRIUM_INDICATOR
'
,
'
S11_MAGNITUDE
'
,
'
S11_PHASE
'
,
'
S12_MAGNITUDE
'
,
'
S12_PHASE
'
,
'
S21_MAGNITUDE
'
,
'
S21_PHASE
'
,
'
S22_MAGNITUDE
'
,
'
S22_PHASE
'
]
# csv.dict writer add adda row wise
writer
=
csv
.
DictWriter
(
csv_file
,
fieldnames
=
fieldnames
)
writer
.
writeheader
()
...
...
@@ -144,6 +147,7 @@ class Measurements:
self
.
clock
.
sleep
(
self
.
sleep_time
)
# perform the configured number of measurements and check that they are really stable
# It started running after everything become stable
supposedly_stable_measurements
=
[]
all_measurements_stable
=
True
for
i
in
range
(
0
,
next_reads
):
...
...
@@ -173,10 +177,7 @@ class Measurements:
else
:
equi
=
measurement_equi
self
.
write_data
(
writer
,
next_temp
,
next_hum
,
d
,
equi
)
parser1
=
ArgumentParser
()
parser1
.
add_argument
(
"
-p
"
,
"
--plot
"
,
help
=
"
graph plotting
"
,
metavar
=
"
ADDR
"
,
required
=
True
)
except
KeyboardInterrupt
:
pass
...
...
@@ -305,9 +306,7 @@ class Measurements:
labels
=
[
pc
.
get_label
()
for
pc
in
all_path_collections
]
ax1
[
1
].
legend
(
all_path_collections
,
labels
,
loc
=
'
lower right
'
)
fig
.
savefig
(
time
.
strftime
(
"
%Y_%m_%d-%H_%M_%S
"
)
+
'
graph.png
'
)
plt
.
close
(
fig
)
fig
.
savefig
(
time
.
strftime
(
"
%Y_%m_%d-%H_%M_%S
"
)
+
'
graph.pdf
'
)
plt
.
show
()
def
calculate_temperature_stability
(
self
,
target_temp
,
readback_temp
):
...
...
@@ -318,6 +317,7 @@ class Measurements:
return
(
target_hum
-
self
.
max_delta_hum
<=
float
(
readback_hum
))
and
\
(
float
(
readback_hum
)
<=
target_hum
+
self
.
max_delta_hum
)
if
__name__
==
'
__main__
'
:
parser
=
ArgumentParser
()
parser
.
add_argument
(
"
-c
"
,
"
--chamber
"
,
...
...
@@ -351,11 +351,20 @@ if __name__ == '__main__':
with
open
(
'
test_stand_parameter.json
'
,
'
r
'
)
as
f
:
config_data
=
json
.
load
(
f
)
#
FIXME:
Move this to inside the chamber. But just putting it into perform_measurements is not good at the moment.
# Move this to inside the chamber. But just putting it into perform_measurements is not good at the moment.
# That function needs refactoring first.
mes
=
Measurements
(
args
.
chamber
,
args
.
vna
,
args
.
file
,
output
,
args
.
standby
,
config_data
)
try
:
mes
=
Measurements
(
args
.
chamber
,
args
.
vna
,
args
.
file
,
output
,
args
.
standby
,
config_data
)
mes
.
perform_measurements
()
plot_graph
=
input
(
'
want to plot a graph? ans[Yes/no]?
'
).
lower
()
if
plot_graph
==
"
yes
"
:
mes
.
plot_output
(
output
)
else
:
print
(
"
graph is stored with output file
"
)
finally
:
mes
.
chamber
.
close
()
mes
.
plot_output
(
output
)
# mes.plot_output(output)
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