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
3c28582b
Commit
3c28582b
authored
Sep 08, 2017
by
Peter Jansweijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added dashed linear fit line to plots
parent
976125fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
analyze_sellmeier.py
sw/insitu_alpha/analyze_sellmeier.py
+14
-10
No files found.
sw/insitu_alpha/analyze_sellmeier.py
View file @
3c28582b
...
...
@@ -421,6 +421,7 @@ if __name__ == "__main__":
# again define the best fit line, now based on clean arrays:
ly_clean
=
[]
ly_lin_clean
=
[]
alpha_clean
=
[]
alpha_lin_clean
=
[]
...
...
@@ -437,21 +438,17 @@ if __name__ == "__main__":
# in [Km].
for
i
in
x_clean
:
# scan through all wavelengths in [nm]!
#
clean_y = line(i,popt_clean[0],popt_clean[1])
lin_
clean_y
=
line
(
i
,
popt_clean
[
0
],
popt_clean
[
1
])
clean_y
=
(
group_delay
(
i
,
popt
[
0
],
popt
[
1
],
popt
[
2
],
popt
[
3
],
popt
[
4
]))
dispersion
=
dispersion_coefficient
(
i
,
popt
[
1
],
popt
[
2
],
popt
[
3
],
popt
[
4
])
ly_clean
.
append
(
clean_y
)
ly_lin_clean
.
append
(
lin_clean_y
)
# linear
ly_clean
.
append
(
clean_y
)
# 5-t Sellmeier
alpha_lin_clean
.
append
(
calc_alpha
(
i
/
1e9
,
clean_y
,
tangent
*
1e9
,
fixed_lambda
))
alpha_clean
.
append
(
calc_alpha
(
i
/
1e9
,
clean_y
,
dispersion
,
fixed_lambda
))
fig
=
plt
.
figure
(
"CRTT versus ITU Channel number"
)
ax
=
fig
.
add_subplot
(
111
)
ax
.
set_ylabel
(
'CRTT [ps]'
)
ax
.
text
(
0.01
,
0.95
,
str
(
insitu_file
),
transform
=
ax
.
transAxes
)
ax
.
text
(
0.01
,
0.90
,
"tolerance: "
+
str
(
tolerance
)
+
"; outliers: "
+
str
(
outlier_cnt
),
transform
=
ax
.
transAxes
)
#ax.text(0.01, 0.85, "fit y = a * x + b", transform=ax.transAxes)
#ax.text(0.01, 0.80, "a:" + str(popt_clean[0]), transform=ax.transAxes)
#ax.text(0.01, 0.75, "b:" + str(popt_clean[1]), transform=ax.transAxes)
if
use_itu_channels
:
ax
.
set_title
(
"CRTT versus ITU Channel number"
)
...
...
@@ -462,15 +459,21 @@ if __name__ == "__main__":
ax
.
set_xlabel
(
'Wavelenth [nm]'
)
ax
.
text
(
0.01
,
0.85
,
"1st order linear tangent: "
+
str
(
tangent
)
+
" [ps/nm]"
,
transform
=
ax
.
transAxes
)
with_tolerances
=
True
with_tolerances
=
False
ax
.
text
(
0.01
,
0.95
,
str
(
insitu_file
),
transform
=
ax
.
transAxes
)
ax
.
plot
(
x
,
y
,
color
=
'blue'
,
label
=
'data'
)
# Original datapoints
if
with_tolerances
:
ax
.
text
(
0.01
,
0.90
,
"tolerance: "
+
str
(
tolerance
)
+
"; outliers: "
+
str
(
outlier_cnt
),
transform
=
ax
.
transAxes
)
#ax.text(0.01, 0.85, "fit y = a * x + b", transform=ax.transAxes)
#ax.text(0.01, 0.80, "a:" + str(popt_clean[0]), transform=ax.transAxes)
#ax.text(0.01, 0.75, "b:" + str(popt_clean[1]), transform=ax.transAxes)
ax
.
plot
(
x
,
ly
,
"."
,
color
=
'gray'
,
label
=
'best fit 5-term Sellmeier'
)
# 5-term Sellmeier best fit
ax
.
plot
(
x
,
ly
+
tol
,
"."
,
color
=
'#c0c0c0'
,
label
=
'tolerances'
)
# 5-term Sellmeier best fit with + tolerances
ax
.
plot
(
x
,
ly
-
tol
,
"."
,
color
=
'#c0c0c0'
)
# 5-term Sellmeier best fit with - tolerances
ax
.
plot
(
x_clean
,
y_clean
,
color
=
'red'
,
label
=
'data, outliers removed'
)
# cleaned array in [nm]
ax
.
plot
(
x_clean
,
ly_clean
,
color
=
'green'
,
label
=
'5-term Sellmeier fit'
)
# final clean 5th order sellmeier fit in [nm]
ax
.
plot
(
x_clean
,
ly_lin_clean
,
"-"
,
color
=
'blue'
,
dashes
=
[
5
,
5
,
5
,
5
],
label
=
'linear fit'
)
# final clean linear fit in [nm]
ax
.
legend
(
loc
=
'lower right'
,
fontsize
=
'medium'
)
fig
.
savefig
(
insitu_file
+
".png"
)
...
...
@@ -490,7 +493,7 @@ if __name__ == "__main__":
ax
.
axhline
(
0
,
color
=
'gray'
)
ax
.
axvline
(
fixed_lambda
*
1e9
,
color
=
'red'
)
ax
.
plot
(
x_clean
,
alpha_clean
,
color
=
'green'
,
label
=
'5-term Sellmeier'
)
ax
.
plot
(
x_clean
,
alpha_lin_clean
,
color
=
'blue'
,
label
=
'linear'
)
ax
.
plot
(
x_clean
,
alpha_lin_clean
,
color
=
'blue'
,
dashes
=
[
5
,
5
,
5
,
5
]
,
label
=
'linear'
)
ax
.
legend
(
loc
=
'lower right'
,
fontsize
=
'medium'
)
alpha_file
=
open
(
name
+
".out"
,
"w"
)
...
...
@@ -506,9 +509,10 @@ if __name__ == "__main__":
alpha_file
.
close
()
#pdb.set_trace()
#plt.subplot_tool()
plt
.
subplots_adjust
(
left
=
0.17
)
fig_alpha
.
savefig
(
insitu_file
+
"_alpha.png"
)
plt
.
draw
()
plt
.
show
()
...
...
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