Commit 248cb513 authored by Peter Jansweijer's avatar Peter Jansweijer

3d plots for l1 on x-axis, l2 on y-axis. also relative time error (t_err [ps]/link length [ps])

parent ac27c8a7
......@@ -526,6 +526,9 @@ if __name__ == "__main__":
alpha_sellmeier.append(alpha_sel)
alpha_time_error.append(calc_alpha_error(alpha_sel, alpha_tan, crtt_fixed_lambda))
# =====================================================
# Plot CRTT versus ITU Channel number
# =====================================================
fig = plt.figure("CRTT versus ITU Channel number")
ax = fig.add_subplot(111)
ax.set_ylabel('CRTT [ps]')
......@@ -560,6 +563,10 @@ if __name__ == "__main__":
fig.savefig(insitu_file+".png")
if isfile: # Analyze single file => plot
# =====================================================
# Plot alpha as a function of wavelength
# =====================================================
fig_alpha = plt.figure("alpha as a function of wavelength")
ax = fig_alpha.add_subplot(111)
ax.set_title("alpha as a function of wavelength")
......@@ -578,7 +585,9 @@ if __name__ == "__main__":
#ax.plot(x_clean, alpha_linear, color='blue', dashes=[5,5,5,5], label='linear')
ax.legend(loc='lower right', fontsize='medium')
# =====================================================
# Plot Time error due to using linear instead of 5-term sellmeier
# =====================================================
fig_alpha_error = plt.figure("Sellmeier/Linear Error wavelength")
ax = fig_alpha_error.add_subplot(111)
ax.set_title("Time error due to using linear instead of 5-term sellmeier")
......@@ -597,7 +606,8 @@ if __name__ == "__main__":
ax.legend(loc='lower right', fontsize='medium')
# =====================================================
# 3D Plots
# =====================================================
from mpl_toolkits.mplot3d import axes3d
# Here we are going to make the 3 wavelength error plot:
......@@ -612,23 +622,55 @@ if __name__ == "__main__":
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)
time_err_relative = time_err/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)
"""
# =====================================================
# Plot 3 wavelength alpha error
# =====================================================
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')
# =====================================================
# Plot 3 wavelength time error (l1-lsm x-axis, l1-l2 y-axis, error z-axis)
# =====================================================
fig_3wavelength_time_err_offset = plt.figure("3 wavelength (relative displayed) time error for link with crtt(lambda_sm) = "+ str(crtt_fixed_lambda) + "[ps]")
ax = fig_3wavelength_time_err_offset.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)
"""
# =====================================================
# Plot 3 wavelength time error (l1 on x-axis, l2 on y-axis, error z-axis)
# =====================================================
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 [nm]')
ax.set_ylabel('l2 [nm]')
ax.set_zlabel('time error [ps]')
ax.plot_wireframe(l1, l2, time_err)
"""
# =====================================================
# Plot 3 wavelength relative time error (l1 on x-axis, l2 on y-axis, error z-axis)
# =====================================================
fig_3wavelength_time_err = plt.figure("3 wavelength relative time error")
ax = fig_3wavelength_time_err.add_subplot(111,projection='3d')
ax.set_xlabel('l1 [nm]')
ax.set_ylabel('l2 [nm]')
ax.set_zlabel('relative error [ps time error/ps link length]')
ax.plot_wireframe(l1, l2, time_err_relative)
"""
# =====================================================
# Output (some) alpha values in file
# =====================================================
alpha_file = open(name+".out","w")
alpha_file.write("file: " + insitu_file + "\n")
alpha_file.write("outlier-count: " + str(outlier_cnt) + "\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