finesse.gaussian.ws_overlap_grid

finesse.gaussian.ws_overlap_grid(qp, woffset, soffset, wpts=200, spts=200)[source]

Computes the WS phase space overlap with the primary beam parameter qp over a grid of W, S data.

See ws_overlap() for a definition of the overlap quantity.

The \(W\) and \(S\) spaces are formed by creating arrays around the BeamParam.w and BeamParam.S values of qp, according to the offsets given in woffset and soffset, respectively.

Parameters:
qpBeamParam

The primary “mode” which overlapping modes are calculated against.

woffsetfloat, sequence

A single number, or size 2 sequence. Defines the offsets (lower, upper) from the primary mode beamsize to use for the W space.

soffsetfloat, sequence

A single number, or size 2 sequence. Defines the offsets (lower, upper) from the primary mode beamsize to use for the S space.

wptsint, optional; default: 200

Number of points for the W space array.

sptsint, optional; default: 200

Number of points for the S space array.

Returns:
Wnumpy.ndarray

The W space (as a 2D grid).

Snumpy.ndarray

The S space (as a 2D grid).

OLnumpy.ndarray

The overlap as a function of the WS phase space (as a 2D grid).

Examples

In the following example, we compute the overlap to a primary mode which has a 6 mm beam size and a defocus of 0 m (i.e. at the waist).

import finesse
finesse.configure(plotting=True)

import finesse.gaussian as gaussian
from finesse.plotting.plot import ws_phase_space

import matplotlib.pyplot as plt

# Make a beam parameter with w = 6 mm, S = 0 m
qp = gaussian.BeamParam(w=6e-3, S=0)

# Compute the WS phase space overlap with qp, using
# maximum offset of 1 mm in beam size and 1 cm in defocus
W, S, OL = gaussian.ws_overlap_grid(qp, woffset=1e-3, soffset=1e-2)

# Now plot this as contours of overlap with custom levels
fig, ax = ws_phase_space(
    W, S, OL,
    levels=[0.6, 0.8, 0.84, 0.88, 0.92, 0.94, 0.96, 0.98, 0.995, 0.999],
)
../../_images/finesse.gaussian.ws_overlap_grid_0_1.svg