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
...
@@ -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>]
edge_sdf.py <IP#> [--edge=<i>] [--sfd=<i>] [--del=<f>] [--bitwidth=<20>] [--timebase=<float>] [--meas=<i>]
Usage:
Usage:
edge_sdf.py
<IP#>
edge_sdf.py
IP#
edge_sdf.py
<IP#> [--bitwidth=<20>] [-
-timebase=<float>]
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=<i>] [-sfd=<i>] [-del=<f>] [-tol=50.0e-8] [-bitwidth=<20>] [-timebase=<float>] [
-meas=<i>]
edge_sdf.py -h | --help
edge_sdf.py -h | --help
IP IP number of the Oscilloscope
IP IP number of the instrument [default 192.168.32.248]
(for example: 192.168.32.248 which is its DevNet IP number)
Options:
Options:
-
h --help : Show this screen.
-
edge <int> expect_max_edge [default: 0]
--version : Show version.
scypi array sample number where the correlation maximum
-e,--edge=<i> : <int> expect_max_edge [default: 0]
is expected (may be a negative number)
scypi array sample number where the correlation maximum
-sfd <int> expect_max_sfd [default: 0]
is expected (may be a negative number)
scypi array sample number where the correlation maximum
-s,--sfd=<i> : <int> expect_max_sfd [default: 0]
is expected (may be a negative number)
scypi array sample number where the correlation maximum
-delay <float> estimated_delay [default: 0]
is expected (may be a negative number)
-tol <float> tolerance [default: 10.0e-9] specifies how far the
-d,--del=<f> : <float> estimated_delay [default: 0]
measured delay may be off target. Tolerance helps you to
-t,--tol=<sec> : <float> tolerance [default: 10.0e-9] specifies how far the
skip outliers in your measurements.
measured delay may be off target. Tolerance helps you to
-bitwidth <int> bit width [default: 20] timestamp pulse width in number
skip outliers in your measurements.
of serial bits (usual 20 = 16 ns for 62.5 MHz sysclk and
-b,--bitwidth=<i> : <int> bit width [default: 20] timestamp pulse width in number
10 = 8 ns for 125MHz sysclk)
of serial bits (usual 20 = 16 ns for 62.5 MHz sysclk and
-timebase <float> time base [default: 50.0e-8] # 50 ns/div
10 = 8 ns for 125MHz sysclk)
-m <int> number of measurements to be taken [default: 1]
-
-timebase=<sec> : <float> time base [default: 50.0e-8] # 50 ns/div
-
h --help Show help
-m,--meas=<i> : <int> number of measurements to be taken [default: 1]
"""
"""
import
os
import
os
...
@@ -79,7 +78,6 @@ lib_path = os.path.join(lib_path,"..")
...
@@ -79,7 +78,6 @@ lib_path = os.path.join(lib_path,"..")
sys
.
path
.
insert
(
0
,
lib_path
)
sys
.
path
.
insert
(
0
,
lib_path
)
# private imports:
# private imports:
from
lib.docopt
import
docopt
import
lib.LeCroy8254
as
DSO
import
lib.LeCroy8254
as
DSO
#import lib.Keysight_DSO_S_254A as DSO
#import lib.Keysight_DSO_S_254A as DSO
#import lib.Agilent_DSO6104A as DSO
#import lib.Agilent_DSO6104A as DSO
...
@@ -127,7 +125,7 @@ def correlate_mathematical_eth_sfd():
...
@@ -127,7 +125,7 @@ def correlate_mathematical_eth_sfd():
scope -- instance of python-vxi connected to scope625Zi oscilloscope
scope -- instance of python-vxi connected to scope625Zi oscilloscope
num_meas -- nuber of measurement to be taken.
num_meas -- nuber of measurement to be taken.
expect_max_edge -- edge correlation result sample number maximum is expected
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
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_
...
@@ -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.
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)
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_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
estimate -- a delay estimate, used to verify proper measurements and enable
to skip outliers (due to wrong automatic correlation maximum
to skip outliers (due to wrong automatic correlation maximum
determination)
determination)
...
@@ -256,52 +254,67 @@ def average_edge_to_sfd(scope, num_meas, bit_width, expect_max_edge, expect_max_
...
@@ -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
## 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__"
:
if
__name__
==
"__main__"
:
arguments
=
docopt
(
__doc__
,
version
=
'Edge to SFD delay 1.1'
)
import
argparse
parser
=
argparse
.
ArgumentParser
()
# defaults:
parser
.
add_argument
(
"IP"
,
help
=
"IP number of the instrument"
,
default
=
"192.168.32.248"
)
DEFAULT_TOL
=
1.0e+9
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
)
expect_max_edge
=
0
parser
.
add_argument
(
"-delay"
,
help
=
"estimated delay"
,
default
=
0
)
expect_max_sfd
=
0
parser
.
add_argument
(
"-tol"
,
help
=
"outliers tolerance"
,
default
=
10.0e-9
)
estimated_delay
=
0.0
parser
.
add_argument
(
"-bitwidth"
,
help
=
"abscal_txts pulse width"
,
default
=
20
)
tolerance
=
DEFAULT_TOL
parser
.
add_argument
(
"-timebase"
,
help
=
"DSO timbase"
,
default
=
50.0e-9
)
bit_width
=
20
parser
.
add_argument
(
"-m"
,
help
=
"number of measurements"
,
default
=
1
)
time_base
=
50.0e-9
# 50 ns/div
args
=
parser
.
parse_args
()
num_meas
=
1
IP
=
args
.
IP
if
len
(
sys
.
argv
)
<
10
:
expect_max_edge
=
int
(
args
.
edge
)
for
i
in
range
(
1
,
len
(
sys
.
argv
)):
expect_max_sfd
=
int
(
args
.
sfd
)
option
=
sys
.
argv
[
i
]
.
split
(
'='
)
estimated_delay
=
float
(
args
.
delay
)
if
option
[
0
]
==
'-e'
or
option
[
0
]
==
'--edge'
:
tolerance
=
float
(
args
.
tol
)
expect_max_edge
=
int
(
option
[
1
])
bit_width
=
int
(
args
.
bitwidth
)
if
option
[
0
]
==
'-s'
or
option
[
0
]
==
'--sfd'
:
time_base
=
float
(
args
.
timebase
)
expect_max_sfd
=
int
(
option
[
1
])
num_meas
=
int
(
args
.
m
)
if
option
[
0
]
==
'-d'
or
option
[
0
]
==
'--del'
:
estimated_delay
=
float
(
option
[
1
])
print
(
"expected sample number for edge peak: "
,
expect_max_edge
)
# when delay is given... Then new default tolerance = 10 ns
print
(
"expected sample number for SDF peak: "
,
expect_max_sfd
)
# unless otherwise specified
print
(
"estimated delay: "
,
estimated_delay
)
if
tolerance
==
DEFAULT_TOL
:
print
(
"outlier tolerance: "
,
tolerance
)
tolerance
=
10.0e-9
print
(
"abscal_txts pulse width: "
,
bit_width
)
if
option
[
0
]
==
'-t'
or
option
[
0
]
==
'--tol'
:
print
(
"DSO timbase: "
,
time_base
)
tolerance
=
float
(
option
[
1
])
print
(
"number of measurements: "
,
num_meas
)
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
()
scope
=
vxi11
.
Instrument
(
sys
.
argv
[
1
])
scope
=
vxi11
.
Instrument
(
sys
.
argv
[
1
])
#scope = vxi11.Instrument("192.168.32.245")
# Initialize oscilloscope
# Initialize oscilloscope
# Use Channel 1 pulse input
# 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