Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Thu Sep 26 17:19:41 2019
  5.  
  6. @author: simon_evered
  7. """
  8. import numpy as np
  9. import cmath
  10. import matplotlib.pyplot as plt
  11.  
  12.  
  13. # Input beam polarization angle
  14. theta = 15 * 2*np.pi/360
  15. E0 = 1
  16.  
  17. # Cavity parameters
  18. r1 = .98
  19. t1 = 1 - r1
  20. r = .9999**3 * .9
  21.  
  22. def HC_error(phi = 0):
  23. E_par = E0 * np.cos(theta)
  24. E_perp = E0 * np.sin(theta)
  25.  
  26. E_par_ref = E_par * (np.sqrt(r1) - t1*r*complex(np.cos(phi)-r, np.sin(phi))
  27. /(np.sqrt(r1)*(1-r)**2+4*r*np.sin(phi/2)**2))
  28. E_perp_ref = E_perp * np.sqrt(r1)
  29.  
  30. Ia = abs(.5 * complex(E_par_ref,E_perp_ref))
  31. Ib = abs(.5 * complex(E_par_ref, -E_perp_ref))
  32. return Ia - Ib
  33.  
  34.  
  35. ## Plotting error as a function of phi ##
  36. phi = np.arange(-4*np.pi, 4*np.pi, 0.01)
  37. result = [HC_error(p) for p in phi]
  38.  
  39. fig = plt.figure(figsize=(15,10))
  40. ax = fig.add_subplot(111)
  41. ax.set_xlabel('Phase offset', fontsize = '20')
  42. ax.set_ylabel('Error signal', fontsize = '20')
  43. lines = [ax.axvline(0, color='black'),ax.axvline(2*np.pi, color='black'),ax.axvline(-2*np.pi, color='black')]
  44. for l in lines: l.set_linestyle('dotted')
  45. plt.plot(phi, result)
  46. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement