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:
LightClass for arbitrary light waveform, specified in frequency domain.
- class pychi.light.Cw(waveguide, average_power, wavelength)[source]
Bases:
LightClass for CW light.
- class pychi.light.Gaussian(waveguide, pulse_duration, pulse_energy, pulse_wavelength, delay=0)[source]
Bases:
LightClass for a Gaussian pulse.
- class pychi.light.Light(waveguide, field_t_in)[source]
Bases:
objectParent light class. Implement support for adding pulses, saving the results of a propagation and plotting these results. Not suitable for light instantiation.
- add_group_delay_dispersion(d2)[source]
Add group delay dispersion (chirp) to the light field.
- Parameters:
d2 (float) – Group delay dispersion
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:
objectWaveguide 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 eff_area
Get the effective area at position z.
- property k
Get the wavevectors at position z.
- property n_eff
Get the effective refractive index at position z.
- 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.
pychi.models module
Created on Fri Feb 18 17:24:21 2022
@author: voumardt
- class pychi.models.Chi2(waveguide, light)[source]
Bases:
ModelSum frequency generation and difference frequency generation only physical model.
- class pychi.models.Chi2Chi3(waveguide, light)[source]
Bases:
ModelTriple-sum, sum and difference frequency generation physical model.
- class pychi.models.Chi3(waveguide, light)[source]
Bases:
ModelTriple sum-frequency physical model.
- class pychi.models.Model(waveguide, light)[source]
Bases:
objectParent class for the different nonlinear Schrödinger equations. Provide general utility, optimization and setup functions for the physics happening in the child classes.
- class pychi.models.Spm(waveguide, light)[source]
Bases:
ModelSelf phase modulation only physical model.
- class pychi.models.SpmChi2(waveguide, light)[source]
Bases:
ModelSelf phase modulation, sum and difference frequency generation physical model.
- class pychi.models.SpmChi2Chi3(waveguide, light)[source]
Bases:
ModelSelf phase modulation, triple harmonic, sum and difference frequency generation physical model.
- class pychi.models.SpmChi3(waveguide, light)[source]
Bases:
ModelSelf phase modulation and triple harmonic physical model.
- 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
- pychi.solvers.numbaexp(x)
- pychi.solvers.numbanorm(field)
pychi.utils module
Created on Tue Jul 15 09:42:48 2025
@author: Thibault Voumard
This module contains utility functions that either make sense to keep out of other modules or are annoying to implement otherwise, although could be at a later stage.
- pychi.utils.betas_from_dispersion(wavelength, n, disp=0, disp_slope=0)[source]
Compute the corresponding set of betas from typical dispersion values provided by fiber manufacturers. Should eventually belong to waveguide module.
- Parameters:
wavelength (float) – Wavelength at which the dispersion is specified.
n (float) – Refractive index at the specified wavelength.
disp (float, optional) – Dispersion at the specified wavelength. Default is 0.
disp_slope (float, optional) – Dispersion slope at the specified wavelength. Default is 0.
- Returns:
Beta coefficients corresponding to the given dispersion.
- Return type:
list
- pychi.utils.betas_from_dispersion_non_SI(wavelength, n, disp=0, disp_slope=0)[source]
Compute the corresponding set of betas from typical dispersion values provided by fiber manufacturers in their non SI but more common units, i.e. ps/(nm km) and ps/(nm**2 km). Should eventually belong to waveguide module.
- Parameters:
wavelength (float) – Wavelength at which the dispersion is specified.
n (float) – Refractive index at the specified wavelength.
disp (float, optional) – Dispersion at the specified wavelength, in ps/(nm km). Default is 0.
disp_slope (float, optional) – Dispersion slope at the specified wavelength, in ps/(nm**2 km). Default is 0.
- Returns:
Beta coefficients corresponding to the given dispersion.
- Return type:
list
- pychi.utils.n_eff_from_betas(freq, wavelength, betas)[source]
Compute the effective refractive index from a set of beta coefficients. Should eventually belong to waveguide module.
- Parameters:
freq (array of float) – Frequency axis over which the refractive index will be defined.
wavelength (float) – Wavelength at which the beta coefficients are defined.
betas (list of float) – List of the beta coefficients.
- Returns:
n_eff – Effective refractive indices computed from the beta coefficients.
- Return type:
array of float