laser power

Automatic Pockels Linearization

Some time ago, we described a procedure to manually create a look up table for the laser power slider to achieve linear power.  Now, if you have a Thorlabs’ PM100D meter your job has been made much easier, as Scanbox can perform the calibration automatically.

As a first step, you will need download and install the software for the PM100D.

Connect the power meter to the computer with an USB cable and start up Matlab.  If you launch the Test and Measurement Tool (tmtool) you should see the instrument listed under VISA | USB as shown in the figure below.


Make a note of the identification string.  Edit scanbox_config and set the variable ‘pmeter_id’ to this ID string. In the present example, we would have a line that reads:

sbconfig.pmeter_id = 'USB0::0x1313::0x8078::P0012223::0::INSTR'; % PM100D power meter ID (leave blank if not available)

Launch Scanbox and scroll through the different panels.  You should now see a panel labeled Power Meter and, within the panel there is a button labeled Calibration.

To use the calibration tool place the sensor of the PM100D at the output of the pockels cell.  Make sure the bias of the pockels controller is set so you get minimum power when Scanbox is not scanning.  Now, make sure the laser shutter is open.  You can now hit the Calibration button, sit back and relax.

Scanbox will start changing the DAC values and reading the power at each setting.  A graph will be plotted online as the process takes place.  At the end you will get a graph that looks like this:



The blue dots show the raw data, while the red line is a fit to the points which is used to compute the linearization table.

Immediately after the look up table is computed, Scanbox will perform a validation step, measuring the power at the different settings after installing the new lookup table. Once the measurements are complete, you should get a pretty linear graph, like this:


Scanbox saves the resulting linearization table in pockelscal.mat, so next time you start Scanbox that lookup table will be automatically loaded (overriding whatever settings you have in the configuration file).

That’s it! (Remember to take the sensor out of the path when you are done!)

Automatic Control of Laser Power

A new checkbox within the Laser panel (labeled AGC) allows you to turn an automatic control of laser power on and off.

When AGC is on, Scanbox checks the distribution of pixel values on the image every T seconds, and increases or decreases the laser power by a certain factor if the fraction of pixels above a threshold is outside the desired range.

The values of these parameters are found in a new section of the sbconfig.m file:

% Laser AGC
sbconfig.agc_period = 1;            % adjust power every T seconds
sbconfig.agc_factor = [0.93 1.08];  % factor to change laser power down or up if outside prctile bounds
sbconfig.agc_prctile = [1e-5 1e-3]; % bounds on percent pixels saturated wanted
sbconfig.agc_threshold = 250;       % threshold above which is considered saturated (255 is max value)


Below is a video showing AGC in action.

At the beginning of the video,  I focus on pollen grains using low power. When the AGC is turned on, it brings the power up. Then, if I increase the PMT gain, the laser power is decreased in response.  If the laser power is changed manually, AGC will re-adjust it to bring the pixel distribution within the desired limits.


AGC of laser power is useful when running a z-stack with a range that is larger than 100um or so.  In that case, engaging AGC will make Scanbox adjust laser power as a function of depth. Another situation where AGC may be useful is while running very long experiments/sessions where water may evaporate slowly leading to a reduction of the signal. In that case, turning AGC would compensate and could render the data usable.