Esempio n. 1
0
                output_ports.append(i + 1)

        return output_ports, output_fields


if __name__ == "__main__":

    import random

    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

    pulse = gaussian.Gaussian(peak_power=[10.0])

    lt = layout.Layout()

    arms = 3
    ratios = [round(random.uniform(0, 1), 2) for i in range(arms)]
    divider = IdealDivider(arms=arms, ratios=ratios, save=True)

    lt.link((pulse[0], divider[0]))

    lt.run(pulse)

    plot_titles = ([
        "Original pulse", "Pulses coming out of the {} with "
        "ratios {}".format(default_name, str(ratios))
    ])
Esempio n. 2
0
if __name__ == "__main__":

    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),
Esempio n. 3
0
    import numpy as np
    import optcom.utils.plot as plot
    import optcom.layout as layout
    import optcom.components.cw as cw
    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=5.0, memory_storage=1.0))
    nbr_ch_s = 3
    signal_width = [0.1, 0.2, 0.1]
    or_p = 1e-4
    pulse = gaussian.Gaussian(channels=nbr_ch_s,
                              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])
Esempio n. 4
0
    pde_methods = ["euler", "rk4"]

    nlse_methods = [
        "ssfm", "ssfm_reduced", "ssfm_symmetric", "ssfm_opti_reduced",
        "ssfm_super_sym", "ssfm_opti_super_sym", "rk4ip", "rk4ip"
    ]

    # ---------------- PDE solvers test --------------------------------

    # to do

    # ---------------- NLSE solvers test -------------------------------
    lt = layout.Layout()

    pulse = gaussian.Gaussian(channels=1, peak_power=[1.0])

    steps = int(10e3)
    for j, method in enumerate(nlse_methods):
        if (j == (len(nlse_methods) - 1)):
            nl_approx = False  # To compute rk4ip_gnlse
        else:
            nl_approx = True
        # Propagation
        fiber = Fiber(length=2.0,
                      method=method,
                      alpha=[0.046],
                      beta=[0.0, 1.0, -19.83, 0.031],
                      gamma=4.3,
                      nl_approx=nl_approx,
                      SPM=True,
Esempio n. 5
0
    lt = layout.Layout()

    chirps = [0.0, 1.0]
    phase_shifts = [cst.PI, lambda t: cst.PI / 2]
    fields = []

    plot_groups: List[int] = []
    plot_titles: List[str] = []
    plot_labels: List[str] = []

    count = 0
    for i, chirp in enumerate(chirps):
        for j, phase_shift in enumerate(phase_shifts):
            # Propagation
            pulse = gaussian.Gaussian(peak_power=[10.0], chirp=[chirp])
            mod = IdealPhaseMod(phase_shift=phase_shift)
            lt.link((pulse[0], mod[0]))
            lt.run(pulse)
            lt.reset()
            # Plot parameters and get waves
            fields.append(phase(pulse.fields[0].channels))
            fields.append(phase(mod.fields[1].channels))
            plot_groups += [count, count]
            count += 1
            plot_labels += ["Original pulse", "Exit pulse"]
            if (isinstance(phase_shift, float)):
                temp_phase = phase_shift
            else:
                temp_phase = phase_shift(0)
            plot_titles += [
Esempio n. 6
0
                    output_fields.append(fields[i] *
                                         math.sqrt(self._ratios[ports[i]]))

        return self.output_ports(ports), output_fields


if __name__ == "__main__":

    import optcom.utils.plot as plot
    import optcom.layout as layout
    import optcom.components.gaussian as gaussian
    import optcom.components.ideal_phase_mod as modulator
    import optcom.domain as domain
    from optcom.utils.utilities_user import temporal_power

    pulse_1 = gaussian.Gaussian(peak_power=[1.0], center_lambda=[1550.0])
    pulse_2 = gaussian.Gaussian(peak_power=[5.0], center_lambda=[1550.0])
    pulse_3 = gaussian.Gaussian(peak_power=[10.0], center_lambda=[976.0])
    # Dummy component to be able to test the not combining case
    pm = modulator.IdealPhaseMod()

    lt = layout.Layout()

    combiner = IdealCombiner(arms=3, combine=False, ratios=[2.0, 1.5, 0.5])

    lt.link((pulse_1[0], combiner[0]), (pulse_2[0], combiner[1]),
            (pulse_3[0], combiner[2]), (combiner[3], pm[0]))

    lt.run(pulse_1, pulse_2, pulse_3)

    plot_titles = ([
Esempio n. 7
0
if __name__ == "__main__":

    import random

    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
    from optcom.effects.coupling import Coupling

    lt = layout.Layout(domain.Domain(bit_width=1.0, samples_per_bit=1024))

    Lambda = 1030.0
    pulse_1 = gaussian.Gaussian(channels=1,
                                peak_power=[1.0, 0.5],
                                width=[.1],
                                center_lambda=[Lambda])
    pulse_2 = gaussian.Gaussian(channels=2,
                                peak_power=[1.0, 0.5],
                                width=[.1],
                                center_lambda=[1050.0])

    steps = int(1e3)
    alpha = [[0.046], [0.046]]
    beta = [[1e5, 10.0, -0.0], [1e5, 10.0, -0.0]]
    gamma = [4.3, 4.3]
    fitting_kappa = True
    V = [2.0]
    core_radius = [5.0]
    c2c_spacing = [[15.0]]
    n_0 = [1.02]