gssn_1: oc.Gaussian = oc.Gaussian(channels=1, width=[5.0], field_name='field 1 to be saved in file') field_saver_1: oc.SaveField = oc.SaveField() gssn_2: oc.Gaussian = oc.Gaussian(channels=1, width=[10.0], field_name='field 2 to be saved in file') field_saver_2: oc.SaveField = oc.SaveField() lt.add_links((gssn_1[0], field_saver_1[0]), (gssn_2[0], field_saver_2[0])) lt.run(gssn_1, gssn_2) fields: List[oc.Field] = field_saver_1.fields + field_saver_2.fields lt_: oc.Layout = oc.Layout() load_field: oc.LoadField = oc.LoadField(fields=fields) lt.run(load_field) fields = load_field[0].fields x_datas: List[np.ndarray] = [fields[0].time, fields[1].time, fields[0].nu, fields[1].nu] y_datas: List[np.ndarray] = [oc.temporal_power(fields[0].channels), oc.temporal_power(fields[1].channels), oc.spectral_power(fields[0].channels), oc.spectral_power(fields[1].channels)] oc.plot2d(x_datas, y_datas, x_labels=["t", "t", "nu","nu"], y_labels=["P_t", "P_t", "P_nu", "P_nu"], plot_titles=["Gaussian pulse which has been saved and loaded"], plot_groups=[0,0,1,1])
noise=100 * np.ones(domain.noise_samples)) filter: oc.GaussianFilter = oc.GaussianFilter(nu_bw=nu_bw, nu_offset=0., order=1, center_nu=center_nu) lt.add_link(pulse[0], filter[0]) lt.run(pulse) plot_titles: List[str] = [ "Original pulse", r"After Gaussian filter with " "frequency bandwidth {} THz.".format(round(nu_bw, 2)) ] plot_titles += plot_titles y_datas: List[np.ndarray] = [ oc.temporal_power(pulse[0][0].channels), oc.temporal_power(filter[1][0].channels), oc.spectral_power(pulse[0][0].channels), oc.spectral_power(filter[1][0].channels), pulse[0][0].noise, filter[1][0].noise ] x_datas: List[np.ndarray] = [ pulse[0][0].time, filter[1][0].time, pulse[0][0].nu, filter[1][0].nu, pulse[0][0].domain.noise_nu, filter[1][0].domain.noise_nu ] x_labels: List[str] = ['t', 't', 'nu', 'nu', 'nu', 'nu'] y_labels: List[str] = ['P_t', 'P_t', 'P_nu', 'P_nu', 'P (W)', 'P (W)'] nu_range = (center_nu - .1, center_nu + .1) time_range = (bit_width / 2. + 75., bit_width / 2. - 75.) noise_range = (x_datas[-1][0], x_datas[-1][-1]) x_ranges = [time_range, time_range, nu_range, nu_range, noise_range] oc.plot2d(x_datas,
rep_freq: List[float] = [0.03, 0.04] offset_nu: List[float] = [1.56, -1.6] chirp: List[float] = [0.5, 0.1] init_phi: List[float] = [1.0, 0.0] sech = oc.Sech(channels=channels, center_lambda=center_lambda, position=position, fwhm=width, peak_power=peak_power, rep_freq=rep_freq, offset_nu=offset_nu, chirp=chirp, init_phi=init_phi, save=True) lt.run(sech) x_datas: List[np.ndarray] = [sech[0][0].time, sech[0][0].nu] y_datas: List[np.ndarray] = [ oc.temporal_power(sech[0][0].channels), oc.spectral_power(sech[0][0].channels) ] oc.plot2d(x_datas, y_datas, x_labels=["t", "nu"], y_labels=["P_t", "P_nu"], plot_titles=["Sech pulse"], split=True)
cw: oc.CW = oc.CW(channels=channels, center_lambda=center_lambda, peak_power=peak_power, offset_nu=offset_nu, init_phi=init_phi, save=True) lt.run(cw) plot_titles: List[str] = [ "CW pulse temporal power", "CW pulse spectral power", "CW pulse temporal phase", "CW pulse spectral phase" ] x_datas: List[np.ndarray] = [ cw[0][0].time, cw[0][0].nu, cw[0][0].time, cw[0][0].nu ] y_datas: List[np.ndarray] = [ oc.temporal_power(cw[0][0].channels), oc.spectral_power(cw[0][0].channels), oc.temporal_phase(cw[0][0].channels), oc.spectral_phase(cw[0][0].channels) ] oc.plot2d(x_datas, y_datas, x_labels=["t", "nu", "t", "nu"], y_labels=["P_t", "P_nu", "phi_t", "phi_nu"], plot_titles=plot_titles, split=True, line_opacities=[0.2])
init_phi: List[float] = [1.0, 0.0] beta_2: List[float] = [-19.0, -17.0] gamma: List[float] = [4.3, 4.6] soli = oc.Soliton(channels=channels, center_lambda=center_lambda, position=position, width=width, rep_freq=rep_freq, offset_nu=offset_nu, order=order, init_phi=init_phi, beta_2=beta_2, gamma=gamma, save=True) lt.run(soli) x_datas: List[np.ndarray] = [soli[0][0].time, soli[0][0].nu] y_datas: List[np.ndarray] = [ oc.temporal_power(soli[0][0].channels), oc.spectral_power(soli[0][0].channels) ] oc.plot2d(x_datas, y_datas, x_labels=["t", "nu"], y_labels=["P_t", "P_nu"], plot_titles=["Soliton pulse"], split=True)
order: List[int] = [1, 2, 1] chirp: List[float] = [0.0, 0.5, 0.1] init_phi: List[float] = [0.0, 1.0, 0.0] gssn = oc.Gaussian(channels=channels, center_lambda=center_lambda, position=position, width=width, peak_power=peak_power, rep_freq=rep_freq, offset_nu=offset_nu, order=order, chirp=chirp, init_phi=init_phi, save=True) lt.run(gssn) x_datas: List[np.ndarray] = [gssn[0][0].time, gssn[0][0].nu] y_datas: List[np.ndarray] = [ oc.temporal_power(gssn[0][0].channels), oc.spectral_power(gssn[0][0].channels) ] oc.plot2d(x_datas, y_datas, x_labels=["t", "nu"], y_labels=["P_t", "P_nu"], plot_titles=["Gaussian pulse"], split=True)
STEP_UPDATE=False, save_all=True, INTRA_COMP_DELAY=True, INTRA_PORT_DELAY=False, INTER_PORT_DELAY=False, noise_ode_method='rk1', NOISE=True) lt.add_link(pulse[0], fiber[0]) lt.run(pulse) x_datas: List[np.ndarray] = [ pulse[0][0].nu, fiber[1][0].nu, pulse[0][0].time, fiber[1][0].time ] y_datas: List[np.ndarray] = [ oc.spectral_power(pulse[0][0].channels), oc.spectral_power(fiber[1][0].channels), oc.temporal_power(pulse[0][0].channels), oc.temporal_power(fiber[1][0].channels) ] x_labels: List[str] = ['nu', 'nu', 't', 't'] y_labels: List[str] = ['P_nu', 'P_nu', 'P_t', 'P_t'] plot_titles: List[str] = [ "Original Pulses", "Pulses at the end of the fiber" ] plot_titles.extend(plot_titles) oc.plot2d(x_datas, y_datas, x_labels=x_labels,