Measuring Laser Beam Size#
This example shows how to measure the size of a laser beam along the propagation axis 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
Load the images#
Note
The images used in this tutorial âTEM00_z_*.jpgâ are available in the tutorial data
folder of DataLabâs installation directory
(<DataLab installation directory>/data/tutorials/).
Alternatively, you can download them from here
and extract to the folder of your choice.
First, we open DataLab and load the images. When working with multiple images, the most
efficient approach is to use the âOpen from directoryâŠâ option
from the âFileâ menu (or click the button in the toolbar). This feature
loads all images from a selected directory at once.
The âFile > Open ImageâŠâ menu#
Select the folder containing the images and click âChooseâ.#
The images are now loaded in the âImage panelâ. You can zoom in and out by right-clicking and dragging the mouse vertically. To pan the image, use the middle mouse button while dragging.
Zoom in and out with the right mouse button. Pan the image with the middle mouse button.#
Note
To view multiple images simultaneously, select the image group and choose âView images side-by-sideâ from the âViewâ menu.
Viewing images side by side.#
Warning
The âProcessing > Geometryâ menu includes a âDistribute on a gridâ option
. This feature repositions the images by applying
offsets to their X and Y coordinates, arranging them in a grid layout
for side-by-side viewing. Note that this operation modifies the image
coordinates.
Images distributed on 4 columns grid.
To restore the original image positions, use the âReset image positionsâ
option from the âProcessing > Geometryâ menu. Note that this
operation sets all image origins to match the first imageâs origin,
which means any initial differences in image origins will be lost.
Remove background noise#
When we select one of the images, we notice the presence of background noise, making it beneficial to apply a threshold to the images. Several methods are available to estimate the background noise level.
One approach utilizes the âCross sectionâ tool, which is provided by the
PlotPy <https://github.com/PlotPyStack/plotpy> library that DataLab uses for signal and image visualization.
Select an image from the âImage panelâ, choose the corresponding image
in the visualization panel, and activate the âCross sectionâ tool
from
the vertical toolbar on the left side of the visualization panel. This
reveals that the background noise level is approximately 30 lsb.
An image from the âImage panelâ. To display the curve marker, select the profile curve and right-click to open the context menu, then choose âMarkers > Bound to active itemâ.#
Another method for measuring background noise, also provided by PlotPy <https://github.com/PlotPyStack/plotpy>, involves using the âImage statisticsâ tool
from the vertical toolbar on the left side of the visualization panel.
This tool displays statistical information for a rectangular region that you define by dragging the mouse
across the image. This analysis confirms that the background noise level is approximately 30 lsb.
The âImage statisticsâ tool
in the vertical toolbar.#
Note that these tools are not persistent: the analysis results disappear when you select another image, they are intended to provide a fast insight on the image data.
Now we can clip the image at 35 lsb to remove the background noise using the âProcessing > Level Adjustment > ClippingâŠâ menu.
The two original and the clipped images are displayed side by side in the âImage viewâ (using the âDistribute on a gridâ feature seen previously).#
Beam size measurement#
We can now compute the centroid of the beamâthat is, the position of its center of mass. To do this, select âAnalysis > Centroidâ from the menu.
The centroid position is displayed on the image.#
Next, we can extract a line profile along the horizontal axis using âAnalysis > Intensity profiles > Line profileâ. Set the row position to the previously computed centroid position (i.e., 668) using the âSet Parametersâ button. See Measuring Fabry-Perot fringes for more details on intensity profile extraction.
The intensity profile will be displayed in the âSignal panelâ. We can then fit the profile to a Gaussian function using âProcessing > Fitting > Gaussian fitâ. Here we have selected both signals for comparison.
The intensity profile fitted to a Gaussian function. Here both signals are selected.#
Now letâs explore another method to compute the FWHM. Returning to the intensity profile signal, we can directly compute the FWHM using âAnalysis > Full width at half maximumâ. You can choose the estimation method based on your curve characteristics and optionally specify the interval to consider for this computation. Once complete, the results window will display the FWHM value, which is stored in the metadata and shown on the curve.
The popup that allows to choose the method to estimate the FWHM.#
The FWHM result shown in the popup and over the curve.#
Letâs also try another method to measure the beam size by returning to the image.
From the âImage panelâ, we can extract the radial intensity profile using âAnalysis > Intensity profiles > Radial profileâ. The radial intensity profile can be computed around the centroid position, the center of the image, or a user-defined position, depending on your data. For our data, which appears to have radial symmetry with a center not necessarily identical to the image center, the best option is the centroid position.
The options available for the Radial Profile computation.#
The radial intensity profile displayed in the âSignal panelâ. It is smoother than the line profile, because it is computed from a larger number of pixels, thus averaging the noise.#
Apply these operations to all the images#
All the operations and computations performed on a single image can be applied to all images in the âImage panelâ.
To begin, clean the âSignal panelâ using âEdit > Delete allâ or
the button in the toolbar. Also remove intermediate results
from the âImage panelâ by selecting the images created during prototyping
and deleting them individually using âEdit > Removeâ or the
button.
Next, select all images in the âImage panelâ (individually or by selecting the entire group âg001â).
Apply the clipping operation to all images, then extract the radial intensity profiles for all images (after selecting the entire group âg002ââit should be automatically selected if you had âg001â selected before applying the threshold).
The clipping applies to all images of the group.#
The âSignal panelâ now contains all the radial intensity profiles.#
We can now compute the FWHM for all radial intensity profiles. The âResultsâ dialog will display the FWHM values for all profiles.
The âResultsâ dialog displays the FWHM values for all the profiles.#
Note
To display the analysis results again, select âShow resultsâ
from the âAnalysisâ menu, or click the âShow resultsâ
button below the image list:
Finally, we can plot the beam size as a function of position along the
propagation axis using the âPlot resultsâ feature
from the âAnalysisâ menu. This feature allows you to plot result datasets by
selecting the x and y axes from the available result columns. Here, we will
plot the FWHM values (L) as a function of the image index (Indices).
The âPlot resultsâ feature
in the âAnalysisâ menu.#
The beam size as a function of position along the propagation axis (the position is in arbitrary unitsâthe image index).#
We can also calibrate the X and Y axes using âProcessing > Linear calibrationâ. Here we set the X axis to the position in mm (entering the title and unit in the âPropertiesâ group box) using the formula: \(X[\textrm{mm}] = 0.5 \cdot i + 10\) where \(i\) is the image index.
The calibrated beam size as a function of the position along the propagation axis (the position is now in mm).#
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.