Intensity modulation of the ultrafast lasers typically used for two-photon imaging is typically done using a Pockels Cell.

The laser intensity is modulated to control

  1. The laser power during an exposure.
  2. Beam blanking on the edges of the resonant scan.
  3. Beam blanking between image frames during the Y mirror flyback.

ScanImage allows control of up to 3 Pockels Cells (or other similar light modulators). The command signals generated by ScanImage for control of these devices are termed Beams. These signals can be controlled by ScanImage in several contexts:

  • Simple static control of power level to use during acquisitions. This avoids need for simple manual control of a laser attenuator. See the Power Controls Window.
  • Dynamic control of power during each scanned Line, blanking the Beam during the non-acquiring portion of each Line Period. See Beam Flyback Blanking.

Control and Timing

The beams are controlled by a signal generated by the FlexRIO called a Beam Modified Line Clock.


The Beam Modified Line Clock has two possible different modes of operation.


Trigger mode is the default mode of operation for the Beam Clock. Toggle mode is not currently implemented.


See Power Controls.



To allow calibration of a particular Beam, its beamCalInputDeviceID and beamCalInputChanIDmust be specified in the Machine Data File.

 At ScanImage startup, all Beams with specified Beam Calibration input channels are automatically calibrated.



  • Ratio of the maximum to the minimum signal level measured during Beam Calibration determines the dynamic range of the Beam. The minimum value allowed for the Power level is clamped accordingly, e.g. 0.1% implies a 1000:1 dynamic range, 0.5% implies a 200:1 dynamic range, etc.
  • Maximum voltage range used during the Beam Calibration process is specified, for each Beam, by the beamVoltageRanges values in the Machine Data File.

  • For some light modulators (e.g. Pockels Cells), the calibration relationship between voltage and percent-power depends on the laser wavelength. In such cases, the calibration should be updated when the laser is significantly re-tuned.
  • Beam Calibration input channel offsets are stored in the Machine Data File after being measured and automatically reapplied on subsequent use of ScanImage. Offsets are not expected to change significantly from day to day. The Measure Calibration Offset operation should be done/checked only periodically to ensure there are no significant fluctuations.

How to Perform Calibration


If no Photodiode is specified in the Machine Data File for a particular Beam - then ScanImage uses a 'naive' calibration.

If a Photodiode (or other light detector) is available, and activated in the Machine Data File for one or more Beam(s), then ScanImage will execute a Pockels calibration measurement at the following times:

  • At ScanImage startup - for each active Beam with a Photodiode also active. These are executed sequentially.
  • When manually specified, by selecting Calibration >> Calibrate... from the Power Controls panel menubar. The calibration is executed only for the specified Beam in that panel.

Calibration for each Beam consists of a series of 5 voltage 'staircases' (ramps with discrete step levels), each ranging from 0 V up to the voltage level specified by the beamVoltageRanges value in the Machine Data File. Simultaneously, the Photodiode input voltage is recorded, and the input samples are considered at each of the calibration command's voltage steps. The 5 input signals are averaged together.

Based on the average measurement, the depth-of-modulation achieved by the modulator is computed - the ratio of the maximum to minimum Photodiode signal during the averaged ramp - which determines the minimum power level ('OFF') that will be supported for that Beam.

The discrete voltage levels which best correspond to the discrete, integer-valued, percentage levels ranging from the ('OFF') percentage up to 100% (corresponding to the maximum level measured) are then determined, using interpolation at each percentage step.

If the calibration appears normal/successful, ScanImage will not display anything except for a message on the command-line. The calibration measured can be viewed, by selecting Calibration >> Show Calibration Curve from the Power Controls panel menubar.

Here is an example of a successful calibration:


A successful Pockels Cell calibration curve


The curve is smooth, monotonically increasing, non-saturated, and - in this case - reaches down to the 'minimum minimum' of 1%


If ScanImage detects certain anomalies in the calibration measurement - i.e. very noisy, saturated, etc. - then it will automatically display the measured calibration data to the user, along with a warning message at the command-line, to alert the user that there is likely a problem.



To successfully detect the true depth-of-modulation of the Pockels Cell, it is important that the photodiode gain is appropriately set, so that it has sufficient signal at the low end, but also does not saturate at the high-end. Incorrect photodiode gain is a common source of Pockels calibration errors..


ScanImage internally regards the power level used as a percentage of the maximum measured power. It is possible to display/enter power levels in power units directly (e.g. millwatts), by measuring and specifying a state.init.eom.powerConversionN value in the INI File. It is the user's responsibility to determine this value.


Note the Shutter signal, if configured, is held 'Closed' during the calibration, as it is assumed that a physical shutter is located after the Beams are (physically) combined (co-aligned).


The 'staircase' ramp used during calibration is not uniform, but consists of additional steps in the lower 10% of the specified state.init.eom.pockelsVoltageRangeN. This allows for more accurate determination of the best voltage levels to achieve lower power percentages

