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
9be6770c
Commit
9be6770c
authored
Jul 25, 2018
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get rid of docopt
parent
1555c55c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
67 deletions
+80
-67
edge_sfd.py
sw/ab_cal_scripts/edge_sfd.py
+80
-67
No files found.
sw/ab_cal_scripts/edge_sfd.py
View file @
9be6770c
...
...
@@ -38,32 +38,31 @@ Now a number of measurments (-m,--meas) can be taken to gather statistics
edge_sdf.py <IP#> [--edge=<i>] [--sfd=<i>] [--del=<f>] [--bitwidth=<20>] [--timebase=<float>] [--meas=<i>]
Usage:
edge_sdf.py
<IP#>
edge_sdf.py
<IP#> [--bitwidth=<20>] [-
-timebase=<float>]
edge_sdf.py
<IP#> [--edge=<i>] [--sfd=<i>] [--del=<f>] [--tol=50.0e-8] [--bitwidth=<20>] [--timebase=<float>] [-
-meas=<i>]
edge_sdf.py
IP#
edge_sdf.py
IP# [-bitwidth=<20>] [
-timebase=<float>]
edge_sdf.py
IP# [-edge=<i>] [-sfd=<i>] [-del=<f>] [-tol=50.0e-8] [-bitwidth=<20>] [-timebase=<float>] [
-meas=<i>]
edge_sdf.py -h | --help
IP IP number of the Oscilloscope
(for example: 192.168.32.248 which is its DevNet IP number)
IP IP number of the instrument [default 192.168.32.248]
Options:
-
h --help : Show this screen.
--version : Show version.
-e,--edge=<i> : <int> expect_max_edge [default: 0]
scypi array sample number where the correlation maximum
is expected (may be a negative number)
-s,--sfd=<i> : <int> expect_max_sfd [default: 0]
scypi array sample number where the correlation maximum
is expected (may be a negative number)
-d,--del=<f> : <float> estimated_delay [default: 0]
-t,--tol=<sec> : <float> tolerance [default: 10.0e-9] specifies how far the
measured delay may be off target. Tolerance helps you to
skip outliers in your measurements.
-b,--bitwidth=<i> : <int> bit width [default: 20] timestamp pulse width in number
of serial bits (usual 20 = 16 ns for 62.5 MHz sysclk and
10 = 8 ns for 125MHz sysclk)
-
-timebase=<sec> : <float> time base [default: 50.0e-8] # 50 ns/div
-m,--meas=<i> : <int> number of measurements to be taken [default: 1]
-
edge <int> expect_max_edge [default: 0]
scypi array sample number where the correlation maximum
is expected (may be a negative number)
-sfd <int> expect_max_sfd [default: 0]
scypi array sample number where the correlation maximum
is expected (may be a negative number)
-delay <float> estimated_delay [default: 0]
-tol <float> tolerance [default: 10.0e-9] specifies how far the
measured delay may be off target. Tolerance helps you to
skip outliers in your measurements.
-bitwidth <int> bit width [default: 20] timestamp pulse width in number
of serial bits (usual 20 = 16 ns for 62.5 MHz sysclk and
10 = 8 ns for 125MHz sysclk)
-timebase <float> time base [default: 50.0e-8] # 50 ns/div
-m <int> number of measurements to be taken [default: 1]
-
h --help Show help
"""
import
os
...
...
@@ -79,7 +78,6 @@ lib_path = os.path.join(lib_path,"..")
sys
.
path
.
insert
(
0
,
lib_path
)
# private imports:
from
lib.docopt
import
docopt
import
lib.LeCroy8254
as
DSO
#import lib.Keysight_DSO_S_254A as DSO
#import lib.Agilent_DSO6104A as DSO
...
...
@@ -127,7 +125,7 @@ def correlate_mathematical_eth_sfd():
scope -- instance of python-vxi connected to scope625Zi oscilloscope
num_meas -- nuber of measurement to be taken.
expect_max_edge -- edge correlation result sample number maximum is expected
expect_max_s
df
-- edge correlation result sample number maximum is expected
expect_max_s
fd
-- edge correlation result sample number maximum is expected
returns: <type 'numpy.ndarray'> is an array of measured delay values
"""
...
...
@@ -168,7 +166,7 @@ def average_edge_to_sfd(scope, num_meas, bit_width, expect_max_edge, expect_max_
num_meas -- nuber of measurement to be taken.
bit_width -- the number of bits for a pulse (20 bits for 16 ns, 10 bits for 8 ns)
expect_max_edge -- edge correlation result sample number maximum is expected
expect_max_s
df
-- edge correlation result sample number maximum is expected
expect_max_s
fd
-- edge correlation result sample number maximum is expected
estimate -- a delay estimate, used to verify proper measurements and enable
to skip outliers (due to wrong automatic correlation maximum
determination)
...
...
@@ -256,52 +254,67 @@ def average_edge_to_sfd(scope, num_meas, bit_width, expect_max_edge, expect_max_
##
## If run from commandline, we can test the library
##
"""
Usage:
edge_sdf.py IP#
edge_sdf.py IP# [-bitwidth=<20>] [-timebase=<float>]
edge_sdf.py IP# [-edge=<i>] [-sfd=<i>] [-del=<f>] [-tol=50.0e-8] [-bitwidth=<20>] [-timebase=<float>] [-meas=<i>]
edge_sdf.py -h | --help
IP IP number of the instrument [default 192.168.32.248]
Options:
-edge <int> expect_max_edge [default: 0]
scypi array sample number where the correlation maximum
is expected (may be a negative number)
-sfd <int> expect_max_sfd [default: 0]
scypi array sample number where the correlation maximum
is expected (may be a negative number)
-delay <float> estimated_delay [default: 0]
-tol <float> tolerance [default: 10.0e-9] specifies how far the
measured delay may be off target. Tolerance helps you to
skip outliers in your measurements.
-bitwidth <int> bit width [default: 20] timestamp pulse width in number
of serial bits (usual 20 = 16 ns for 62.5 MHz sysclk and
10 = 8 ns for 125MHz sysclk)
-timebase <float> time base [default: 50.0e-8] # 50 ns/div
-m <int> number of measurements to be taken [default: 1]
-h --help Show help
"""
if
__name__
==
"__main__"
:
arguments
=
docopt
(
__doc__
,
version
=
'Edge to SFD delay 1.1'
)
# defaults:
DEFAULT_TOL
=
1.0e+9
expect_max_edge
=
0
expect_max_sfd
=
0
estimated_delay
=
0.0
tolerance
=
DEFAULT_TOL
bit_width
=
20
time_base
=
50.0e-9
# 50 ns/div
num_meas
=
1
if
len
(
sys
.
argv
)
<
10
:
for
i
in
range
(
1
,
len
(
sys
.
argv
)):
option
=
sys
.
argv
[
i
]
.
split
(
'='
)
if
option
[
0
]
==
'-e'
or
option
[
0
]
==
'--edge'
:
expect_max_edge
=
int
(
option
[
1
])
if
option
[
0
]
==
'-s'
or
option
[
0
]
==
'--sfd'
:
expect_max_sfd
=
int
(
option
[
1
])
if
option
[
0
]
==
'-d'
or
option
[
0
]
==
'--del'
:
estimated_delay
=
float
(
option
[
1
])
# when delay is given... Then new default tolerance = 10 ns
# unless otherwise specified
if
tolerance
==
DEFAULT_TOL
:
tolerance
=
10.0e-9
if
option
[
0
]
==
'-t'
or
option
[
0
]
==
'--tol'
:
tolerance
=
float
(
option
[
1
])
if
option
[
0
]
==
'--bitwidth'
:
bit_width
=
int
(
option
[
1
])
if
option
[
0
]
==
'--timebase'
:
time_base
=
float
(
option
[
1
])
if
option
[
0
]
==
'-m'
or
option
[
0
]
==
'--meas'
:
num_meas
=
int
(
option
[
1
])
# When oscilloscope triggers on Channel 1 and trigger is set to the middle
# of the screen then the expected edge maximum for edge and SFD are at:
else
:
print
(
"### wrong measurement type"
)
sys
.
exit
()
import
argparse
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"IP"
,
help
=
"IP number of the instrument"
,
default
=
"192.168.32.248"
)
parser
.
add_argument
(
"-edge"
,
help
=
"expected sample number for edge peak"
,
default
=
0
)
parser
.
add_argument
(
"-sfd"
,
help
=
"expected sample number for SFD peak"
,
default
=
0
)
parser
.
add_argument
(
"-delay"
,
help
=
"estimated delay"
,
default
=
0
)
parser
.
add_argument
(
"-tol"
,
help
=
"outliers tolerance"
,
default
=
10.0e-9
)
parser
.
add_argument
(
"-bitwidth"
,
help
=
"abscal_txts pulse width"
,
default
=
20
)
parser
.
add_argument
(
"-timebase"
,
help
=
"DSO timbase"
,
default
=
50.0e-9
)
parser
.
add_argument
(
"-m"
,
help
=
"number of measurements"
,
default
=
1
)
args
=
parser
.
parse_args
()
IP
=
args
.
IP
expect_max_edge
=
int
(
args
.
edge
)
expect_max_sfd
=
int
(
args
.
sfd
)
estimated_delay
=
float
(
args
.
delay
)
tolerance
=
float
(
args
.
tol
)
bit_width
=
int
(
args
.
bitwidth
)
time_base
=
float
(
args
.
timebase
)
num_meas
=
int
(
args
.
m
)
print
(
"expected sample number for edge peak: "
,
expect_max_edge
)
print
(
"expected sample number for SDF peak: "
,
expect_max_sfd
)
print
(
"estimated delay: "
,
estimated_delay
)
print
(
"outlier tolerance: "
,
tolerance
)
print
(
"abscal_txts pulse width: "
,
bit_width
)
print
(
"DSO timbase: "
,
time_base
)
print
(
"number of measurements: "
,
num_meas
)
scope
=
vxi11
.
Instrument
(
sys
.
argv
[
1
])
#scope = vxi11.Instrument("192.168.32.245")
# Initialize oscilloscope
# Use Channel 1 pulse input
...
...
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