Ejemplo n.º 1
0
if __name__ == "__main__":
    """Plot the refractive index as a function of the wavelength.
    This piece of code is standalone, i.e. can be used in a separate
    file as an example.
    """

    from typing import List

    import numpy as np

    import optcom as oc
    import optcom.utils.constants as cst

    medium: str = "sio2"
    sellmeier: oc.Sellmeier = oc.Sellmeier(medium)
    # With float
    omega: float = oc.lambda_to_omega(1550.0)
    print(sellmeier(omega))
    sellmeier = oc.Sellmeier(medium, cst.FIBER_CORE_DOPANT,
                             cst.CORE_DOPANT_CONCENT)
    n_core: float = sellmeier(omega)
    sellmeier = oc.Sellmeier(medium, cst.FIBER_CLAD_DOPANT,
                             cst.CLAD_DOPANT_CONCENT)
    n_clad: float = sellmeier(omega)
    print(n_core, n_clad, oc.NumericalAperture.calc_NA(n_core, n_clad))
    # With np.ndarray
    lambdas: np.ndarray = np.linspace(120., 2120., 2000)
    omegas: np.ndarray = oc.lambda_to_omega(lambdas)
    sellmeier = oc.Sellmeier(medium)
    res: List[np.ndarray] = [sellmeier(omegas)]
