beam_size

laserbeamsize.analysis.beam_size(image, mask_diameters=3, corner_fraction=0.035, nT=3, max_iter=25, phi=None, iso_noise=True)[source]

Determine beam parameters in an image with noise.

The function first estimates the elliptical spot by excluding all points that are less than the average value found in the corners of the image.

These beam parameters are then used to determine a rectangle that surrounds the elliptical spot. The rectangle size is mask_diameters times the spot diameters. This is the integration region used for estimate a new beam spot.

This process is repeated until two successive spot sizes match again as outlined in ISO 11146

corner_fraction determines the size of the corners. ISO 11146-3 recommends values from 2-5%. The default value of 3.5% works pretty well.

mask_diameters is the size of the rectangular mask in diameters of the ellipse. ISO 11146 states that mask_diameters should be 3. This default value works fine.

nT accounts for noise in the background. The background is estimated using the values in the corners of the image as mean+nT * stdev. ISO 11146 states that 2<nT<4. The default value works fine.

max_iter is the maximum number of iterations done before giving up.

Parameters:
  • image – 2D array of image of beam

  • mask_diameters – (optional) the size of the integratifon rectangle in diameters

  • corner_fraction – (optional) the fractional size of the corners

  • nT – (optional) the multiple of background noise to remove

  • max_iter – (optional) maximum number of iterations.

  • phi – (optional) fixed tilt of ellipse in radians

Returns:

xc – horizontal center of beam yc: vertical center of beam dx: horizontal diameter of beam dy: vertical diameter of beam phi: angle that elliptical beam is rotated ccw [radians]