def make_spatial_modes(self, ): '''Generate the spatial modes of the network. ''' self.spatial_modes = spatial_modes(self.roots, self.M1, self.E, delays=self.delays) return
if y0 is None: y0 = np.asmatrix([0.]*num_of_variables).T r = ode(f).set_integrator('zvode', method='bdf') r.set_initial_value(y0, 0.) Y = [] while r.successful() and r.t < T: Y.append(C*r.y+D*a_in(r.t)) r.integrate(r.t+dt) return Y if __name__ == "__main__" and False: Ex = Time_Delay_Network.Example3(r1 = 0.9, r3 = 0.9, max_linewidth=15.,max_freq=25.) Ex.run_Potapov() modes = functions.spatial_modes(Ex.roots,Ex.M1,Ex.E) M = len(Ex.roots) A,B,C,D = Ex.get_Potapov_ABCD(doubled=False) A_d,B_d,C_d,D_d = Ex.get_Potapov_ABCD(doubled=True) ham = Hamiltonian.Hamiltonian(Ex.roots,modes,Ex.delays,Omega=-1j*A) ham.make_chi_nonlinearity(delay_indices=0,start_nonlin=0, length_nonlin=0.1,indices_of_refraction=1., chi_order=3,chi_function=None,) ham.make_H() eq_mot = ham.make_eq_motion() a_in = lambda t: np.asmatrix([1.]*np.shape(D_d)[-1]).T ## make a sample input function
import numpy as np import numpy.linalg as la import matplotlib.pyplot as plt def contour_plot(Mat): fig = plt.figure() ax = fig.add_subplot(111) cax = ax.matshow(abs(Mat), interpolation='nearest') fig.colorbar(cax) if __name__ == "__main__" and False: Ex = Time_Delay_Network.Example3(r1 = 0.999, r3 = 0.999) Ex.run_Potapov() E = Ex.E roots = Ex.roots M1 = Ex.M1 delays = Ex.delays modes = functions.spatial_modes(roots,M1,E) Mat = functions.make_normalized_inner_product_matrix(roots,modes,delays) contour_plot(Mat) print Ex.max_freq print Ex.max_linewidth print roots
import numpy.linalg as la import matplotlib.pyplot as plt def contour_plot(Mat): fig = plt.figure() ax = fig.add_subplot(111) cax = ax.matshow(abs(Mat), interpolation='nearest') fig.colorbar(cax) if __name__ == "__main__" and False: Ex = Time_Delay_Network.Example3(r1=0.999, r3=0.999) Ex.run_Potapov() E = Ex.E roots = Ex.roots M1 = Ex.M1 delays = Ex.delays modes = functions.spatial_modes(roots, M1, E) Mat = functions.make_normalized_inner_product_matrix(roots, modes, delays) contour_plot(Mat) print Ex.max_freq print Ex.max_linewidth print roots
def make_spatial_modes(self,): '''Generate the spatial modes of the network. ''' self.spatial_modes = spatial_modes(self.roots,self.M1,self.E,delays=self.delays) return