pychi package

pychi.light module

Created on Fri Aug 13 12:01:48 2021

@author: Thibault

This module contains the classes used to instantiate light. Different standard pulse shapes are built-in, and a class is dedicated to accomodating user-provided light with arbitrary spectral shape. Note that the electric field is stored as an analytical envelope, thus is a complex quantity.

class pychi.light.Arbitrary(waveguide, pulse_frequency_axis, pulse_electric_field, pulse_energy)[source]

Bases: Light

Class for arbitrary light waveform, specified in frequency domain.

class pychi.light.Cw(waveguide, average_power, wavelength)[source]

Bases: Light

Class for CW light.

class pychi.light.Gaussian(waveguide, pulse_duration, pulse_energy, pulse_wavelength, delay=0)[source]

Bases: Light

Class for a Gaussian pulse.

class pychi.light.Light(waveguide, field_t_in)[source]

Bases: object

Parent light class. Implement support for adding pulses, saving the results of a propagation and plotting these results. Not suitable for light instantiation.

add_shot_noise(seed=None)[source]

Add shot noise to the pulse, useful for coherence study.

Parameters:

seed (int) – Seed for the random number generator for reproducibility.

plot_propagation(savename=None)[source]

Plot propagation results.

set_result_as_start()[source]

Set output field from propagation as initial field for a new propagation.

Returns:

New Light object with final propagation result as input field.

Return type:

Light

class pychi.light.Sech(waveguide, pulse_duration, pulse_energy, pulse_wavelength, delay=0)[source]

Bases: Light

Class for a sech pulse.

pychi.materials module

class pychi.materials.Waveguide(frequency, n_eff, chi_2, chi_3, effective_area, length, raman_fraction=0.18, raman_tau_1=1.22e-14, raman_tau_2=3.2e-14, t_pts=16384)[source]

Bases: object

Waveguide class. Contains all material related information, i.e. the refractive index curve versus frequency, the Raman parameters, the nonlinear coefficients, the effective area and length. This object should be the first object instantiated, as the time/frequency axes of the simulation are derived here from the available refractive index data.

Parameters:
  • frequency (array) – Frequency axis on which the effective refractive index is given.

  • n_eff (float, vector, array or callable) – Effective refractive index of the material.

  • chi_2 (float, vector, array or callable) – Order 2 material nonlinearity.

  • chi_3 (float, vector, array or callable) – Order 3 material nonlinearity.

  • effective_area (float) – Effective area at the pump wavelength.

  • length (float) – Length of the material.

  • raman_fraction (float) – Fractional contribution of the Raman effect to the Kerr effect. The default is 0.18.

  • raman_tau_1 (float) – Raman effect primary time scale. The default is 0.0122e-12.

  • raman_tau_2 (float) – Raman effect secondary time scale. The default is 0.032e-12.

  • t_pts (float, optional) – Number of points in the time and frequency axes, will be rounded to nearest higher power of 2. The default is 2**14.

property chi_2

Get the quadratic nonlinear coefficient at position z.

property chi_3

Get the cubic nonlinear coefficient at position z.

compute_betas(wavelength=None, order=6)[source]

Compute beta coefficients at a given wavelength and order.

Parameters:
  • wavelength (float, optional) – Wavelength at which the beta coefficients are computed. The default is the center of the simulation axis.

  • order (int, optional) – Highest order of the beta coefficients to be computed. The default is 6.

Returns:

beta – Beta coefficients of the material at the given wavelength.

Return type:

array

property k

Get the wavevectors at position z.

property n_eff

Get the effective refractive index at position z.

plot_refractive_index(savename=None)[source]

Plot refractive index

property rhs_prefactor

Get the GNLSE right-hand-side prefactor at position z.

set_betas(betas, wavelength)[source]

Convenience only. Allow the use to provide the beta coefficients instead of n_eff. Should be avoided.

set_gamma(gamma, wavelength=None)[source]

Convenience only. Allow the user to give the nonlinear coefficient instead of chi3. Overwrite the initialized chi3 value accordingly.

Parameters:

gamma (float) – Nonlinear coefficient.

set_n2(n2, wavelength=None)[source]

Convenience only. Allow the user to give the nonlinear index instead of chi3. Overwrite the initialized chi3 value accordingly.

