Skip to content

Instantly share code, notes, and snippets.

@DanHickstein
Created January 12, 2018 17:51
Show Gist options
  • Save DanHickstein/b26ae4106ab834898102ea063b5b0230 to your computer and use it in GitHub Desktop.
Save DanHickstein/b26ae4106ab834898102ea063b5b0230 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
from pynlo.devices.grating_compressor import TreacyCompressor as tc
import pynlo
l_mm = 940
angle = 47.5
comp = tc(l_mm,angle)
theta = comp.calc_theta(1550, display_angle=True)
separation = np.linspace(0.0,0.05,500)
gdd = comp.calc_compressor_gdd(1550,separation)
tod = comp.calc_compressor_HOD(1550,separation, 3)
fig,axs = plt.subplots(2,1,figsize=(8,9))
# axs[0].plot(1e3*separation, -0.2509*separation*100,color='r')
# axs[0].plot(1e3*separation,gdd*1e24*np.cos(47.0*np.pi/180.) )
axs[0].plot(1e3*separation,gdd*1e24 )
axs[1].plot(1e3*separation,tod*1e36)
axs[0].axhline(-0.051, alpha=0.3, color='r', label= '20 m of -2 ps/nm/km fiber')
axs[0].axhline(-0.51, alpha=0.3, color='b', label='200 m of -2 ps/nm/km fiber')
axs[0].set_xlabel('Grating separation (mm)')
axs[0].set_ylabel('Group delay dispersion (ps^2)')
axs[1].set_xlabel('Grating separation (mm)')
axs[1].set_ylabel('Third order dispersion (ps^3)')
axs[0].legend(fontsize=10)
axs[0].set_title('Compressor dispersion for %.0f lines/mm and angle = %.1f degrees'%(l_mm, angle))
plt.savefig('Compressor GDD and TOD.png', dpi=200)
fig,axs = plt.subplots(3,1,figsize=(8,9))
GDD = 0.0 # Group delay dispersion (ps^2)
TOD = 0.0 # Third order dispersion (ps^3)
Points = 2**14 # simulation points
for ax, pulse_ps in zip(axs, (0.02,0.05,.1)):
# count=4
# ax.set_color_cycle([plt.cm.bwr(i) for i in np.linspace(0,0.95,count)])
for GDD in np.linspace(0,0.01,4):
pulse = pynlo.light.DerivedPulses.SechPulse(1, pulse_ps, 1550, time_window_ps=10,
GDD=GDD, TOD=TOD, NPTS=Points, frep_MHz=100, power_is_avg=False)
ax.plot(pulse.T_ps, np.abs(pulse.AT), label='GDD = %.3f ps^3'%(GDD))
ax.legend(frameon=False, fontsize=10)
ax.set_ylim(-0.2,1.2)
ax.set_xlim(-2,2)
ax.set_title('%.0f fs'%(pulse_ps*1e3), y=0.8, x=0.1, weight='bold')
ax.set_ylabel('Envelope intensity (arb unbits)')
axs[-1].set_xlabel('Time (ps)')
plt.savefig('Effect of TOD.png', dpi=200)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment