finesse.cymath.homs module

Fast computations of Higher-Order Mode related properties.

This module provides functions for computing properties of HOMs, such as the spatial distribution \(u_{nm}(x,y,z;q_x,q_y)\) of Hermite-Gauss modes.

Note

These are low-level functions intended for use, by developers, in Cython extensions. To calculate HG mode profiles, for example, users should instead use the Python class HGMode defined in finesse.gaussian.

class finesse.cymath.homs.HGModeWorkspace(int n, int m, double complex qx, double complex qy, double nr, double lambda0)[source]

Bases: object

Fast computation of Hermite-Gauss spatial distributions.

This workspace class is used internally by HGMode. Users should only ever interact with the HGMode object rather than this class.

is_astigmatic
lambda0
m

m: ‘int’

n

n: ‘int’

nr
qx
qy
set_values(self, qx=None, qy=None, nr=None, lambda0=None)[source]
u_m(self, y, double complex[: :1] out = None)[source]
u_n(self, x, double complex[: :1] out = None)[source]
u_nm(self, x, y, out=None)[source]
class finesse.cymath.homs.HGModes(q, modes, bool reverse_gouy=False, bool flip_odd_x_modes=False)[source]

Bases: object

A class that calculates a selection of Hermite-Gaussian modes.

Parameters

q[complex | BeamParam]

Complex valued beam parameter. If one if given qx = qy. Otherwise an iterable of two must be given (qx, qy).

modestuple((n, m))

list of mode indices

zero_tem00_gouybool, optional

When True, the HG00 mode will have its gouy phase removed, and relatively removed from all other HG modes. ie. gouy = (n+m)*Gouy rather than (1+n+m)*Gouy

reverse_gouybool, optional

Gouy phase is removed from coupling coefficients when True

flip_odd_x_modesbool, optional

When True any output mode with an odd n index will have a negative sign applied. This should be used in reflection cases due to the coordinate system change.

Unm(self, int n, int m, double x, double y)[source]
compute_1d_modes(self, double[: :1] x, double[: :1] y)[source]

Calculates the Un and Um modes arrays for the modes that were specificied when creating this HGModes object.

Parameters

x, yndarray

Array of x and y data points to compute the modes over

Returns

Unndarray(shape=(N, x.size))

A 2D array of all the modes over the x array

Umndarray(shape=(N, y.size))

A 2D array of all the modes over the y array

compute_2d_modes(self, double[: :1] x, double[: :1] y)[source]

Calculates the Unm modes that were specificied when creating this HGModes object.

Parameters

x, yndarray

Array of x and y data points to compute the modes over

Returns

Unmndarray(shape=(N, y.size, x.size))

A 3D array of all the modes over the x and y domain

compute_points(self, double[: :1] x, double[: :1] y)[source]

Calculates the Unm modes over a set of (x,y) points.

Parameters

x, yndarray

Array of x and y data points to compute the modes over, size of x and y must be the same.

Returns

Unmndarray(shape=(x.size, N), dtype=complex)

A 2D array of all the modes over the x and y domain

flip_odd_x_modes
reverse_gouy
unique_m_modes[source]
unique_map[source]
unique_n_modes[source]
finesse.cymath.homs.field_index(int n, int m, const int[, : :1] homs) Py_ssize_t
finesse.cymath.homs.in_mask(int n, int m, const int[, : :1] mask) bool