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
76f9af24
Commit
76f9af24
authored
Mar 29, 2018
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
INSITU_ALPHA: added output for Data Delay measurement proposal
parent
518ad15e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
analyze_sellmeier.py
sw/insitu_alpha/analyze_sellmeier.py
+19
-2
No files found.
sw/insitu_alpha/analyze_sellmeier.py
View file @
76f9af24
...
...
@@ -718,7 +718,7 @@ if __name__ == "__main__":
time_err
=
calc_alpha_error
(
alpha_3wlsel
,
alpha_3wl
,
crtt_fixed_lambda
)
time_err_relative
=
time_err
/
crtt_fixed_lambda
pdb
.
set_trace
()
#
pdb.set_trace()
"""
# =====================================================
...
...
@@ -782,6 +782,8 @@ if __name__ == "__main__":
# =====================================================
# Output 3 wavelength alpha_error values in file
# Also prepare a file for PPS delta delay measurement that
# contains lambda1 and alpha (in SPEC format).
# =====================================================
alpha_err_file
=
open
(
name
+
"_err.out"
,
"w"
)
alpha_err_file
.
write
(
"file: "
+
insitu_file
+
"
\n
"
)
...
...
@@ -794,6 +796,12 @@ if __name__ == "__main__":
alpha_err_file
.
write
(
"D: "
+
str
(
popt
[
3
])
+
"
\n
"
)
alpha_err_file
.
write
(
"E: "
+
str
(
popt
[
4
])
+
"
\n
"
)
alpha_ddelay_file
=
open
(
name
+
"_ddelay.out"
,
"w"
)
alpha_ddelay_file
.
write
(
"# Proposed Delta Delay measurements
\n
"
)
alpha_ddelay_file
.
write
(
"# file: "
+
insitu_file
+
"
\n
"
)
alpha_ddelay_file
.
write
(
"# reference file: "
+
ref_insitu_file
+
"
\n
"
)
alpha_ddelay_file
.
write
(
"# fixed_lambda: "
+
str
(
fixed_lambda
)
+
" = ITU-ch: "
+
str
(
itu_conv
.
wavelength_2_itu
(
fixed_lambda
))
+
"
\n
"
)
alpha_err_file
.
write
(
"min time_err: "
+
str
(
numpy
.
nanmin
(
time_err
))
+
"
\n
"
)
l1_idx
,
l2_idx
=
numpy
.
where
(
time_err
==
numpy
.
nanmin
(
time_err
))
alpha_err_file
.
write
(
" @ l1: "
+
str
(
l2
[
l1_idx
][
0
][
0
])
+
"
\n
"
)
...
...
@@ -807,6 +815,8 @@ if __name__ == "__main__":
rng
=
1
# [ps]
alpha_err_file
.
write
(
"============================
\n
"
)
alpha_err_file
.
write
(
"time_err within range: "
+
str
(
rng
)
+
" [ps]
\n
"
)
alpha_ddelay_file
.
write
(
"# ============================
\n
"
)
alpha_ddelay_file
.
write
(
"# time_err within range: "
+
str
(
rng
)
+
" [ps]
\n
"
)
#alpha_err_file.write(" @l1\tl2\n")
rng_sel
=
numpy
.
argwhere
(
numpy
.
logical_and
(
time_err
<
rng
,
time_err
>-
rng
))
#pdb.set_trace()
...
...
@@ -814,12 +824,18 @@ if __name__ == "__main__":
# alpha_err_file.write(str(l2[i[0]][0]) + "\t" + str(l2[i[1]][0]) + "\n")
alpha_err_file
.
write
(
"l1[nm]
\t
l2[nm]
\t
crtt_(l1)[ps]
\t
crtt(l2)[ps]
\t
alpha_sel(l1)
\t
alpha_3wl(l1)
\t
SPEC_alpha_3wl(l1)
\t
time_err[ps]
\t
time_relative_err[t_err ps/link_length ps]
\n
"
)
alpha_ddelay_file
.
write
(
"# lambda-1[nm]
\t
ITU-ch
\t
SPEC_alpha_3wl(l1)
\t
lambda-2[nm]
\n
"
)
for
i
in
rng_sel
:
lambda1
=
l2
[
i
[
0
]][
0
]
lambda2
=
l2
[
i
[
1
]][
0
]
lambda_idx
=
i
[
1
],
i
[
0
]
alpha_spec_3wl
=
spec_alpha
(
alpha_3wl
[
lambda_idx
])
itu_ch
=
itu_conv
.
wavelength_2_itu
(
lambda1
/
1e9
)
alpha_err_writeln
(
alpha_err_file
,
lambda1
,
lambda2
,
fixed_lambda
,
lambda_idx
,
popt
[
0
],
popt
[
1
],
popt
[
2
],
popt
[
3
],
popt
[
4
],
crtt_fixed_lambda
,
alpha_3wl
,
time_err
)
alpha_ddelay_file
.
write
(
str
(
lambda1
)
+
", "
+
str
(
itu_ch
)
+
", "
+
str
(
alpha_spec_3wl
)
+
", "
+
str
(
lambda2
)
+
"
\n
"
)
alpha_err_file
.
write
(
"============================
\n
"
)
alpha_err_file
.
write
(
"all possible combinations and their results:
\n
"
)
alpha_err_file
.
write
(
"l1[nm]
\t
l2[nm]
\t
crtt_(l1)[ps]
\t
crtt(l2)[ps]
\t
alpha_sel(l1)
\t
alpha_3wl(l1)
\t
SPEC_alpha_3wl(l1)
\t
time_err[ps]
\t
time_relative_err[t_err ps/link_length ps]
\n
"
)
...
...
@@ -832,6 +848,7 @@ if __name__ == "__main__":
#alpha_err_file.write(str(l1[l1_idx][l2_idx]) + "\t" + str(l2[l1_idx][l2_idx]) + "\t" + str(group_delay(l1[l1_idx][l2_idx],popt[0],popt[1],popt[2],popt[3],popt[4])) + "\t " + str(group_delay(l2[l1_idx][l2_idx],popt[0],popt[1],popt[2],popt[3],popt[4])) + "\t" + str(calc_alpha_sellmeier(l1[l1_idx][l2_idx]/1e9, fixed_lambda,popt[0],popt[1],popt[2],popt[3],popt[4])) + "\t " + str(alpha_3wl[l1_idx][l2_idx]) + "\t " + str(spec_alpha(alpha_3wl[l1_idx][l2_idx])) + "\t" + str(time_err[l1_idx][l2_idx]) + "\t" + str(time_err[l1_idx][l2_idx]/crtt_fixed_lambda) + "\n")
alpha_err_file
.
close
()
alpha_ddelay_file
.
close
()
#plt.subplot_tool()
...
...
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