beam_size
- laserbeamsize.analysis.beam_size(image: ndarray, mask_diameters: float = 3, corner_fraction: float = 0.035, nT: float = 3, max_iter: int = 25, phi_fixed: float | None = None, iso_noise: bool = True) tuple[float, float, float, float | None, float][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 integration 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_fixed – (optional) fixed tilt of ellipse in radians
iso_noise – (optional) if True then allow negative pixel values
- Returns:
xc – horizontal center of beam yc: vertical center of beam d_major: major axis (i.e, major diameter) d_minor: minor axis (i.e, minor diameter) phi: angle between major axis and horizontal axis [radians]