Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Calibration
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Calibration
Commits
4fe7dba8
Commit
4fe7dba8
authored
Sep 08, 2023
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add simple DMM temperature readout and plot
parent
0cf79c68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
113 additions
and
0 deletions
+113
-0
log_temp.py
sw/insitu_alpha/log_temp.py
+113
-0
No files found.
sw/insitu_alpha/log_temp.py
0 → 100644
View file @
4fe7dba8
#!/usr/bin/python
"""
log_temp.py: Logs the temperature and writes it to file
-------------------------------------------------------------------------------
Copyright (C) 2023 Peter Jansweijer
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
-------------------------------------------------------------------------------
Usage:
log_temp.py -name log_temp.out <IP>
log_temp.py -h | --help
Options:
-h --help Show this screen.
"""
import
os
import
sys
import
time
import
scipy
import
matplotlib.pyplot
as
plt
import
vxi11
import
pdb
###############################################
# Main
###############################################
"""
Usage:
pps_diff.py -name ddelay.out [-ms /dev/ttyUSB2] [-ss /dev/ttyUSB1] [-t <IP>] -tic <IP> [-o <dir>] [-a <number>] [-r <number>]
pps_diff.py -h | --help
Options:
-h --help Show this screen.
-ip IP address of Digital Multimeter reading PT100 and
"""
if
__name__
==
"__main__"
:
import
argparse
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-ip"
,
default
=
"10.0.0.237"
)
# DMM default IP
parser
.
add_argument
(
"-t"
,
help
=
"number of seconds between samples"
,
default
=
"1"
)
parser
.
add_argument
(
"-f"
,
help
=
"no measurements are taken, filename is plotted instead"
)
args
=
parser
.
parse_args
()
if
args
.
f
:
data_file
=
open
(
args
.
f
,
"r"
)
sample_lst
=
[]
line_lst
=
[]
while
1
:
line
=
data_file
.
readline
()
if
line
[:
len
(
"#"
)]
!=
"#"
:
# Skip lines that are commented out
line_lst
=
line
.
split
(
" "
)
if
len
(
line_lst
)
<
3
:
break
sample_lst
.
append
(
float
(
line_lst
[
2
]))
arr
=
scipy
.
array
(
sample_lst
)
data_file
.
close
()
temperature
=
plt
.
figure
(
"temperature:"
)
ax
=
temperature
.
add_subplot
(
111
)
ax
.
set_xlabel
(
'Sample'
)
ax
.
set_ylabel
(
'Temp'
)
ax
.
plot
(
arr
)
plt
.
show
()
else
:
# open and configure Digital Multimeter with attached PT100
dmm
=
vxi11
.
Instrument
(
args
.
ip
)
print
(
dmm
.
ask
(
"*IDN?"
))
# Returns 'Keysight Technologies,34465A,MY57501367,A.02.14-02.40-02.14-00.49-03-01'
# Configure for 4 wire temperature measurement
dmm
.
write
(
"SAMPle:COUNt 1"
)
dmm
.
write
(
"UNIT:TEMPerature C"
)
timestamp
=
time
.
localtime
()
filename
=
time
.
strftime
(
format
(
"
%
y
%
m
%
d_
%
H_
%
M_
%
S"
),
timestamp
)
data_file
=
open
(
filename
,
"w"
)
data_file
.
write
(
"# Logged Temperature
\n
"
)
# keep measureing until ^C
while
1
:
timestamp
=
time
.
localtime
()
temp
=
float
(
dmm
.
ask
(
"MEAS:TEMP? FRTD"
))
print
(
time
.
strftime
(
format
(
"
%
y
%
m
%
d
%
H:
%
M:
%
S "
)
+
str
(
temp
)))
data_file
.
write
(
time
.
strftime
(
format
(
"
%
y
%
m
%
d
%
H:
%
M:
%
S "
)
+
str
(
temp
)
+
"
\n
"
))
data_file
.
flush
()
time
.
sleep
(
int
(
args
.
t
))
data_file
.
close
()
sys
.
exit
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment