Commit ac27c8a7 authored by Peter Jansweijer's avatar Peter Jansweijer

added 3 wavelength alpha_error and time_error graph as function of distance…

added 3 wavelength alpha_error and time_error graph as function of distance between l1, l2 and distance between l_sm and l1
parent 4bfa0003
......@@ -190,29 +190,29 @@ def spec_alpha(alpha):
############################################################################
#def calc_alpha_l1(lambda_1, lambda_2, crtt_lambda_1, crtt_lambda_2, fixed_lambda):
# """
# calc_alpha_l1 calculates the alpha factor for wavelength lambda l1.
# For this caluculation we need two cable round trip times that were measured
# using lamdba l1 and lambda l2 while both used a common fixed_lambda for the
# return channel.
#
# lambda_1, lambda_2, fixed_lambda -- <float> lambda's in [m]
# crtt_l1, crtt_l2 -- <float> cable round trip times measured
# at lambda_1 and lambda_2
#
# returns:
# alpha_lambda_1 -- <float>
#
# """
#
# delta_lambda_1 = lambda_1 - fixed_lambda
# delta_lambda_2 = lambda_2 - fixed_lambda
# crtt_diff = crtt_lambda_1 - crtt_lambda_2
# lambda_diff = lambda_1 - lambda_2
#
# alpha_lambda_1 = (2 * delta_lambda_1 * crtt_diff)/((crtt_lambda_1 * lambda_diff) - (crtt_diff * delta_lambda_1))
# return (alpha_lambda_1)
def calc_alpha_l1(lambda_1, lambda_2, crtt_lambda_1, crtt_lambda_2, fixed_lambda):
"""
calc_alpha_l1 calculates the alpha factor for wavelength lambda l1.
For this caluculation we need two cable round trip times that were measured
using lamdba l1 and lambda l2 while both used a common fixed_lambda for the
return channel.
lambda_1, lambda_2, fixed_lambda -- <float> lambda's in [m]
crtt_l1, crtt_l2 -- <float> cable round trip times [ps]measured
at lambda_1 and lambda_2
returns:
alpha_lambda_1 -- <float>
"""
delta_lambda_1 = lambda_1 - fixed_lambda
delta_lambda_2 = lambda_2 - fixed_lambda
crtt_diff = crtt_lambda_1 - crtt_lambda_2
lambda_diff = lambda_1 - lambda_2
alpha_lambda_1 = (2 * delta_lambda_1 * crtt_diff)/((crtt_lambda_1 * lambda_diff) - (crtt_diff * delta_lambda_1))
return (alpha_lambda_1)
############################################################################
......@@ -595,7 +595,39 @@ if __name__ == "__main__":
arr_sellmeier_clean=numpy.array(alpha_sellmeier)
ax.plot(x_clean, alpha_time_error, label='time error')
ax.legend(loc='lower right', fontsize='medium')
# =====================================================
from mpl_toolkits.mplot3d import axes3d
# Here we are going to make the 3 wavelength error plot:
# p is the difference between Master2Slave wavelength l1 and
# Fixed Slave2Master wavelength.
# q is the distance between Master2Slave wavelength l1 and l2
l1,l2 = numpy.meshgrid(x_clean, x_clean)
crtt_l1 = group_delay(l1,popt[0],popt[1],popt[2],popt[3],popt[4])
crtt_l2 = group_delay(l2,popt[0],popt[1],popt[2],popt[3],popt[4])
alpha_3wl = calc_alpha_l1(l1/1e9, l2/1e9, crtt_l1, crtt_l2, fixed_lambda)
alpha_3wlsel = calc_alpha_sellmeier(l1/1e9, fixed_lambda, popt[0],popt[1],popt[2],popt[3],popt[4])
alpha_err = alpha_3wlsel - alpha_3wl
time_err = calc_alpha_error(alpha_3wlsel, alpha_3wl, crtt_fixed_lambda)
#fig_3wavelength_alpha_err = plt.figure("3 wavelength alpha error")
#ax = fig_3wavelength_alpha_err.add_subplot(111,projection='3d')
#ax.set_xlabel('l1 - fixed_lambda [nm]')
#ax.set_ylabel('l1 - l2 [nm]')
#ax.set_zlabel('alpha error')
#ax.plot_wireframe(l1-fixed_lambda*1e9, l1-l2, alpha_err)
fig_3wavelength_time_err = plt.figure("3 wavelength time error for link with crtt(lambda_sm) = "+ str(crtt_fixed_lambda) + "[ps]")
ax = fig_3wavelength_time_err.add_subplot(111,projection='3d')
ax.set_xlabel('l1 - fixed_lambda [nm]')
ax.set_ylabel('l1 - l2 [nm]')
ax.set_zlabel('time error [ps]')
ax.plot_wireframe(l1-fixed_lambda*1e9, l1-l2, time_err)
# =====================================================
alpha_file = open(name+".out","w")
alpha_file.write("file: " + insitu_file + "\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment