Measuring Laser Beam Size#
This example shows how to measure the size of a laser beam along the propagation axis, using using DataLab:
Load all the images in a folder
Apply a threshold to the images
Extract the intensity profile along an horizontal line
Fit the intensity profile to a Gaussian function
Compute the full width at half maximum (FWHM) of intensity profile
Try another method: extract the radial intensity profile
Compute the FWHM of the radial intensity profile
Perform the same analysis on a stack of images and on the resulting profiles
Plot the beam size as a function of the position along the propagation axis
First, we open DataLab and load the images:

Open the image files with âFile > OpenâŠâ, or with the button in
the toolbar, or by dragging and dropping the files into DataLab (on the panel on
the right).#

Select the test images âTEM00_z_*.jpgâ and click âOpenâ.#
The selected images are loaded in the âImagesâ panel. The last image is displayed in the main window. On each image, we can zoom in and out by pressing the right mouse button and dragging the mouse up and down. We can also pan the image by pressing the middle mouse button and dragging the mouse.

Zoom in and out with the right mouse button. Pan the image with the middle mouse button.#
Note
If we want to display the images side by side, we can select the
âDistribute on a gridâ entry in the âOperationsâ menu.

Images distributed on a 4 rows grid#
But, letâs go back to the initial display by selecting the âReset image positionsâ entry in the âOperationsâ menu.
If we select on of the images, we can see that there is background noise, so it might be useful to apply a threshold to the images.

Select one of the images in the âImagesâ panel, select the associated image
in the visualization panel, and enable the âCross sectionâ tool in
the vertical toolbar on the left of the visualization panel (this tool is a
PlotPy feature). On this figure, we
can see that the background noise is around 30 lsb (to show the curve marker,
we had to select the profile curve and right-click on it to display the context
menu, and select âMarkers > Bound to active itemâ).#

Another way to measure the background noise is to use the âImage statisticsâ tool
in the vertical toolbar on the left of the visualization panel.
It displays statistics on a the rectangular area defined by dragging the mouse
on the image. This confirms that the background noise is around 30 lsb.#

After applying a threshold at 35 lsb (with âProcessing > ThresholdingâŠâ), we can compute a more accurate position of the beam center using âAnalysis > Centroidâ.#

Then we can extract a line profile along the horizontal axis with âOperations > Intensity profiles > Line profileâ. We set the row position to the centroid position computed previously (i.e. 668).#

The intensity profile is displayed in the âSignalsâ panel. We can fit the profile to a Gaussian function with âProcessing > Fitting > Gaussian fitâ. Here we have selected both signals.#

If we go back to the first signal, the intensity profile, we can also directly compute the FWHM with âAnalysis > Full width at half maximumâ. The âResultsâ dialog displays a lot of information about the computation, including the FWHM value (that is the L column, âLâ for âLengthâ because the result shape is a segment and FWHM is the length of the segment).#

The FWHM is also displayed on the curve, with an optional label (here, the
title of this measurement has been displayed with
âView > Show graphical object titlesâ or the button in the toolbar).#
Now, letâs try another method to measure the beam size.
From the âImagesâ panel, we can extract the radial intensity profile with âOperations > Intensity profiles > Radial profileâ.

The radial intensity profile may be computed around the centroid position, or around the center of the image, or around a user-defined position. Here we have selected the centroid position.#

The radial intensity profile is displayed in the âSignalsâ panel. It is smoother than the line profile, because it is computed from a larger number of pixels, thus averaging the noise.#
All these operations and computations that we have performed on a single image can be applied to all the images in the âImagesâ panel.
To do that, we begin by cleaning the âSignalsâ panel (with âEdit > Delete allâ or
the button in the toolbar). We alse clean the intermediate results
in the âImagesâ panel by selecting the images obtained during our prototyping
and deleting them individually (with âEdit > Removeâ or the
button).
Then, we select all the images in the âImagesâ panel (individually, or by selecting the whole group âg001â).

We apply the threshold to all the images, and the we extract the radial intensity profile for all the images (after selecting the whole group âg002â - it should be automatically selected if you had selected âg001â before applying the threshold).#

The âSignalsâ panel now contains all the radial intensity profiles.#

We can compute the FWHM of all the radial intensity profiles: the âResultsâ dialog displays the FWHM values for all the profiles.#
Note
If you want to show the analysis results again, you can select the âShow resultsâ
entry in the âAnalysisâ menu, or the âShow resultsâ
button, below the image list:


Finally, we can plot the beam size as a function of the position along the
propagation axis. To do that, we use the âPlot resultsâ feature
in the âAnalysisâ menu. This feature allows to plot result data sets by
choosing the x and y axes among the result columns. Here, we choose the
to plot the FWHM values (L) as a function of the image index (Indices).#

The plot is displayed in the âSignalsâ panel and shows that the beam size increases with the position along the propagation axis (the position is here in arbitrary units, the image index).#

We can also calibrate the X and Y axis using âProcessing > Linear calibrationâ. Here we have set the X axis to the position in mm (and entered the title and unit in the âPropertiesâ group box).#
Finally, we can save the workspace to a file . The workspace contains
all the images and signals that were loaded or processed in DataLab. It also contains
the analysis results, the visualization settings (colormaps, contrast, etc.), the
metadata, and the annotations.
If you want to load the workspace again, you can use the âFile > Open HDF5 fileâŠâ
(or the button in the toolbar) to load the whole workspace, or the
âFile > Browse HDF5 fileâŠâ (or the
button in the toolbar) to load
only a selection of data sets from the workspace.