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
633a7db6
Commit
633a7db6
authored
Aug 02, 2018
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed and get rid of GUI
parent
cb941b31
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
56 deletions
+56
-56
tic_wr.py
sw/abscal_scripts/tic_wr.py
+56
-56
No files found.
sw/abscal_scripts/tic_
gui
.py
→
sw/abscal_scripts/tic_
wr
.py
View file @
633a7db6
#!/usr/bin/python
"""
tic_
gui: Analyzes Time Interval Count Measurements and White Rabbit Absl
olute
Calibration GUI output
tic_
wr: Analyzes Time Interval Count Measurements and White Rabbit Abs
olute
Calibration GUI
/console
output
-------------------------------------------------------------------------------
Copyright (C) 2016 Peter Jansweijer
...
...
@@ -23,8 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
This script calculates the differences between:
- the time measured on the Time Interval Counter for PPS -> abscal_txts
- the time stamped by the WR device (t1/t4
) that was outputted on the WR GUI
while running the absolute calibration software.
- the time stamped by the WR device (t1/t4
p) that was outputted on the WR
GUI/console
while running the absolute calibration software.
Measurements should be taken while the WR device is in mode abscal
and locked to an external 10 MHz reference. Measurements are started
...
...
@@ -34,19 +34,19 @@ The same reference clock mentioned above should also have been used for the
Time Interval Counter measurement!
Usage:
tic_
gui.py <tic_file> <wrgui
_file>
tic_
gui.py <tic_file>
-type 'tic'
tic_
gui.py <wrgui_file>
-type 't1_4'
tic_
gui
.py -h | --help
tic_
wr.py <tic_file> <wr
_file>
tic_
wr.py <tic_file>
-type 'tic'
tic_
wr.py <wr_file>
-type 't1_4'
tic_
wr
.py -h | --help
Options:
<tic_file> <type 'str'> file name that contains the Time Interval Counter
measurements between PPS output and either abscal_txts ouput
<wr
gui_file> <type 'str'> name of file containing the WR GUI t1, t4p measur
ments
measurements between PPS output and either abscal_txts ou
t
put
<wr
_file> <type 'str'> name of file containing the WR GUI/console t1, t4p measure
ments
<-type> <type 'str'> either
"" -> (measured TIC for PPS->abscal_txts) - (WR
_GUI
t1) and
(measured TIC for PPS->abscal_txts) - (WR
_GUI
t4p)
"t1_4" -> (WR
_GUI t4) - (WR_GUI
t1)
"" -> (measured TIC for PPS->abscal_txts) - (WR t1) and
(measured TIC for PPS->abscal_txts) - (WR t4p)
"t1_4" -> (WR
t4p) - (WR
t1)
"tic" -> histogram just the time interval measurements
-h --help Show this screen.
"""
...
...
@@ -75,9 +75,9 @@ import lib.Keysight_53230A as tic
############################################################################
def
wr_abs_cal_
gui_
file_to_scipy_array
(
filename
):
def
wr_abs_cal_file_to_scipy_array
(
filename
):
"""
Retrieve the White Rabbit GUI info which is written during Absolute Calibration
Retrieve the White Rabbit GUI
/console
info which is written during Absolute Calibration
filename -- source file from which to retrieve data.
...
...
@@ -87,13 +87,13 @@ def wr_abs_cal_gui_file_to_scipy_array(filename):
data_file
=
open
(
filename
,
"r"
)
# header = data_file.read(5) # read the waveform_header "wrc# "
#if header != "wrc# ":
#print("Exception: wr_abs_cal_
gui_file_to_scipy_array: Not a WR Absolute Calibration GUI
file.")
#Exception("wr_abs_cal_
gui_file_to_scipy_array: Not a WR Absolute Calibration GUI
file.")
#print("Exception: wr_abs_cal_
file_to_scipy_array: Not a WR Absolute Calibration
file.")
#Exception("wr_abs_cal_
file_to_scipy_array: Not a WR Absolute Calibration
file.")
#data_file.close()
#return
# create an empty
gui_data dictionai
ry
gui
_data
=
{}
# create an empty
wr_data dictiona
ry
wr
_data
=
{}
# create an empty lists for t1 and t4 components
lst_t1_sec
=
[]
...
...
@@ -123,12 +123,12 @@ def wr_abs_cal_gui_file_to_scipy_array(filename):
t4_sec
=
scipy
.
array
(
lst_t4_sec
)
t4
=
scipy
.
array
(
lst_t4
)
gui
_data
[
"t1 seconds"
]
=
(
t1_sec
)
gui
_data
[
"t1"
]
=
(
t1
)
gui
_data
[
"t4 seconds"
]
=
(
t4_sec
)
gui
_data
[
"t4"
]
=
(
t4
)
wr
_data
[
"t1 seconds"
]
=
(
t1_sec
)
wr
_data
[
"t1"
]
=
(
t1
)
wr
_data
[
"t4 seconds"
]
=
(
t4_sec
)
wr
_data
[
"t4"
]
=
(
t4
)
return
gui
_data
return
wr
_data
############################################################################
...
...
@@ -171,19 +171,19 @@ def plot_hist(t_hist, hist_tic):
##
"""
Usage:
tic_
gui.py <tic_file> <wrgui
_file>
tic_
gui.py <tic_file>
-type 'tic'
tic_
gui.py <wrgui_file>
-type 't1_4'
tic_
gui
.py -h | --help
tic_
wr.py <tic_file> <wr
_file>
tic_
wr.py <tic_file>
-type 'tic'
tic_
wr.py <wr_file>
-type 't1_4'
tic_
wr
.py -h | --help
Options:
<tic_file> <type 'str'> file name that contains the Time Interval Counter
measurements between PPS output and either abscal_txts ouput
<wr
gui_file> <type 'str'> name of file containing the WR GUI t1, t4p measur
ments
measurements between PPS output and either abscal_txts ou
t
put
<wr
_file> <type 'str'> name of file containing the WR t1, t4p measure
ments
<-type> <type 'str'> either
"" -> (measured TIC for PPS->abscal_txts) - (WR
_GUI
t1) and
(measured TIC for PPS->abscal_txts) - (WR
_GUI
t4p)
"t1_4" -> (WR
_GUI t4) - (WR_GUI
t1)
"" -> (measured TIC for PPS->abscal_txts) - (WR t1) and
(measured TIC for PPS->abscal_txts) - (WR t4p)
"t1_4" -> (WR
t4p) - (WR
t1)
"tic" -> histogram just the time interval measurements
-h --help Show this screen.
"""
...
...
@@ -193,22 +193,22 @@ if __name__ == "__main__":
import
argparse
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-tic_file"
,
help
=
"file containing TIC measurements"
)
parser
.
add_argument
(
"-wr
gui_file"
,
help
=
"file containing WR GUI
measurements"
)
parser
.
add_argument
(
"-wr
_file"
,
help
=
"file containing WR GUI/console
measurements"
)
parser
.
add_argument
(
"-type"
,
help
=
"measurement type, either: 'tic' or 't1_4,"
,
default
=
''
)
args
=
parser
.
parse_args
()
tic_file
=
args
.
tic_file
wr_
gui_file
=
args
.
wrgui
_file
wr_
file
=
args
.
wr
_file
meas_type
=
args
.
type
if
tic_file
==
""
and
meas_type
==
"tic"
:
print
(
"### no TIC file specified!"
)
sys
.
exit
()
elif
wr_
gui_
file
==
""
and
meas_type
==
"t1_4"
:
print
(
"### no WR GUI file specified!"
)
elif
wr_file
==
""
and
meas_type
==
"t1_4"
:
print
(
"### no WR GUI
/console
file specified!"
)
sys
.
exit
()
elif
tic_file
==
""
and
wr_
gui_
file
==
""
:
print
(
"### Specify TIC and WR GUI file!"
)
elif
tic_file
==
""
and
wr_file
==
""
:
print
(
"### Specify TIC and WR GUI
/console
file!"
)
sys
.
exit
()
if
meas_type
==
"tic"
:
...
...
@@ -220,43 +220,43 @@ if __name__ == "__main__":
hist_tic
=
plt
.
figure
(
"Time Interval Counter skew"
)
plot_hist
(
t_hist
,
hist_tic
)
elif
meas_type
==
"t1_4"
:
print
(
"Using WR
GUI file: "
,
wr_gui
_file
)
gui_data
=
wr_abs_cal_gui_file_to_scipy_array
(
wr_gui
_file
)
print
(
"Using WR
file: "
,
wr
_file
)
wr_data
=
wr_abs_cal_file_to_scipy_array
(
wr
_file
)
print
(
"Histogram difference WR (t4p-t1)"
)
t_hist
=
gui_data
[
"t4"
]
-
gui
_data
[
"t1"
]
num
=
len
(
gui
_data
[
"t1"
])
print
(
"Delay between internal timestamp t1 and t4
(i.e. t4
-t1):"
)
hist_tic
=
plt
.
figure
(
"Histogram difference WR
GUI (t4
-t1)"
)
t_hist
=
wr_data
[
"t4"
]
-
wr
_data
[
"t1"
]
num
=
len
(
wr
_data
[
"t1"
])
print
(
"Delay between internal timestamp t1 and t4
p (i.e. t4p
-t1):"
)
hist_tic
=
plt
.
figure
(
"Histogram difference WR
(t4p
-t1)"
)
plot_hist
(
t_hist
,
hist_tic
)
else
:
print
(
"Using TIC file: "
,
tic_file
)
print
(
"Using WR
GUI file: "
,
wr_gui
_file
)
print
(
"Using WR
file: "
,
wr
_file
)
tic_data
=
tic
.
file_to_scipy_array
(
tic_file
)
gui_data
=
wr_abs_cal_gui_file_to_scipy_array
(
wr_gui
_file
)
wr_data
=
wr_abs_cal_file_to_scipy_array
(
wr
_file
)
num_tic
=
len
(
tic_data
[
0
])
# x-axis in [0]
num_
gui
=
len
(
gui
_data
[
"t1"
])
num
=
min
(
num_tic
,
num_
gui
)
num_
wr
=
len
(
wr
_data
[
"t1"
])
num
=
min
(
num_tic
,
num_
wr
)
print
(
"Measurements found in 53230A file:"
,
num_tic
,
"in WR
_GUI file:"
,
num_gui
)
print
(
"Measurements found in 53230A file:"
,
num_tic
,
"in WR
file:"
,
num_wr
)
print
(
"Measurements to take into account:"
,
num
)
print
(
"Delay between abscal_txts and internal timestamp t1 and t4p:"
)
fig
=
plt
.
figure
(
"Time Interval Counter and WR
GUI t1, t4p versus measur
ment number"
)
fig
=
plt
.
figure
(
"Time Interval Counter and WR
t1, t4p versus measure
ment number"
)
ax
=
fig
.
add_subplot
(
111
)
ax
.
set_xlabel
(
'measurement number'
)
ax
.
set_ylabel
(
'TIC, WR
GUI t1, WR GUI
t4p'
)
ax
.
set_ylabel
(
'TIC, WR
t1, WR
t4p'
)
x
=
tic_data
[
0
][:
num
]
lns1
=
ax
.
plot
(
x
,
gui_data
[
"t1"
][:
num
],
color
=
'red'
,
dashes
=
[
2
,
2
,
10
,
2
],
label
=
'WR GUI
t1'
)
lns2
=
ax
.
plot
(
x
,
gui_data
[
"t4"
][:
num
],
color
=
'red'
,
dashes
=
[
6
,
2
],
label
=
'WR GUI
t4p'
)
lns1
=
ax
.
plot
(
x
,
wr_data
[
"t1"
][:
num
],
color
=
'red'
,
dashes
=
[
2
,
2
,
10
,
2
],
label
=
'WR
t1'
)
lns2
=
ax
.
plot
(
x
,
wr_data
[
"t4"
][:
num
],
color
=
'red'
,
dashes
=
[
6
,
2
],
label
=
'WR
t4p'
)
lns3
=
ax
.
plot
(
x
,
tic_data
[
1
][:
num
],
color
=
'blue'
,
label
=
'TIC'
)
lns
=
lns1
+
lns2
+
lns3
labels
=
[
l
.
get_label
()
for
l
in
lns
]
ax
.
legend
(
lns
,
labels
,
loc
=
'lower right'
,
fontsize
=
'medium'
)
plt
.
subplots_adjust
(
left
=
0.17
)
plt
.
draw
()
t_hist_t1
=
tic_data
[
1
][:
num
]
-
gui
_data
[
"t1"
][:
num
]
t_hist_t1
=
tic_data
[
1
][:
num
]
-
wr
_data
[
"t1"
][:
num
]
hist_tic_t1
=
plt
.
figure
(
"Historam TICt1"
)
t_hist_t4p
=
tic_data
[
1
][:
num
]
-
gui
_data
[
"t4"
][:
num
]
t_hist_t4p
=
tic_data
[
1
][:
num
]
-
wr
_data
[
"t4"
][:
num
]
hist_tic_t4p
=
plt
.
figure
(
"Historam TICt4p"
)
plot_hist
(
t_hist_t1
,
hist_tic_t1
)
...
...
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