Power Ramping


  • The Pockels feature must be enabled globally in the user's INI file via the state.init.eom.pockelsOn value
  • The individual, up to 3, Beams must be specifically enabled in the user's INI file, by uncommenting (removing the % symbol) all the values associated with that Beam (numbered 1-3) that are listed in the _standard_model.INI. These values should be adjusted as appropriate for the user's system, including at minimum the particular Analog Output board and channel ( state.init.eom.pockelsBoardIndexN and state.init.eom.pockelsChannelIndexN) to use for the Beam.
  • Control of a Pockels Cell requires that 1) a second DAQ board (at least) must be employed (see Required DAQ Hardware), and 2) the two (or more) boards must have their clocks synchronized (see Wiring Your System).
  • By supporting up to three 'Beams', ScanImage allows multiple laser beams to be combined and scanned together across the field-of-view. This allows, for instance, excitation of fluorophores at multiple wavelengths, as well as the possibility of using one or more Beams for photostimulation (often by employing the Power Box feature for those Beams).
  • Pockels Cells (and other light modulators) have a limited and characteristic depth-of-modulation, as described in the next section. ScanImage supports a depth of up to 100.
  • Translating the specified power levels into the appropriate voltage levels to generate on each of the Beam signals, requires Pockels calibration as discussed further below.
  • Quantitatively accurate Pockels calibration for each Beam requires that a Photodiode (or other light detector) be set up near each Pockels cell (or other light modulator), so the calibration can be routinely checked and updated.
    (info) The availability of a Photodiode must be specified, per each individual Beam, in the user's INI File, by identifying an Analog Input board and channel on which the signal is input ( state.init.eom.photodiodeInputBoardIdN and state.init.eom.photodiodeInputChannelN)
    (info) If no Photodiode is available for a particular Beam, a 'naive' calibration is used as discussed below
  • Because Pockels Cell depth-of-modulation is limited, many systems employ an additional Shutter to truly eliminate throughput for extended idle times.
    (info) Note that the Shutter signal, if enabled, is not 'Closed' in all contexts that the Beam signal(s) are 'OFF' (e.g. the Shutter remains 'Open' in between LOOP Repeats|SI3.6_AcqModes] and at all times during ongoing acquisitions), because physical shutters cannot be switched as fast as light modulators.
    (tick) Pockels Cell control is thus particularly useful for limiting light exposure in such contexts where Shutter must remain 'Open'
  • The individual 'Beam' signals can be configured as 'OFF' (as defined in next section) at all times during specific acquisition modes, using settings on the *BEAMS...* dialog.
    (info) Note that these values are ScanImage User Settings
    (tick) It is common, for instance, to disable a Beam used for photostimulation (often with the Power Box feature) during FOCUS mode acquisition.
  • The Beam output signals can be used as a controllable gate signal phase-locked to the Acquisition Period within each Line Period. In some cases, this can be used for controlling physiological or sensory stimulus input signals, rather than for a Pockels Cell, or other light-modulator.

Pockels Depth-of-Modulation ('ON' and 'OFF' Power Levels)

Light modulators such as Pockels Cells have a limited depth of modulation, i.e. the ratio of the maximum to minimum light transmitted by the modulator.

At this time, ScanImage supports a depth-of-modulation up to 100 and specifies the power level to transmit in 100 equally-spaced power increments. By default, ScanImage uses percent-units for power, so this corresponds to power levels ranging from 1% to 100%, in 1% (integer) increments.

ScanImage must determine the voltage-level outputs to use for the Beam signals to produce these discretized power levels. To do this, ScanImage maintains a Pockels calibration look-up table for each Beam, as described further below, which stores the voltage output level that best achieves each possible power increment. Note that a Photodiode is required for determining a quantitatively accurate look-up table.

For each of the Pockels Cell features, a key notion in ScanImage is that of the 'ON' and 'OFF' (blanked) power levels for each Beam. These can be summarized now:

  • The 'OFF' level corresponds to the minimum power level stored in the Pockels calibration look-up table for the Beam, which is generally 1%. However, it may be a higher level if the depth-of-modulation determined during the calibration is < 100.

The 'ON' level corresponds to the value set as the current Powerlevel for the Beam, in the *POWER CONTROLS* panel.


The 'OFF' level is, at minimum, 1% of the maximum power throughput determined during the Pockels calibration. This highlights that there is residual power throughput even while beam is nominally 'OFF'. For this reason, many systems employ an additional Shutter to truly eliminate throughput for extended idle times.


ScanImage generates the voltage to hold each Beam's power at its 'OFF' level in several contexts:

  • At the end of each FOCUS or GRAB acquisition
  • At the end of each LOOP Repeat, including the final Repeat
  • At the end of each Slice of an Image Stack acquisition, including the final Slice
  • At all times during acquisitions of the types not selected as 'ON' for a particular Beam in the *BEAMS...* dialog. See BEAMS....
  • During each Line Period, for the time outside of the Acquisition Period if Flyback Blanking is enabled. See Flyback Blanking.
  • During the entire final Line Period of each Frame, if Flyback Blanking and Flyback on Final Line are selected. See Slow (Y) Scan Dimension Settings.
  • As the default power level to use outside ( OUT Power) a Power Box region. See POWER BOX
(tick) As a simple rule, ScanImage generates the 'OFF' level anytime ScanImage is not acquiring, and awaiting the next trigger

ScanImage generates the voltage to put each Beam at its 'ON' level in the following contexts:

  • At all times while actively scanning, when Flyback Blanking is disabled, or for the duration of the Acquisition Period within each Line Period - extended by the Fill Frac Adjust value. See Flyback Blanking.
  • Immediately following an adjustment to the Power level in the Power Controls panel, IF Direct Mode is enabled in that panel. See POWER CONTROLS.
  • When Park 0 is enabled in the *ALIGN* panel.