pyoptics.beam_quality

Beam widths, divergence and beam propagation ratio M² after ISO 11146.

The beam width is defined by the second moments of the intensity distribution (ISO 11146-1). For a beam with centroid (x_c, y_c), the variances sigma_x**2, sigma_y**2 and the covariance sigma_xy**2 give the widths along the principal axes,

d_x = 2*sqrt(2)*sqrt(sigma_x**2 + sigma_y**2 + g*sqrt((sigma_x**2 - sigma_y**2)**2 + 4*sigma_xy**4)),
d_y = 2*sqrt(2)*sqrt(sigma_x**2 + sigma_y**2 - g*sqrt(...)),

with g = sgn(sigma_x**2 - sigma_y**2), and the azimuth

phi = 1/2*arctan(2*sigma_xy**2/(sigma_x**2 - sigma_y**2))

of the principal axis “x” (the one closer to the lab x axis, |phi| <= pi/4). For a TEM_00 beam with 1/e**2 intensity radius w, d_x = d_y = 2*w.

The second moments are very sensitive to noise and background far from the beam. ISO 11146-3 therefore restricts the integration to a rectangle of three times the beam widths, centered on the centroid and aligned with the principal axes, and iterates until the widths converge (beam_widths() with iterate=True). Any background offset has to be subtracted beforehand.

The beam propagation ratio follows from a hyperbolic fit to the widths d(z) measured along the beam (ISO 11146-1, section 9): d(z)**2 = a + b*z + c*z**2 gives the waist position z_0 = -b/(2c), the waist width d_0, the (full) divergence angle Theta = sqrt(c), the Rayleigh length z_R = d_0/Theta and M² = pi/(4*wavelength)*d_0*Theta. ISO asks for at least 10 positions, about half of them within one Rayleigh length of the waist and about half beyond two Rayleigh lengths. The fit is done separately for each principal axis (for simple astigmatic beams).

References

ISO 11146-1:2021, “Lasers and laser-related equipment - Test methods for laser beam widths, divergence angles and beam propagation ratios - Part 1: Stigmatic and simple astigmatic beams”, International Organization for Standardization (2021).

ISO 11146-3:2004, “Lasers and laser-related equipment - Test methods for laser beam widths, divergence angles and beam propagation ratios - Part 3: Intrinsic and geometrical laser beam classification, propagation and details of test methods”, International Organization for Standardization (2004).

A. E. Siegman, “New developments in laser resonators”, Proc. SPIE 1224, 2-14 (1990).

Classes

BeamWidths

Second moment beam widths after ISO 11146-1.

CausticFit

Result of fit_caustic().

SecondMoments

First and second moments of an intensity distribution.

Functions

beam_widths

Second moment beam widths after ISO 11146.

fit_caustic

Fit the hyperbolic caustic d(z)**2 = a + b*z + c*z**2 to measured beam widths and derive waist, divergence and M² (ISO 11146-1).

second_moments

Centroid and second moments of an intensity distribution.

widths_from_moments

ISO 11146-1 beam widths and azimuth from second moments.

class pyoptics.beam_quality.SecondMoments(x_c, y_c, sigma_x2, sigma_y2, sigma_xy2)

Bases: tuple

First and second moments of an intensity distribution.

x_c, y_c: centroid; sigma_x2, sigma_y2: variances sigma_x**2, sigma_y**2; sigma_xy2: covariance sigma_xy**2 (all in units of the coordinates (squared)).

sigma_x2

Alias for field number 2

sigma_xy2

Alias for field number 4

sigma_y2

Alias for field number 3

x_c

Alias for field number 0

y_c

Alias for field number 1

class pyoptics.beam_quality.BeamWidths(d_x, d_y, phi, x_c, y_c, moments)[source]

Bases: BeamWidths

Second moment beam widths after ISO 11146-1.

d_x, d_y: widths (diameters) along the principal axes; phi: azimuth of the principal x axis in radians (counterclockwise from the lab x axis); x_c, y_c: centroid; moments: the underlying SecondMoments.

property d_r

Generalized beam diameter 2*sqrt(2)*sqrt(sigma_x**2 + sigma_y**2) (equals d_x = d_y for round beams).

property ellipticity

Ratio min(d_x, d_y)/max(d_x, d_y); ISO 11146 regards beams with an ellipticity above 0.87 as round.

class pyoptics.beam_quality.CausticFit(d_0, z_0, theta, z_R, M2, coeffs)[source]

Bases: CausticFit

Result of fit_caustic().

d_0: waist width (diameter); z_0: waist position; theta: full far field divergence angle; z_R: Rayleigh length; M2: beam propagation ratio M²; coeffs: (a, b, c) of the fit d(z)**2 = a + b*z + c*z**2.

d(z)[source]

Fitted beam width d(z) = sqrt(d_0**2 + theta**2*(z - z_0)**2).

pyoptics.beam_quality.second_moments(I, x, y, background=0.0, mask=None)[source]

Centroid and second moments of an intensity distribution.

Parameters:
Iarray

Intensity, shape (Ny, Nx).

x, yarrays

Linear or meshed coordinates.

backgroundnumber or array, optional

Background subtracted from I before computing the moments.

maskarray, optional

Weights (e.g. a boolean integration area) that multiply the intensity.

Returns:
momentsSecondMoments
pyoptics.beam_quality.widths_from_moments(moments)[source]

ISO 11146-1 beam widths and azimuth from second moments.

Parameters:
momentsSecondMoments
Returns:
widthsBeamWidths
pyoptics.beam_quality.beam_widths(I, x, y, background=0.0, iterate=True, window=3.0, max_iter=50, rtol=1e-06)[source]

Second moment beam widths after ISO 11146.

Parameters:
Iarray

Intensity, shape (Ny, Nx).

x, yarrays

Linear or meshed coordinates.

backgroundnumber or array, optional

Background (offset) subtracted from I.

iterateboolean, optional

If True (default), restrict the integration to a rectangle of window times the beam widths around the centroid, aligned with the principal axes, and iterate until the widths change by less than rtol (ISO 11146-3); for round beams (ellipticity > 0.87) the window is a square of window times d_r aligned with x and y. The iteration starts from the moments of the region above half the (background corrected) maximum. If False, integrate over the whole image.

windownumber, optional

Size of the integration area in units of the beam widths. ISO prescribes 3.

max_iterint, optional

Maximum number of iterations.

rtolnumber, optional

Relative tolerance on d_x and d_y for convergence.

Returns:
widthsBeamWidths
pyoptics.beam_quality.fit_caustic(z, d, wavelength)[source]

Fit the hyperbolic caustic d(z)**2 = a + b*z + c*z**2 to measured beam widths and derive waist, divergence and M² (ISO 11146-1).

Parameters:
zarray

Positions along the beam.

darray

Beam widths (diameters, e.g. BeamWidths.d_x) at these positions.

wavelengthnumber

Wavelength in the medium the beam propagates in.

Returns:
fitCausticFit