Ejemplo n.º 2
0
if __name__ == "__main__":
    """Plot the coupling coefficient as a function of the wavelength.
    This piece of code is standalone, i.e. can be used in a separate
    file as an example.
    """

    from typing import List

    import numpy as np

    import optcom as oc

    v_nbr: float = 2.0
    a: float = 5.0
    d: float = 15.0
    ref_index: oc.Sellmeier = oc.Sellmeier(medium='sio2')
    norm_d: float = d / a
    cpl: oc.CouplingCoeff = oc.CouplingCoeff(v_nbr, a, d, ref_index)
    # With float
    Lambda: float = 1550.0
    omega: float = oc.lambda_to_omega(Lambda)
    print(cpl(omega))
    # With np.ndarray
    Lambdas: np.ndarray = np.linspace(900, 1600, 3)
    omegas: np.ndarray = oc.lambda_to_omega(Lambdas)
    print(cpl(omegas))
    Lambdas = np.linspace(900, 1600, 1000)
    omegas = oc.lambda_to_omega(Lambdas)
    kappas: np.ndarray = cpl(omegas)

    plot_titles: List[str] = [
Ejemplo n.º 3
0
    file as an example.
    """

    from typing import List

    import numpy as np

    import optcom as oc

    medium: str = "sio2"
    dopant: str = "yb"
    A_doped: float = oc.PI * 25.0
    # With float
    omega: float = oc.lambda_to_omega(1000)
    core_radius: float = 5.0
    sellmeier: oc.Sellmeier = oc.Sellmeier(medium)
    n_clad: float = 1.44
    NA_inst: oc.NumericalAperture = oc.NumericalAperture(sellmeier, n_clad)
    v_nbr_inst: oc.VNumber = oc.VNumber(NA_inst, core_radius)
    A_eff_inst: oc.EffectiveArea = oc.EffectiveArea(v_nbr_inst, core_radius)
    sigma_a_inst: oc.AbsorptionSection = oc.AbsorptionSection(dopant, medium)
    of_inst: oc.OverlapFactor = oc.OverlapFactor(A_eff_inst, A_doped)
    N: float = 0.01
    gain: oc.DopedFiberGain = oc.DopedFiberGain(sigma_a_inst, of_inst, N)
    print(gain(omega))
    sigma_a: float = sigma_a_inst(omega)
    of: float = of_inst(omega)
    print(oc.DopedFiberGain.calc_doped_fiber_gain(sigma_a, of, N))
    # With np.ndarray
    N_0 = 0.01
    N_1 = 0.011
Ejemplo n.º 4
0
if __name__ == "__main__":
    """Plot the asymmetry coefficient as a function of the wavelength.
    This piece of code is standalone, i.e. can be used in a separate
    file as an example.
    """

    from typing import List

    import numpy as np

    import optcom as oc
    import optcom.utils.constants as cst

    # With float
    omega: float = oc.lambda_to_omega(1550.0)
    sellmeier: oc.Sellmeier = oc.Sellmeier("sio2", cst.FIBER_CORE_DOPANT,
                                           cst.CORE_DOPANT_CONCENT)
    n_core: float = sellmeier(omega)
    sellmeier = oc.Sellmeier("sio2", cst.FIBER_CLAD_DOPANT,
                             cst.CLAD_DOPANT_CONCENT)
    n_clad: float = sellmeier(omega)
    disp_1: oc.ChromaticDisp = oc.ChromaticDisp(ref_index=n_core)
    disp_2: oc.ChromaticDisp = oc.ChromaticDisp(ref_index=n_clad)
    asym: oc.AsymmetryCoeff = oc.AsymmetryCoeff(disp_1, disp_2)
    beta_1: float = disp_1(omega)[0]
    beta_2: float = disp_2(omega)[0]
    print('betas: ', beta_1, ' and ', beta_2)
    print(asym(omega))
    print(oc.AsymmetryCoeff.calc_delta(beta_1, beta_2))
    # With np.ndarray
    lambdas: np.ndarray = np.linspace(900., 1550., 1000)
    omegas: np.ndarray = oc.lambda_to_omega(lambdas)
Ejemplo n.º 5
0
    from typing import List

    import numpy as np

    import optcom as oc

    medium: str = "sio2"
    dopant: str = "yb"
    A_doped: float = oc.PI * 25.0  # um^2
    A_core: float = A_doped  # um^2
    P_pump: float = 0.001  # W
    tau: float = 840.0  # us
    # With float
    omega: float = oc.lambda_to_omega(1000)
    core_radius: float = 5.0  # um
    n_core: oc.Sellmeier = oc.Sellmeier(medium)
    n_clad: float = 1.44
    NA_inst: oc.NumericalAperture = oc.NumericalAperture(n_core, n_clad)
    v_nbr_inst: oc.VNumber = oc.VNumber(NA_inst, core_radius)
    A_eff_inst: oc.EffectiveArea = oc.EffectiveArea(v_nbr_inst, core_radius)
    of_inst: oc.OverlapFactor = oc.OverlapFactor(A_eff_inst, A_doped)
    sigma_a_inst: oc.AbsorptionSection = oc.AbsorptionSection(dopant=dopant,
                                                              medium=medium)
    T: float = 293.1  # K
    sigma_e_inst: oc.EmissionSection = oc.EmissionSection(dopant=dopant,
                                                          medium=medium,
                                                          T=T,
                                                          sigma_a=sigma_a_inst)
    recov_t: oc.FiberRecoveryTime = oc.FiberRecoveryTime(
        A_core, sigma_a_inst, sigma_e_inst, of_inst, P_pump, tau)
    print(recov_t(omega))
Ejemplo n.º 6
0
    import optcom as oc

    # With float
    n_0: float = 1.43  #
    N: float = 0.03  # nm^-3
    omega: float = oc.lambda_to_omega(1050.0)
    resonant: oc.ResonantIndex = oc.ResonantIndex("yb", n_0, N)
    print(resonant(omega))
    # With np.ndarray
    lambdas: np.ndarray = np.linspace(500., 1500., 1000)
    omegas: np.ndarray = oc.lambda_to_omega(lambdas)
    delta_n: np.ndarray = resonant(omegas)
    delta_n_data: List[np.ndarray] = [delta_n]
    x_labels: List[str] = ['Lambda']
    y_labels: List[str] = ['Index change']
    plot_titles: List[str] = ["Resonant index change with constant n_0 = {} "
                              "(pumped)".format(n_0)]
    sellmeier: oc.Sellmeier = oc.Sellmeier("siO2")
    resonant = oc.ResonantIndex("yb", sellmeier, N)
    delta_n = resonant(omegas)
    delta_n_data.append(delta_n)
    x_labels.append('Lambda')
    y_labels.append('Index change')
    plot_titles.append("Resonant index change with n_0 from Silica Sellmeier "
                       "equations. (pumped)")

    oc.plot2d([lambdas, lambdas], delta_n_data, x_labels=x_labels,
              y_labels=y_labels, plot_titles=plot_titles, split=True,
              line_opacities=[0.0])
Ejemplo n.º 7
0
    """Plot the effective area as a function of the wavelength.
    This piece of code is standalone, i.e. can be used in a separate
    file as an example.
    """

    from typing import List

    import numpy as np

    import optcom as oc

    # With float
    omega: float = oc.lambda_to_omega(1552.0)
    core_radius: float = 5.0
    n_clad: float = 1.44
    sellmeier: oc.Sellmeier = oc.Sellmeier("sio2")
    NA_inst: oc.NumericalAperture = oc.NumericalAperture(sellmeier, n_clad)
    v_nbr_inst: oc.VNumber = oc.VNumber(NA_inst, core_radius)
    eff_area: oc.EffectiveArea = oc.EffectiveArea(v_nbr_inst, core_radius)
    print(eff_area(omega))
    v_nbr: float = v_nbr_inst(omega)
    eff_area = oc.EffectiveArea(v_nbr, core_radius)
    print(eff_area(omega))
    # With numpy ndarray
    lambdas: np.ndarray = np.linspace(900, 1550, 100)
    omegas: np.ndarray = oc.lambda_to_omega(lambdas)
    eff_area = oc.EffectiveArea(v_nbr_inst, core_radius)
    res: np.ndarray = eff_area(omegas)
    x_labels: List[str] = ['Lambda']
    y_labels: List[str] = [r'Effective Area, $\,\mu m^2$']
    plot_titles: List[str] = [