Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Created on Thu Sep 26 17:19:41 2019
- @author: simon_evered
- """
- import numpy as np
- import cmath
- import matplotlib.pyplot as plt
- # Input beam polarization angle
- theta = 15 * 2*np.pi/360
- E0 = 1
- # Cavity parameters
- r1 = .98
- t1 = 1 - r1
- r = .9999**3 * .9
- def HC_error(phi = 0):
- E_par = E0 * np.cos(theta)
- E_perp = E0 * np.sin(theta)
- E_par_ref = E_par * (np.sqrt(r1) - t1*r*complex(np.cos(phi)-r, np.sin(phi))
- /(np.sqrt(r1)*(1-r)**2+4*r*np.sin(phi/2)**2))
- E_perp_ref = E_perp * np.sqrt(r1)
- Ia = abs(.5 * complex(E_par_ref,E_perp_ref))
- Ib = abs(.5 * complex(E_par_ref, -E_perp_ref))
- return Ia - Ib
- ## Plotting error as a function of phi ##
- phi = np.arange(-4*np.pi, 4*np.pi, 0.01)
- result = [HC_error(p) for p in phi]
- fig = plt.figure(figsize=(15,10))
- ax = fig.add_subplot(111)
- ax.set_xlabel('Phase offset', fontsize = '20')
- ax.set_ylabel('Error signal', fontsize = '20')
- lines = [ax.axvline(0, color='black'),ax.axvline(2*np.pi, color='black'),ax.axvline(-2*np.pi, color='black')]
- for l in lines: l.set_linestyle('dotted')
- plt.plot(phi, result)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement