Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr-calibration
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
wr-calibration
Commits
29db66a2
Commit
29db66a2
authored
Feb 08, 2019
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
osc_init fucnction no longer general => init dictonairy can now be forwarded
parent
e829aa20
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
155 additions
and
74 deletions
+155
-74
edge_edge.py
sw/abscal_scripts/edge_edge.py
+12
-1
edge_sfd.py
sw/abscal_scripts/edge_sfd.py
+11
-1
pps_diff.py
sw/insitu_alpha/pps_diff.py
+11
-1
Keysight_DSO_S_254A.py
sw/lib/Keysight_DSO_S_254A.py
+63
-32
LeCroy8254.py
sw/lib/LeCroy8254.py
+58
-39
No files found.
sw/abscal_scripts/edge_edge.py
View file @
29db66a2
...
...
@@ -195,7 +195,18 @@ if __name__ == "__main__":
# Initialize oscilloscope
# Use Channel 1 pulse input
# use Channel 3-4 Ethernet Frame input
DSO
.
osc_init
(
scope
,
args
.
timebase
)
init
=
{
\
'channel'
:
[
1
,
0
,
1
,
1
],
\
'offset'
:
[
0.0
,
0.0
,
0.0
,
0.0
],
\
'volt_div'
:
[
0.1
,
1.0
,
0.25
,
0.25
],
\
'50ohm'
:
[
1
,
0
,
1
,
1
],
\
'trig'
:
[
1
],
\
'trig_level'
:
[
0.15
],
\
'timebase'
:
[
float
(
args
.
timebase
)
],
\
'refclk'
:
[
'ext'
],
\
}
DSO
.
osc_init
(
scope
,
init
)
meas
,
samples
,
sample_period
,
first_filename
,
last_filename
=
average_edge_to_edge
(
scope
,
num_meas
=
args
.
m
,
expect_max
=
args
.
peak
,
estimate
=
args
.
delay
,
tolerance
=
args
.
tol
)
...
...
sw/abscal_scripts/edge_sfd.py
View file @
29db66a2
...
...
@@ -313,7 +313,17 @@ if __name__ == "__main__":
# Initialize oscilloscope
# Use Channel 1 pulse input
# use Channel 3-4 Ethernet Frame input
DSO
.
osc_init
(
scope
,
args
.
timebase
)
init
=
{
\
'channel'
:
[
1
,
0
,
1
,
1
],
\
'offset'
:
[
0.0
,
0.0
,
0.0
,
0.0
],
\
'volt_div'
:
[
0.25
,
1.0
,
0.1
,
0.1
],
\
'50ohm'
:
[
1
,
0
,
1
,
1
],
\
'trig'
:
[
1
],
\
'trig_level'
:
[
0.15
],
\
'timebase'
:
[
float
(
args
.
timebase
)
],
\
'refclk'
:
[
'ext'
],
\
}
DSO
.
osc_init
(
scope
,
init
)
edge_to_sfd
,
samples
,
sample_period
,
first_filename
,
last_filename
=
average_edge_to_sfd
(
scope
,
num_meas
=
args
.
m
,
bit_width
=
args
.
bitwidth
,
expect_max_edge
=
args
.
edge
,
expect_max_sfd
=
args
.
sfd
,
estimate
=
args
.
delay
,
tolerance
=
args
.
tol
)
print
(
"Samples:"
,
samples
)
...
...
sw/insitu_alpha/pps_diff.py
View file @
29db66a2
...
...
@@ -584,7 +584,17 @@ if __name__ == "__main__":
restarts
=
int
(
args
.
r
)
# number of link restarts over which the delta_delay is averaged
#scope = vxi11.Instrument(args.dso)
#osc_init(scope, time_base = 1.0e-9)
#init = { \
# 'channel' : [ 0 , 0 , 1 , 1 ], \
# 'offset' : [ 0.0 , 0.0, -1.5 , -1.5 ], \
# 'volt_div' : [ 0.25, 1.0, 0.5 , 0.5 ], \
# '50ohm' : [ 0 , 0 , 1 , 1 ], \
# 'trig' : [ 3 ], \
# 'trig_level' : [ 0.14 ], \
# 'timebase' : [ 1.0e-9 ], \
# 'refclk' : [ 'ext' ], \
#}
#DSO.osc_init(scope, init)
# Initialize Time Interval Counter (1-2)
# Use Channel 1 PPS SPEC-1 (50 Ohm, Level 1.4)
...
...
sw/lib/Keysight_DSO_S_254A.py
View file @
29db66a2
...
...
@@ -517,56 +517,87 @@ def file_to_waveform(filename):
return
waveform_data
############################################################################
def
osc_init
(
scope
,
time_base
=
50.0e-9
):
def
osc_init
(
scope
,
init
):
"""
Initialize the
Oscilloscope for the timestamp edge to SFD measurement.
Initialize the
KEYSIGHT TECHNOLOGIES,DSO
scope -- instance of python-vxi connected to the oscilloscope
time_base -- <float> time base, default 50 ns/div
init -- <dict> for example:
init = {
\
'channel' : [ 1 , 0 , 1 , 0 ],
\
'offset' : [ 0.0, 0.0, 0.0 , 0.0 ],
\
'volt_div' : [ 0.5, 1.0, 0.125, 1.0 ],
\
'50ohm' : [ 1 , 0 , 1 , 0 ],
\
#'sinxx' : [ 0 , 0 , 0 , 0 ],
\
'trig' : [ 1 ],
\
'trig_level' : [ 0.14 ],
\
'timebase' : [ 50e-9 ],
\
'refclk' : [ 'ext' ],
\
"""
#scope = vxi11.Instrument("192.168.32.248")
print
(
scope
.
ask
(
"*IDN?"
))
# Returns 'KEYSIGHT TECHNOLOGIES,DSOS254A,MY55160101,05.50.0004'
# Use Channel 1 pulse input
# use Channel 3 Ethernet Frame input
# A fixed trigger level is important for proper timing measurement
# Choose 1.4 Volt for a direct signal but 0.8 Volt when the signal
# is split by a power splitter
scope
.
write
(
":TRIGger:EDGE:SOURce CHANnel1"
)
# Initialize the oscilloscope trigger
scope
.
write
(
":TRIGger:SWEep TRIGgered"
)
trig
=
str
(
init
[
'trig'
][
0
])
triglevel
=
str
(
float
(
init
[
'trig_level'
][
0
]))
scope
.
write
(
":TRIGger:EDGE:SOURce CHANnel"
+
trig
)
scope
.
write
(
":TRIGger:LEVel CHANnel"
+
trig
+
", "
+
triglevel
)
use_power_splitter
=
True
if
use_power_splitter
:
scope
.
write
(
":TRIGger:LEVel CHANnel1, 0.15"
)
scope
.
write
(
":CHANnel1:RANGe 2.0"
)
# 250 mV/div
else
:
scope
.
write
(
":TRIGger:LEVel CHANnel1, 0.3"
)
scope
.
write
(
":CHANnel1:RANGe 4.0"
)
# 500 mV/div
scope
.
write
(
":CHANnel1:INPut DCFifty"
)
scope
.
write
(
":CHANnel1:OFFSet 0.0"
)
"""
# For Keysight sinxx interpolation is a "Horizontal" setting that
# applies to all enabled channels! Default = False
sinxx = False
"""
scope
.
write
(
":CHANnel3:INPut DCFifty"
)
scope
.
write
(
":CHANnel3:OFFSet 0.0"
)
scope
.
write
(
":CHANnel3:RANGe 2.0"
)
# 250 mV/div
scope
.
write
(
":CHANnel4:INPut DCFifty"
)
scope
.
write
(
":CHANnel4:OFFSet 0.0"
)
scope
.
write
(
":CHANnel4:RANGe 2.0"
)
# 250 mV/div
for
ch
in
range
(
4
):
# Set channel ON/OFF
if
init
[
'channel'
][
ch
]
==
1
:
scope
.
write
(
":CHANnel"
+
str
(
ch
+
1
)
+
":DISPlay ON"
)
else
:
scope
.
write
(
":CHANnel"
+
str
(
ch
+
1
)
+
":DISPlay OFF"
)
# Set channel Offset
scope
.
write
(
":CHANnel"
+
str
(
ch
+
1
)
+
":OFFSet "
+
str
(
float
(
init
[
'offset'
][
ch
])))
# Set channel Volt/Div
volt_div
=
float
(
init
[
'volt_div'
][
ch
]
/
0.125
)
# Volt/Div is per 125 mV
scope
.
write
(
":CHANnel"
+
str
(
ch
+
1
)
+
":RANGe "
+
str
(
volt_div
))
# Set channel Coupling
#'50ohm' : [ 1 , 0 , 1 , 0 ], \
if
init
[
'50ohm'
][
ch
]
==
1
:
scope
.
write
(
":CHANnel"
+
str
(
ch
+
1
)
+
":INPut DCFifty"
)
else
:
scope
.
write
(
":CHANnel"
+
str
(
ch
+
1
)
+
":INPut DC"
)
"""
# Set Interpolation for all used channels to "16 point Sin(x)/x"
#'sinxx' : [ 1 , 0 , 1 , 0 ],
\
# Check if one of the channels is set to sinxx then enable sinxx for all
if init['sinxx'][ch] == 1:
sinxx = True
if sinxx:
scope.write(":ACQuire:INTerpolate INT16")
else:
scope.write(":ACQuire:INTerpolate OFF")
"""
# Trigger in the centre of the screen; important for maximum estimations
# forwarded to function average_edge_to_sfd
# Trigger in the centre of the screen and set timebase
scope
.
write
(
":TIMebase:DELay 0"
)
scope
.
write
(
":TIMebase:RANGe "
+
str
(
10
*
time_base
))
# set 50 ns/div
scope
.
write
(
":TIMebase:REFClock ON"
)
# set external refrence clock
scope
.
write
(
":TIMebase:RANGe "
+
str
(
10
*
float
(
init
[
'timebase'
][
0
])))
# set 50 ns/div
return
# Set internal/external 10 MHz timebase
if
init
[
'refclk'
][
0
]
==
'ext'
:
scope
.
write
(
":TIMebase:REFClock ON"
)
else
:
scope
.
write
(
":TIMebase:REFClock OFF"
)
return
############################################################################
##
## If run from commandline, we can test the library
...
...
sw/lib/LeCroy8254.py
View file @
29db66a2
...
...
@@ -705,55 +705,74 @@ def file_to_waveform(filename):
return
waveform_data
############################################################################
def
osc_init
(
scope
,
time_base
=
50.0e-9
):
def
osc_init
(
scope
,
init
):
"""
Initialize the
Oscilloscope for the timestamp edge to SFD measurement.
Initialize the
LeCroy,DSO
scope -- instance of python-vxi connected to the oscilloscope
time_base -- <float> time base, default 50 ns/div
init -- <dict> for example:
init = {
\
'channel' : [ 1 , 0 , 1 , 0 ],
\
'offset' : [ 0.0, 0.0, 0.0 , 0.0 ],
\
'volt_div' : [ 0.5, 1.0, 0.125, 1.0 ],
\
'50ohm' : [ 1 , 0 , 1 , 0 ],
\
#'sinxx' : [ 0 , 0 , 0 , 0 ],
\
'trig' : [ 1 ],
\
'trig_level' : [ 0.14 ],
\
'timebase' : [ 50e-9 ],
\
'refclk' : [ 'ext' ],
\
"""
#scope = vxi11.Instrument("192.168.32.24
3
")
#scope = vxi11.Instrument("192.168.32.24
8
")
print
(
scope
.
ask
(
"*IDN?"
))
# Returns '*IDN LECROY,HDO4034-MS,LCRY-HDO,7.9.0'
# Use Channel 1 pulse input
# use Channel 3 Ethernet Frame input
# A fixed trigger level is important for proper timing measurement
# MiniCircuits Splitters ZFRSC-123+ have ~ 6 + 3,75 dB attenuation (~ factor 3).
# A 2,4 V signal split once results in 0,8 V, slit twice in 260 mV.
scope
.
write
(
"TRIG_SELECT EDGE,SR,C1"
)
use_power_splitter
=
True
if
use_power_splitter
:
scope
.
write
(
"C1:TRIG_LEVEL 0.15"
)
scope
.
write
(
"C1:Volt_DIV 0.25"
)
else
:
scope
.
write
(
"C1:TRIG_LEVEL 0.3"
)
scope
.
write
(
"C1:Volt_DIV 0.5"
)
scope
.
write
(
"C1:COUPLING D50"
)
scope
.
write
(
"C1:OFFSET 0.0"
)
scope
.
write
(
"VBS 'app.Acquisition.C1.InterpolateType =
\"
sinxx
\"
'"
)
scope
.
write
(
"C3:COUPLING D50"
)
scope
.
write
(
"C3:OFFSET 0.0"
)
scope
.
write
(
"C3:Volt_DIV 0.25"
)
scope
.
write
(
"VBS 'app.Acquisition.C3.InterpolateType =
\"
sinxx
\"
'"
)
scope
.
write
(
"C4:COUPLING D50"
)
scope
.
write
(
"C4:OFFSET 0.0"
)
scope
.
write
(
"C4:Volt_DIV 0.25"
)
scope
.
write
(
"VBS 'app.Acquisition.C4.InterpolateType =
\"
sinxx
\"
'"
)
# Returns 'LECROY,WAVERUNNER8254M-MS,LCRY4253N20398,8.4.1'
# Initialize the oscilloscope trigger
trig
=
str
(
init
[
'trig'
][
0
])
triglevel
=
str
(
float
(
init
[
'trig_level'
][
0
]))
scope
.
write
(
"TRIG_SELECT EDGE,SR,C"
+
trig
)
scope
.
write
(
"C"
+
trig
+
":TRIG_LEVEL "
+
triglevel
)
for
ch
in
range
(
4
):
# Set channel ON/OFF
if
init
[
'channel'
][
ch
]
==
1
:
scope
.
write
(
"C"
+
str
(
ch
+
1
)
+
":TRACE ON"
)
else
:
scope
.
write
(
"C"
+
str
(
ch
+
1
)
+
":TRACE OFF"
)
# Set channel Offset
scope
.
write
(
"C"
+
str
(
ch
+
1
)
+
":OFFSET "
+
str
(
float
(
init
[
'offset'
][
ch
])))
# Set channel Volt/Div
volt_div
=
float
(
init
[
'volt_div'
][
ch
])
scope
.
write
(
"C"
+
str
(
ch
+
1
)
+
":Volt_DIV "
+
str
(
volt_div
))
# Set channel Coupling
#'50ohm' : [ 1 , 0 , 1 , 0 ], \
if
init
[
'50ohm'
][
ch
]
==
1
:
scope
.
write
(
"C"
+
str
(
ch
+
1
)
+
":COUPLING D50"
)
else
:
scope
.
write
(
"C"
+
str
(
ch
+
1
)
+
":COUPLING D1M"
)
"""
# Set Interpolation for all used channels to "Compatible Mode 10"
#'sinxx' : [ 1 , 0 , 1 , 0 ],
\
if init['sinxx'][ch] == 1:
scope.write("VBS 'app.Acquisition.C" + str(ch+1) + ".InterpolateType =
\"
sinxx
\"
'")
else:
scope.write("VBS 'app.Acquisition.C" + str(ch+1) + ".InterpolateType =
\"
linear
\"
'")
"""
# Trigger in the centre of the screen; important for maximum estimations
# forwarded to function average_edge_to_sfd
# Trigger in the centre of the screen and set timebase
scope
.
write
(
"TRIG_DELAY 0 ns"
)
scope
.
write
(
"TIME_DIV "
+
str
(
time_base
))
# set 50 ns/div
scope
.
write
(
"REFERENCE_CLOCK EXTERNAL"
)
# set external refrence clock
scope
.
write
(
"TIME_DIV "
+
str
(
float
(
init
[
'timebase'
][
0
])))
# Set internal/external 10 MHz timebase
if
init
[
'refclk'
][
0
]
==
'ext'
:
scope
.
write
(
"REFERENCE_CLOCK EXTERNAL"
)
else
:
scope
.
write
(
"REFERENCE_CLOCK INTERNAL"
)
return
...
...
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