Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

#fip multifiber A minimal GUI for doing frame-projected independent-fiber photometry

See paper in Nature Methods for details:

Kim, C., Yang, S., Pichamoorthy, N., Young, N., Kauvar, I., Jennings, J., Lerner, T., Berndt, A., Lee, S.Y., Ramakrishnan, C., Davidson, T., Inoue, M., Bito, H., & Deisseroth, K. (2016). Simultaneous fast measurement of circuit dynamics at multiple sites across the mammalian brain. Nature Methods.


Frame-projected independent-fiber photometry records the sum fluorescence from each of several optical fibers by imaging the fiber bundle onto a camera sensor and digitally cropping and summing the fluorescence from each fiber. Alternating excitation wavelengths for successive frames enables concurrent sampling of multiple spectral channels and/or optical stimulation.

Hardware setup description

The software synchronizes various hardware (light sources, camera acquisition, behavoral apparatuses) by using digital and analog output voltage waveforms and reads image frames from the camera. The measure camera signal from each fiber position can be processed, visualized and accessed in real-time, and saved to hard disk for later analysis. In addition, simultaneous analog input recording is enabled.

Up to 4 analog output waveforms can be user-defined for controlling behavoral apparatuses and other hardware.

The software is based on MATLAB's GUI interface and Image and Data Acquisition toolboxes.

Hardware requirements

Note: It may be possible to modify the software to work with other MATLAB-supported cameras and DAQ cards.

  1. Hamamatsu Orca Flash4.0 V2
  2. National Instruments DAQ Card (PCIe-6343-X and BNC-2090A/BNC-2110)
  3. PC to support the above hardware -- see Hamamatsu PC Recommendations

Software requirements

  1. MATLAB (tested with R2013b, R2014b, R2015a, R2015b)
  2. MATLAB Image Acquisition toolbox and adaptor for camera. The Image Acquisition toolbox may require the Image Processing toolbox.
  3. MATLAB Data Acquisition toolbox

Installation and configuration

  1. Ensure the camera and DAQ hardware are accessible using their provided software (e.g. HCImage Live).
  2. Ensure the MATLAB toolboxes and camera adaptor are installed (see above).
  3. Run fipgui.m.
  4. In the GUI, select the counter channels to correspond to the physical DAQ connections.

Real-time data access

In the GUI, select a call-back function, e.g. sample_scripts/sample_callback.m.

User-defined analog output voltage waveforms

Run sample_generate_ao_waveform.m or sample_generate_ao_waveform_stim.m to produce an example waveform file, then in the GUI, select that waveform .mat file.

Implementation detail: the digital counter waveforms and analog output waveforms are in the same Session object, so the synchronization will be consistent across acquisition sessions. However, the precise synchronization may be different with different versions of MATLAB (e.g. R2013b to R2015b and possibly more). Use analog input recording to verify the accuracy of any synchronization, and adjust the analog output waveform accordingly (e.g. set stim_start in sample_scripts/sample_generate_ao_waveform_stim.m).

Analog input recording

Ensure the desired physical connections are made to the DAQ analog input channels. Then, in the GUI, enable the checkbox for analog input recording. A .csv file will be saved along with the other acquisition data. Visualize the recorded data by using the GUI button or plotLogFile.m.

A note about maximum acquisition rate

The maximum acquisition rate may depend on several factors:

  1. The camera readout time. For the Orca's bidirectional center-outwards rolling shutter, the camera readout time is set by the minimum of the distance from the farthest row from the center to the center of the image sensor, and the distance between the two most-distant rows.
  2. (Untested but likely) time it takes callback function to run
  3. (Untested but likely) efficiency of live plotting


  1. The tests/ directory contains tests for checking each hardware component separately.
  2. If the GUI crashes during initialization, there may be a problen with the configurations that FIPGUI persists between sessions. Try running rmpref('FIPGUI') at the Matlab command line and try again.
  3. If the camera acquisition cannot keep up, as a last resort, try increasing handles.computer_dependent_delay.


A GUI and library for doing multi-fiber photometry



No releases published


No packages published