basic_beam_size
- laserbeamsize.analysis.basic_beam_size(original: ndarray, phi_fixed: float | None = None) tuple[float, float, float, float | None, float][source]
Determine the beam center, diameters, and tilt using ISO 11146 standard.
Find the center and sizes of an elliptical spot in an 2D array. The function does nothing to eliminate background noise. It just finds the first and second order moments and returns the beam parameters. Consequently a beam spot in an image with a constant background will fail badly.
FWIW, this implementation is roughly 800X faster than one that finds the moments using for loops.
When background noise dominates then a diameter of 1 is returned.
phi_fixed defaults to None, in which case the best fitted angle for the ellipse is found. If phi_fixed is specified, then an ellipse is rotated to that angle and fitted to the image.
If the input is a masked array, masked pixels are treated as having zero weight in the moment calculations.
- Parameters:
original – 2D array of image with beam spot (may be masked array)
phi_fixed – angle that major axis of ellipse makes with horizontal [radians]
- 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 [radians]