shgpy.formgen module

Module for (non-Fourier) formula derivation

This module provides a number of routines for calculating the SHG response of a given material (encoded by its susceptbility tensor, see tensor_definitions ). These routines are much more straightforward than those found in fformgen, but are only suited for the most simple problems because the conversion from formulas to Fourier formulas (which is all but necessary for efficient fitting functionality) is typically quite slow.

shgpy.formgen.formgen(theta, t_eee=None, t_mee=None, t_qee=None)

Generate generic SHG formula for any multipole.

Parameters:
thetafloat

Angle of incidence.

t_eeendarray of sympy.Expr, optional

The electric dipole tensor. Pass None to neglect electric dipole. Default is None. Must pass at least one of t_eee, t_mee, or t_qee.

t_meendarray of sympy.Expr, optional

The magnetic dipole tensor. Pass None to neglect magnetic dipole. Default is None. Must pass at least one of t_eee, t_mee, or t_qee.

t_qeendarray of sympy.Expr, optional

The electric quadrupole tensor. Pass None to neglect electric quadrupole. Default is None. Must pass at least one of t_eee, t_mee, or t_qee.

shgpy.formgen.formgen_dipole_quadrupole(t1, t2, theta)

Generate formula assuming dipole+quadrupole SHG.

Parameters:
t1ndarray of sympy.Expr

SHG dipole susceptibility tensor; see tensor_definitions.

t2ndarray of sympy.Expr

SHG quadrupole susceptibility tensor; see tensor_definitions.

thetafloat or sympy.Symbol

Angle of incidence

Returns:
fformFormContainer

Instance of FormContainer.

shgpy.formgen.formgen_just_dipole(t1, theta)

Generate formula assuming dipole SHG.

Parameters:
t1ndarray of sympy.Expr

SHG susceptibility tensor; see tensor_definitions.

thetafloat or sympy.Symbol

Angle of incidence

Returns:
fformFormContainer

Instance of FormContainer.

Notes

This routine differs from formgen_just_dipole_real() only in the sense that the computed intensity function is computed by computing the modulus-squared (rather than **2) of the polarization. For this reason, it is usually suggested to explicitly substitute x -> real_x+1j*imag_x for each x in t1. See make_tensor_complex() and the tutorial.

shgpy.formgen.gen_P_dipole_quadrupole(t1, t2, theta)

Generate P formula assuming dipole+quadrupole SHG.

Parameters:
t1ndarray of sympy.Expr

SHG dipole susceptibility tensor; see tensor_definitions.

t2ndarray of sympy.Expr

SHG quadrupole susceptibility tensor; see tensor_definitions.

thetafloat or sympy.Symbol

Angle of incidence

Returns:
Pp_effarray_like of sympy.Expr

The 2omega effective polarization assuming P-polarized input

Ps_effarray_like of sympy.Expr

The 2omega effective polarization assuming S-polarized input

shgpy.formgen.gen_P_just_dipole(t1, theta)

Generate P formula assuming dipole SHG.

Parameters:
t1ndarray of sympy.Expr

SHG susceptibility tensor; see tensor_definitions.

thetafloat or sympy.Symbol

Angle of incidence

Returns:
Pparray_like of sympy.Expr

The 2omega polarization assuming P-polarized input

Psarray_like of sympy.Expr

The 2omega polarization assuming S-polarized input

shgpy.formgen.gen_S(theta, t_eee=None, t_mee=None, t_qee=None)
shgpy.formgen.gen_levi_civita()
shgpy.formgen.make_form_from_P_and_Q(Pp, Ps, Qp, Qs)

Given a dipole and quadrupole moment, return the SHG signal.

Parameters:
Ppsympy.Expr

2omega dipole component if the input is P polarized

Pssympy.Expr

2omega dipole component if the input is S polarized

Qpsympy.Expr

2omega quadrupole component if the input is P polarized

Qssympy.Expr

2omega quadrupole component if the input is S polarized

Returns:
formFormContainer