Package: pychi
pychiA Python package for simulating the propagation of optical pulses in nonlinear materials.Capabilitiespychiis aimed at simulating the propagation of short pulses in nonlinear media and capturing as much physics as possible. It is based on a unidirectional propagation model, which stays valid even for sub-cycle optical pulses. In particular, this propagation model accounts forFull frequency dependence of the effective refractive indexQuadratic nonlinear interactions (sum- and difference-frequency generation)Cubic nonlinear interactions (triple sum-frequency generation, self-phase modulation, conjugated Kerr term)Raman scatteringSelf-steepeningFrequency-dependence of the nonlinear coefficientsz-dependence of the effective refractive index and nonlinear coefficients (permitting poling to be simulated)The package is built to be as user-friendly as possible, providing a relatively high-level interface for the user while still allowing for physically intricate simulation cases. It leverages a custom-made order 5 solver, although more classical solvers (such as the RK4IP) have also been implemented for completeness and versatility.InstallationFirst, make sure pip is up-to-date usingpip install --upgrade pipOn Windows, install the package usingpip install pychiOn Mac, one might have to first runconda install -c conda-forge pyfftwdue to some OS specificities in pyFFTW installation.Then, one should be able to install pychi normally usingpip install pychiDocumentationThe documentation is available and best viewed underhttps://pychi.readthedocs.io/en/latest/This documentation has been automatically generated using SPHINX, and is still a work in progress. Do not hesitate to contact us for any needed clarifications and examples.ExampleHere is a typical example of the use of pychi to simulate the propagation of a short optical pulse in a nonlinear waveguide exhibiting both cubic and quadratic nonlinearities.# -*- coding: utf-8 -*-"""Created on Mon Feb 28 15:31:47 2022The waveguide/fiber parameters are first provided, and a Waveguide instanceis created. Then, the pulse parameters are used to create a Light object.A physical model is then chosen, taking into account different nonlinearinteractions based on the user choice. Finally, a solver is instantiatedand computes the propagation of the pulse in the waveguide with the chosennonlinear interactions.@author: voumardt"""importmatplotlib.pyplotaspltimportnumpyasnpfromscipy.constantsimportcimportpychi"""User parameters"""### Simulationt_pts=2**15### Lightpulse_duration=100e-15pulse_wavelength=1.56e-06pulse_energy=1e-9### Waveguidewg_length=0.001wg_chi_2=1.1e-12wg_chi_3=3.4e-21wg_a_eff=1e-12wg_freq,wg_n_eff=np.load('effective_index.npy')# wg_n_eff is the effective dispersion of the waveguide considered, sampled on the grid wg_freq"""Nonlinear propagation"""### Prepare waveguidewaveguide=pychi.materials.Waveguide(wg_freq,wg_n_eff,wg_chi_2,wg_chi_3,wg_a_eff,wg_length,t_pts=t_pts)# Additional options:# wg_n_eff can be a 2 dimensional array, with first dimension the wavelength dependence# and second dimension the z dependence.## chi2 and chi3 can be callables, returning a z dependent value. Alternatively, they# can be defined as one dimensional arrays describing their z dependence, or# two dimensional arrays describing their z and frequency dependence. They# can also be callables of (z, freq).## One can use waveguide.set_gamma(gamma) or waveguide.set_n2(n2) to provide a# nonlinear coefficient or nonlinear refractive index and overwrite chi3.## Check documentation for more options and details.### Prepare input pulsepulse=pychi.light.Sech(waveguide,pulse_duration,pulse_energy,pulse_wavelength)# Other available pulse shapes:# pulse = pychi.light.Gaussian(waveguide, pulse_duration, pulse_energy, pulse_wavelength)# pulse = pychi.light.Cw(waveguide, pulse_average_power, pulse_wavelength)# pulse = pychi.light.Arbitrary(waveguide, pulse_frequency_axis, pulse_electric_field, pulse_energy)### Prepare modelmodel=pychi.models.SpmChi2Chi3(waveguide,pulse)# Other models available:# model = pychi.models.Spm(waveguide, pulse)# model = pychi.models.Chi2(waveguide, pulse)# model = pychi.models.Chi3(waveguide, pulse)# model = pychi.models.SpmChi2(waveguide, pulse)# model = pychi.models.SpmChi3(waveguide, pulse)# model = pychi.models.Chi2Chi3(waveguide, pulse)### Prepare solver, solvesolver=pychi.solvers.Solver(model)solver.solve()"""Plots"""pulse.plot_propagation()# Results can also be accessed via pulse.z_save, pulse.freq, pulse.spectrum, pulse.waveform# The refractive index and GVD can be seen with waveguide.plot_refractive_index()Typical propagation results using the above script would look as follows:Check the examples folder for some specific cases and validation against experimental data.Contactpychi has been developped at DESY by the Ultrafast Microphotonics group. If you use it for publications, please cite the associated paperhttps://doi.org/10.1063/5.0135252If you have any questions, remarks, contributions, do not hesitate to contact us at:pychi@desy.deor here on GitHub.