Parameters:

n2 (float) – Nonlinear index.

pychi.models module

Created on Fri Feb 18 17:24:21 2022

@author: voumardt

class pychi.models.Chi2(waveguide, light)[source]

Bases: Model

Sum frequency generation and difference frequency generation only physical model.

nonlinear_term(field_f)[source]

Nonlinear function with chi 2

Parameters:

field_f (array) – Analytical envelope of the electric field in frequency domain.

Returns:

Nonlinear evolution term.

Return type:

array

class pychi.models.Chi2Chi3(waveguide, light)[source]

Bases: Model

Triple-sum, sum and difference frequency generation physical model.

nonlinear_term(field_f)[source]

Nonlinear function with chi 2 and chi 3

Parameters:

field_f (array) – Analytical envelope of the electric field in frequency domain.

Returns:

Nonlinear evolution term.

Return type:

array

class pychi.models.Chi3(waveguide, light)[source]

Bases: Model

Triple sum-frequency physical model.

nonlinear_term(field_f)[source]

Nonlinear function with spm and chi 3

Parameters:

field_f (array) – Analytical envelope of the electric field in frequency domain.

Returns:

Nonlinear evolution term.

Return type:

array

class pychi.models.Model(waveguide, light)[source]

Bases: object

Parent class for the different nonlinear Schrödinger equations. Provide general utility, optimization and setup functions for the physics happening in the child classes.

dispersion_step(field, dz)[source]

Compute dispersion step with field in frequency domain.

Parameters:
  • field (array) – Field in frequency domain.

  • dz (float) – Step size.

Returns:

Dispersion affected field in frequency domain.

Return type:

array

nonlinear_term(field)[source]

Nonlinear term, implemented in child classes for different interaction types.

class pychi.models.Spm(waveguide, light)[source]

Bases: Model

Self phase modulation only physical model.

nonlinear_term(field_f)[source]

Nonlinear function with spm

Parameters:

field_f (array) – Analytical envelope of the electric field in frequency domain.

Returns:

Nonlinear evolution term.

Return type:

array

class pychi.models.SpmChi2(waveguide, light)[source]

Bases: Model

Self phase modulation, sum and difference frequency generation physical model.

nonlinear_term(field_f)[source]

Nonlinear function with spm and chi 2

Parameters:

field_f (array) – Analytical envelope of the electric field in frequency domain.

Returns:

Nonlinear evolution term.

Return type:

array

class pychi.models.SpmChi2Chi3(waveguide, light)[source]

Bases: Model

Self phase modulation, triple harmonic, sum and difference frequency generation physical model.

nonlinear_term(field_f)[source]

Nonlinear function with spm, chi 2 and chi 3

Parameters:

field_f (array) – Analytical envelope of the electric field in frequency domain.

Returns:

Nonlinear evolution term.

Return type:

array

class pychi.models.SpmChi3(waveguide, light)[source]

Bases: Model

Self phase modulation and triple harmonic physical model.

nonlinear_term(field_f)[source]

Nonlinear function with spm and chi 3

Parameters:

field_f (array) – Analytical envelope of the electric field in frequency domain.

Returns:

Nonlinear evolution term.

Return type:

array

pychi.models.numbaabs2(x)

Compute numba optimized absolute norm square of input vector.

pychi.models.numbaconj(x)

Compute numba optimized complex conjugate of a vector.

pychi.models.numbacopy(x)

Create a numba optimized copy of a vector.

pychi.models.numbaexp(x)

Compute numba optimized exponential of input vector.

pychi.models.numbasht(x, y)

Compute numba optimized sh term.

pychi.models.numbathg(x, y)

Compute numba optimized th term.

pychi.solvers module

Created on Fri Feb 18 17:54:20 2022

@author: voumardt

class pychi.solvers.Solver(model, z_pts=500, local_error=1e-05, adaptive_factor=1.1, max_dz=None, method=None, breakpoints=[])[source]

Bases: object

plot_stepsize()[source]

Plot the evolution of the stepsize against the position in the waveguide

solve()[source]

Integrate over waveguide length with adaptive step size

pychi.solvers.numbaexp(x)
pychi.solvers.numbanorm(field)