Utils module¶
-
class
pynumpm.utils.Propagation[source]¶ Enum class containing the two possible propagation configurations, copropagation and counterpropagation. It is used to change the sign of the red_wavelength in the calculations of the deltabeta in this module.
-
COPROPAGATION= -1¶ Sign of the signal in copropagation
-
COUNTEPROPAGATION= 1¶ Sign of signal in counterpropagation
-
-
pynumpm.utils.calculate_poling_period(lamr: float = 0, lamg: float = 0, lamb: float = 0, nr: Callable[[float], float] = None, ng: Callable[[float], float] = None, nb: Callable[[float], float] = None, order=1, propagation_type=<Propagation.COPROPAGATION: -1>, verbose=False)[source]¶ Function to calculate the poling period of a specific process. To ensure energy conservation, specify only two wavelengths (in meter) and leave the free one to 0
Parameters: - lamr (float) – Wavelength of the red field [m].
- lamg (float) – Wavelength of the green field [m].
- lamb (float) – Wavelength of the blue field [m].
- nr (Function) – Function returning the refractive index for the red field.
- ng (Function) – Function returning the refractive index for the green field.
- nb (Function) – Function returning the refractive index for the blue field.
- order (int) – Order of the process. Default: 1
- propagation_type (
pynumpm.utils.Propagation) – Type of the propagation (co- or counter-propagation). Default is coprop.
Returns: The poling period.
-
pynumpm.utils.calculate_phasematching_point(fixed_wl, poling_period: float, nr: Callable[[float], float], ng: Callable[[float], float], nb: Callable[[float], float], hint, order: int = 1, verbose: bool = False)[source]¶ Function to calculate the phasematching point, given a wavelength and the poling period of the structure.
This function tries to minimise the energy and momentum conservation equations to find the possible phasematched processes, given a fixed wavelength and the poling period, using the fsolve`routine from `scipy.
The fixed_wl variable is a list (or tuple) containing the value and the field name (“r”, “g” or “b” for red, green and blue). For example, if one wants to define the green field as fixed at 800nm, the fixed_wl must be in the form [800e-9, “g”].
In case of an SHG calculation, fixed_wl can receive as second parameter the string “shg”.
Note
In case of an SHG calculation, the value of the constant wavelength is not used.
Parameters: - fixed_wl (list) – Wavelength to be kept constant during the calculation.
- poling_period (float) – Poling period of the structure
- nr (Function) – Function returning the refractive index for the red field.
- ng (Function) – Function returning the refractive index for the green field.
- nb (Function) – Function returning the refractive index for the blue field.
- hint (list) – List of the two wavelengths to be used as first hints to find the solution.
- order (int) – Order of the process. Default: 1
- verbose (bool) – Set the calculation to be verbose or not. Default: False
Returns: List of red wavelength, green wavelength, blue wavelength and poling period.
-
pynumpm.utils.bandwidth(wl, phi, **kwargs)[source]¶ Function to calculate the bandwidth of a given phasematching spectrum fitting it with savgol_filter and then approximating it with a UnivariateSpline.
Warning
This function has not been tested thoroughly.
Parameters: - wl (Array) – Wavelengths
- phi (Array) – Phasematching intensity
Returns: FWHM bandwidth of the phasematching intensity
Additional parameters
Parameters: - window_size (int) – Savgol_filter window_size parameter
- polynomial_order (int) – Savgol_filter polynomial_order parameter