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
2bc0a747
Commit
2bc0a747
authored
Sep 21, 2018
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repaired various typo's in comment
parent
bb23a267
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
wr_serial.py
sw/insitu_alpha/wr_serial.py
+13
-13
No files found.
sw/insitu_alpha/wr_serial.py
View file @
2bc0a747
...
...
@@ -32,7 +32,7 @@ Options:
-ss slave serial port, default: "/dev/ttyUSB1"
-t track fiber spool temperature (using Digital Multimeter and PT100), default: False
-o <dir> optional directory for output file storage, default: "data/"
-m <number> number of measurement cycles (default = 1 cyle is a sweep from
-m <number> number of measurement cycles (default = 1 cy
c
le is a sweep from
start to stop lambda)
"""
...
...
@@ -82,7 +82,7 @@ def run_with_limited_time(func, args, kwargs, time):
###############################################
# Found a neat python timout function on:
# https://stackoverflow.com/questions/492519/timeout-on-a-function-call
# default retu
ns None when tim
eout occurs
# default retu
rns None when tim
eout occurs
def
timeout
(
func
,
args
=
(),
kwargs
=
{},
timeout_duration
=
1
,
default
=
None
):
import
signal
...
...
@@ -126,7 +126,7 @@ def wr2wrpc(ser, cmd, prompt="slv=>"):
def
sfp_ena
(
ser_slave
):
# bring the link down and up again by dis-/en-abeling the TX laser
# Note that this forces the wr switch to re-sybc and bitslide but
# not the wr devi
d
ce (SPEC or CLB) connected to it; Their wr links
# not the wr device (SPEC or CLB) connected to it; Their wr links
# is kept up
wr2wrpc
(
ser_slave
,
"sfp ena 0
\r
"
,
"slv=>"
)
time
.
sleep
(
1
)
...
...
@@ -200,7 +200,7 @@ def wait_for_track_phase(ser_slave):
# bring the link down and up again by dis-/en-abeling the TX laser
# Note that this forces the wr switch to re-sybc and bitslide but
# not the wr devi
d
ce (SPEC or CLB) connected to it; Their wr links
# not the wr device (SPEC or CLB) connected to it; Their wr links
# is kept up
sfp_ena
(
ser_slave
)
...
...
@@ -222,7 +222,7 @@ def wait_for_track_phase(ser_slave):
if
"TRACK_PHASE"
in
stat_lst
[
6
]:
track_phase
=
True
#except:
# print ("### error occured while reading wr status.")
# print ("### error occur
r
ed while reading wr status.")
# continue
return
(
track_phase
)
...
...
@@ -255,14 +255,14 @@ Options:
-ss slave serial port, default: "/dev/ttyUSB1"
-t <IP> track fiber spool temperature (using PT100 and Digital Multimeter at IP address)
-o <dir> optional directory for output file storage, default: "data/"
-m <number> number of measurement cycles (default = 1 cyle is a sweep from
-m <number> number of measurement cycles (default = 1 cy
c
le is a sweep from
start to stop lambda)
"""
if
__name__
==
"__main__"
:
#arguments = docopt(__doc__,version='White Rabbit controled via serial port')
#arguments = docopt(__doc__,version='White Rabbit control
l
ed via serial port')
import
argparse
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-mserial"
,
default
=
"/dev/ttyUSB2"
)
...
...
@@ -275,7 +275,7 @@ if __name__ == "__main__":
print
(
"Use Slave Serial port: "
,
args
.
sserial
)
print
(
"Fiber spool temperature track: "
,
args
.
t
)
print
(
"Output directory: "
,
args
.
output_dir
)
print
(
"Number of measuremnt cycles: "
,
args
.
measurements
)
print
(
"Number of measurem
e
nt cycles: "
,
args
.
measurements
)
# add trailing slash if not present
output_dir
=
os
.
path
.
join
(
args
.
output_dir
,
''
)
...
...
@@ -300,7 +300,7 @@ if __name__ == "__main__":
fixed_delay_mst
=
int
(
0
)
# Master (dTx + dRx) [ps]
fixed_delay_slv
=
int
(
0
)
# Slave (dTx + dRx) [ps]
master_is_switch
=
False
# If the master is a WR switch then the restart sequence is different from CLB or SPEC
master_has_tunable
=
True
# det
rmines w
ether the master or the slave has the tunable SFP (due to sfp functions needed
master_has_tunable
=
True
# det
ermines wh
ether the master or the slave has the tunable SFP (due to sfp functions needed
# this only works when master is a CLB or SPEC)
# Master SFP (tunable)
...
...
@@ -318,12 +318,12 @@ if __name__ == "__main__":
#itu_channel_increment = params["itu_channel_spacing"]
itu_channel_increment
=
1
crtt_measurement
=
10
# number of crtt measurements over which the crtt is averaged
crtt_skip
=
5
# skip first 5 crtt measurments
crtt_skip
=
5
# skip first 5 crtt measur
e
ments
restarts
=
1
# number of link restarts over which the crtt is averaged
spool_temp
=
None
# if not used then default None
if
args
.
t
!=
None
:
# open and configue Digital Multimeter with attached PT100
if
args
.
t
!=
None
:
# open and configu
r
e Digital Multimeter with attached PT100
import
vxi11
dmm
=
vxi11
.
Instrument
(
args
.
t
)
print
(
dmm
.
ask
(
"*IDN?"
))
...
...
@@ -478,7 +478,7 @@ if __name__ == "__main__":
meas_number
=
meas_number
+
1
print
(
curr_crtt
,
curr_drxm
,
curr_drxs
)
else
:
# next measurements compare bitslide check variables
# check for good measurment; criteria:
# check for good measur
e
ment; criteria:
# 1) bitslides should all be equal (no hidden link resynchronizations)
# 2) crtt outliers bigger than 200 ps are not excepted (no hidden finetime jumps;
# a worry since wrpc-v4.1 and PPSi huge PPS offset repair)
...
...
@@ -498,7 +498,7 @@ if __name__ == "__main__":
crtt_mean
=
numpy
.
mean
(
crtt
[(
crtt_skip
+
1
):])
# skip first measurements
if
args
.
t
!=
None
:
# open and configue Digital Multimeter with attached PT100
if
args
.
t
!=
None
:
# open and configu
r
e Digital Multimeter with attached PT100
spool_temp
=
float
(
dmm
.
ask
(
"MEAS:TEMP? FRTD"
))
print
(
"sfp_channel: "
,
sfp_ch
,
"itu_channel: "
,
ch
,
"crtt avarage over "
+
str
(
crtt_measurement
)
+
" measurments: "
+
str
(
crtt_mean
)
+
" fiber-spool temp: "
+
str
(
spool_temp
))
...
...
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