import sys import numpy as np from scipy import interpolate import optcom.utils.plot as plot import optcom.layout as layout import optcom.components.gaussian as gaussian import optcom.domain as domain from optcom.utils.utilities_user import temporal_power, spectral_power,\ CSVFit lt = layout.Layout(domain.Domain(samples_per_bit=512,bit_width=20.0)) pulse = gaussian.Gaussian(channels=2, peak_power=[10.0, 10e-1], width=[1.0, 5.0], center_lambda=[1050.0, 1048.0]) gamma_data = CSVFit('./data/gamma_test.txt') fiber = Fiber(length=.10, method="ssfm_symmetric", alpha=[0.046], alpha_order=4, beta_order=4, gamma=1.5, nl_approx=False, ATT=True, DISP=True, SPM=True, XPM=False, SS=False, RS=False, approx_type=1, steps=1000, medium='sio2') lt.link((pulse[0], fiber[0])) lt.run(pulse) x_datas = [pulse.fields[0].nu, fiber.fields[1].nu, pulse.fields[0].time, fiber.fields[1].time] y_datas = [spectral_power(pulse.fields[0].channels), spectral_power(fiber.fields[1].channels), temporal_power(pulse.fields[0].channels), temporal_power(fiber.fields[1].channels)]
nbr_samples) omegas = Domain.omega_to_lambda(lambdas) absorp = Absorption(dopant=dopant) sigmas = absorp.get_cross_section(omegas) x_data.append(lambdas) y_data.append(sigmas) dopant_name = dopant[0].upper() + dopant[1:] plot_titles.append( 'Cross sections {} from formula'.format(dopant_name)) for i, file in enumerate(files): nbr_samples = 1000 lambdas = np.linspace(file_range[i][0], file_range[i][1], nbr_samples) omegas = Domain.omega_to_lambda(lambdas) file_name = folder + file + '.txt' predict = CSVFit(file_name=file_name, conv_factor=[1e9, 1e18]) # in nm absorp = Absorption(predict=predict) sigmas = absorp.get_cross_section(omegas) x_data.append(lambdas) y_data.append(sigmas) dopant_name = file[0].upper() + file[1:] plot_titles.append( 'Absorption cross sections {} from data file'.format(dopant_name)) plot.plot(x_data, y_data, x_labels=['Lambda'], y_labels=['sigma_a'], split=True, plot_colors='red', plot_titles=plot_titles,
peak_power=[1.6 * or_p, 1.3 * or_p, 1.2 * or_p], width=signal_width, center_lambda=[1030.0, 1025.0, 1019.0]) nbr_ch_p = 2 #pump = gaussian.Gaussian(channels=nbr_ch_p, peak_power=[45.0, 35.0], # center_lambda=[940.0, 977.0], width=[7.0, 6.0]) pump = cw.CW(channels=nbr_ch_p, peak_power=[4 * or_p, 3 * or_p], center_lambda=[976.0, 940.0]) steps = 500 length = 0.0005 # km file_sigma_a = ('./data/fiber_amp/cross_section/absorption/yb.txt') file_sigma_e = ('./data/fiber_amp/cross_section/emission/yb.txt') sigma_a = CSVFit(file_sigma_a, conv_factor=[1e9, 1e18]) sigma_e = CSVFit(file_sigma_e, conv_factor=[1e9, 1e18]) #sigma_a = [3e-8, 2e-6] #sigma_e = [2e-7, 1e-6] #sigma_e = None n_core = None n_clad = None NA = 0.2 r_core = 5.0 # um r_clad = 62.5 # um temperature = 293.15 # K tau_meta = 840.0 # us N_T = 6.3e-2 # nm^{-3} eta_s = 1.26 # km^-1 eta_p = 1.41 # km^-1 R_0 = 8e-4