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
b9965a45
Commit
b9965a45
authored
May 04, 2019
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include stddev for calculated time error
parent
c2affb46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
5 deletions
+52
-5
errorbarplots.py
sw/insitu_alpha/ArticleErrorbarPlots/errorbarplots.py
+52
-5
No files found.
sw/insitu_alpha/ArticleErrorbarPlots/errorbarplots.py
View file @
b9965a45
...
@@ -36,6 +36,47 @@ def calc_alpha_error(alpha1, alpha2, crtt_fixed_lambda):
...
@@ -36,6 +36,47 @@ def calc_alpha_error(alpha1, alpha2, crtt_fixed_lambda):
############################################################################
############################################################################
def
calc_alpha_error_stddev
(
alpha1
,
alpha1_stddev
,
alpha2
,
alpha2_stddev
,
crtt_fixed_lambda
,
crtt_fixed_lambda_stddev
):
"""
calc_alpha_error calculates the timing error between the PPS-ses of Master
and Slave that will be the result of an "imperfect" alpha2 with respect to a
"perfect" alpha1.
The timing error scales linear with the round trip time (i.e. the length of
your fiber)
alpha1 -- <float> alpha to be considered the correct value
alpha1_stddev -- <float> stddev for alpha1
alpha2 -- <float> alpha for which timing error needs to be calculated
alpha2_stddev -- <float> stddev for alpha2
crtt_fixed_lambda -- <float> crtt value at the fixed wavelenght.
note that this is the virtual crtt for which
master2slave and slave2master wavelengths would be
equal. It can be estimated by extrapolating the crtt
array.
crtt_fixed_lambda_stddev -- <float> stddev for crtt_fixed_lambda
returns:
t_err, t_err_stddev -- <float> PPS time error
"""
# Calculate the (mean) value of t_err
t_err
=
calc_alpha_error
(
alpha1
,
alpha2
,
crtt_fixed_lambda
)
# Calculate the stddev contribution to t_err of each of the parameters alpha1, alpha2 and crtt_fixed_lambda
t_err_stddev_alpha1
=
calc_alpha_error
(
alpha1
+
alpha1_stddev
,
alpha2
,
crtt_fixed_lambda
)
-
t_err
t_err_stddev_alpha2
=
calc_alpha_error
(
alpha1
,
alpha2
+
alpha2_stddev
,
crtt_fixed_lambda
)
-
t_err
t_err_stddev_crtt_fixed_lambda
=
calc_alpha_error
(
alpha1
,
alpha2
,
crtt_fixed_lambda
+
crtt_fixed_lambda_stddev
)
-
t_err
# Calculate the RMS stddev of alpha
t_err_stddev
=
numpy
.
sqrt
(
t_err_stddev_alpha1
**
2
+
t_err_stddev_alpha2
**
2
+
t_err_stddev_crtt_fixed_lambda
**
2
)
return
(
t_err
,
t_err_stddev
)
############################################################################
############################################################################
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
#############################################################################################
#############################################################################################
...
@@ -46,17 +87,23 @@ if __name__ == "__main__":
...
@@ -46,17 +87,23 @@ if __name__ == "__main__":
# data source: data_180914/averaged_err.out => crtt_(l1)
# data source: data_180914/averaged_err.out => crtt_(l1)
alpha_sel
=
numpy
.
array
([
6.424e-06
,
6.424e-06
,
3.207e-06
,
3.207e-06
,
3.207e-06
,
-
3.197e-06
,
-
3.197e-06
,
-
3.197e-06
,
-
6.384e-06
,
-
6.384e-06
,
2.922e-05
,
2.922e-05
,
2.922e-05
,
-
2.529e-05
,
-
2.529e-05
,
-
2.529e-05
,
-
7.391e-05
,
-
7.391e-05
,
-
7.391e-05
,
-
1.226e-04
,
-
1.226e-04
,
-
1.226e-04
])
alpha_sel
=
numpy
.
array
([
6.424e-06
,
6.424e-06
,
3.207e-06
,
3.207e-06
,
3.207e-06
,
-
3.197e-06
,
-
3.197e-06
,
-
3.197e-06
,
-
6.384e-06
,
-
6.384e-06
,
2.922e-05
,
2.922e-05
,
2.922e-05
,
-
2.529e-05
,
-
2.529e-05
,
-
2.529e-05
,
-
7.391e-05
,
-
7.391e-05
,
-
7.391e-05
,
-
1.226e-04
,
-
1.226e-04
,
-
1.226e-04
])
alpha_sel_stddev
=
numpy
.
array
([
1.682e-08
,
1.682e-08
,
1.674e-08
,
1.674e-08
,
1.674e-08
,
1.671e-08
,
1.671e-08
,
1.671e-08
,
1.675e-08
,
1.675e-08
,
1.843e-08
,
1.843e-08
,
1.843e-08
,
1.786e-08
,
1.786e-08
,
1.786e-08
,
2.600e-08
,
2.600e-08
,
2.600e-08
,
3.850e-08
,
3.850e-08
,
3.850e-08
])
# data source: data_180926/180926_15_47_01_3_lambda_insitu_alpha_scan_result.txt
# data source: data_180926/180926_15_47_01_3_lambda_insitu_alpha_scan_result.txt
alpha_3wl_b
=
numpy
.
array
([
6.393e-06
,
6.449e-06
,
3.154e-06
,
3.262e-06
,
3.214e-06
,
-
3.224e-06
,
-
3.193e-06
,
-
3.298e-06
,
-
6.488e-06
,
-
6.348e-06
,
2.898e-05
,
2.847e-05
,
2.788e-05
,
-
2.551e-05
,
-
2.454e-05
,
-
2.402e-05
,
-
7.464e-05
,
-
7.303e-05
,
-
7.009e-05
,
-
1.238e-04
,
-
1.211e-04
,
-
1.188e-04
])
alpha_3wl_b
=
numpy
.
array
([
6.393e-06
,
6.449e-06
,
3.154e-06
,
3.262e-06
,
3.214e-06
,
-
3.224e-06
,
-
3.193e-06
,
-
3.298e-06
,
-
6.488e-06
,
-
6.348e-06
,
2.898e-05
,
2.847e-05
,
2.788e-05
,
-
2.551e-05
,
-
2.454e-05
,
-
2.402e-05
,
-
7.464e-05
,
-
7.303e-05
,
-
7.009e-05
,
-
1.238e-04
,
-
1.211e-04
,
-
1.188e-04
])
alpha_3wl_b_stddev
=
numpy
.
array
([
1.186e-06
,
1.970e-07
,
2.856e-07
,
2.100e-07
,
1.185e-07
,
1.181e-07
,
1.576e-07
,
3.871e-07
,
2.387e-07
,
6.540e-07
,
1.858e-07
,
1.025e-07
,
6.481e-08
,
1.591e-07
,
1.510e-07
,
8.868e-08
,
3.042e-07
,
4.437e-07
,
5.724e-07
,
2.455e-07
,
3.260e-07
,
7.897e-07
])
# data source: data_180914/averaged_err.out => crtt_(l1)
# data source: data_180914/averaged_err.out => crtt_(l1)
crtt_fixed_lambda
=
numpy
.
array
([
491284316
,
491284316
,
491283526
,
491283526
,
491283526
,
491281953
,
491281953
,
491281953
,
491281170
,
491281170
,
491289916
,
491289916
,
491289916
,
491276526
,
491276526
,
491276526
,
491264582
,
491264582
,
491264582
,
491252613
,
491252613
,
491252613
])
crtt_fixed_lambda
=
numpy
.
array
([
491284316
,
491284316
,
491283526
,
491283526
,
491283526
,
491281953
,
491281953
,
491281953
,
491281170
,
491281170
,
491289916
,
491289916
,
491289916
,
491276526
,
491276526
,
491276526
,
491264582
,
491264582
,
491264582
,
491252613
,
491252613
,
491252613
])
crtt_fixed_lambda_stddev
=
numpy
.
array
([
124
,
124
,
124
,
124
,
124
,
125
,
125
,
125
,
125
,
125
,
123
,
123
,
123
,
126
,
126
,
126
,
129
,
129
,
129
,
133
,
133
,
133
])
# calculate time error of the 3-wavelength determined alpha while taking the Sellmeier determined alpha as a reference.
# calculate time error of the 3-wavelength determined alpha while taking the Sellmeier determined alpha as a reference.
time_err_calc_3wl
=
calc_alpha_error
(
alpha_sel
,
alpha_3wl_b
,
crtt_fixed_lambda
)
#time_err_calc_3wl = calc_alpha_error(alpha_sel, alpha_3wl_b, crtt_fixed_lambda)
time_err_calc_3wl
,
time_err_calc_3wl_stddev
=
calc_alpha_error_stddev
(
alpha_sel
,
alpha_sel_stddev
,
alpha_3wl_b
,
alpha_3wl_b_stddev
,
crtt_fixed_lambda
,
crtt_fixed_lambda_stddev
)
result_file
=
open
((
"time_error_result.txt"
),
"w"
)
result_file
=
open
((
"time_error_result.txt"
),
"w"
)
result_file
.
write
(
"time_err_calc_3wl, time_err_calc_3wl_stddev
\n
"
)
for
i
in
time_err_calc_3wl
:
for
i
in
range
(
len
(
time_err_calc_3wl
))
:
result_file
.
write
(
"{0:.1f}"
.
format
(
i
)
+
"
\n
"
)
result_file
.
write
(
"{0:.1f}"
.
format
(
time_err_calc_3wl
[
i
])
+
", "
+
"{0:.1f}"
.
format
(
time_err_calc_3wl_stddev
[
i
]
)
+
"
\n
"
)
result_file
.
close
()
result_file
.
close
()
##############################################################
##############################################################
...
@@ -224,7 +271,7 @@ if __name__ == "__main__":
...
@@ -224,7 +271,7 @@ if __name__ == "__main__":
lns_b
.
append
(
ax
.
errorbar
(
selected_x_10
,
selected_time_err_b_10
,
yerr
=
selected_time_err_b_10_stddev
,
fmt
=
'v'
,
capsize
=
6
,
color
=
'C8'
,
label
=
r'$t_{err\_m}$ B, $\lambda_{2}$ =1559.79 [nm]'
))
lns_b
.
append
(
ax
.
errorbar
(
selected_x_10
,
selected_time_err_b_10
,
yerr
=
selected_time_err_b_10_stddev
,
fmt
=
'v'
,
capsize
=
6
,
color
=
'C8'
,
label
=
r'$t_{err\_m}$ B, $\lambda_{2}$ =1559.79 [nm]'
))
lns
.
append
(
ax
.
errorbar
(
x
,
time_err_calc_sel
,
yerr
=
0
,
fmt
=
'*'
,
color
=
'blue'
,
label
=
r'$t_{err\_c}$ A'
))
lns
.
append
(
ax
.
errorbar
(
x
,
time_err_calc_sel
,
yerr
=
0
,
fmt
=
'*'
,
color
=
'blue'
,
label
=
r'$t_{err\_c}$ A'
))
lns
.
append
(
ax
.
errorbar
(
x
,
time_err_calc_3wl
[
0
:
10
],
yerr
=
0
,
fmt
=
'o'
,
color
=
'red'
,
label
=
r'$t_{err\_c}$ B'
))
lns
.
append
(
ax
.
errorbar
(
x
,
time_err_calc_3wl
[
0
:
10
],
yerr
=
time_err_calc_3wl_stddev
[
0
:
10
]
,
fmt
=
'o'
,
color
=
'red'
,
label
=
r'$t_{err\_c}$ B'
))
#############################################################################################
#############################################################################################
labels
=
[
l
.
get_label
()
for
l
in
lns
]
labels
=
[
l
.
get_label
()
for
l
in
lns
]
...
@@ -461,7 +508,7 @@ if __name__ == "__main__":
...
@@ -461,7 +508,7 @@ if __name__ == "__main__":
#lns_b.append(ax.errorbar(selected_x_10, selected_time_err_b_10, yerr = selected_time_err_b_10_stddev, fmt='v', capsize=6, color='C8', label=r'$t_{err\_m}$ B, $\lambda_{2}$ =1559.79 [nm]'))
#lns_b.append(ax.errorbar(selected_x_10, selected_time_err_b_10, yerr = selected_time_err_b_10_stddev, fmt='v', capsize=6, color='C8', label=r'$t_{err\_m}$ B, $\lambda_{2}$ =1559.79 [nm]'))
lns
.
append
(
ax
.
errorbar
(
x
,
time_err_calc_sel
,
yerr
=
0
,
fmt
=
'*'
,
color
=
'blue'
,
label
=
r'$t_{err\_c}$ A'
))
lns
.
append
(
ax
.
errorbar
(
x
,
time_err_calc_sel
,
yerr
=
0
,
fmt
=
'*'
,
color
=
'blue'
,
label
=
r'$t_{err\_c}$ A'
))
lns
.
append
(
ax
.
errorbar
(
x
,
time_err_calc_3wl
[
10
:
23
],
yerr
=
0
,
fmt
=
'o'
,
color
=
'red'
,
label
=
r'$t_{err\_c}$ B'
))
lns
.
append
(
ax
.
errorbar
(
x
,
time_err_calc_3wl
[
10
:
23
],
yerr
=
time_err_calc_3wl_stddev
[
10
:
23
]
,
fmt
=
'o'
,
color
=
'red'
,
label
=
r'$t_{err\_c}$ B'
))
#############################################################################################
#############################################################################################
labels
=
[
l
.
get_label
()
for
l
in
lns
]
labels
=
[
l
.
get_label
()
for
l
in
lns
]
...
...
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