pyPhotometry

Open source, Python based, fiber photometry data acquisition.


Acquisition board

Overview

pyPhotometry is system of open source hardware and software for neuroscience fiber photometry data acquisition, consisting of an acquisition board and graphical user interface.

pyPhotometry supports data aquisition from two analog and two digital inputs, and control of two LEDs via built in LED drivers with an adjustable 0-100mA output. The system supports time-division multiplexed illumination which allows fluoresence evoked by different excitation wavelengths to be independenly readout from a single photoreciever signal.

For validation experiments see the pyPhotometry manuscript.

For questions about the pyPhotometry system contact the google group.

pyPhotometry hardware, software and documentation repositories are on GitHub.


Getting started

Dependencies

pyPhotometry has the following dependencies:

  • Python 3 (version 3.7.5 recomended as pyqtgraph is not currently compatible with 3.8)
  • pyserial
  • numpy
  • pyqt5
  • pyqtgraph

On a windows machine that does not already have Python installed, the simplest way to install Python is to download an installer from python.org. To ensure you can run Python files (including the pyControl GUI) by double clicking on them, select the options 'Add Python to PATH', 'Add Python to environment variables', and 'Associate files with Python' during installation. Note; selecting these options when installing Python will cause the Python version you are installing to take precedence over any other version of Python installed on the computer, so may break previous Python based workflows on the computer.

Once you have a working Python 3 installation on the computer, run the windows command prompt (cmd.exe) as an administrator and enter the following commands to install the required packages:

python -m pip install numpy
python -m pip install pyserial
python -m pip install pyqt5
python -m pip install pyqtgraph

You should then be able to launch the GUI by double clicking the file photometry_gui.py in the folder pyPhotometry/GUI.

pyPhotometry has been tested primarily on Windows 10 but in principle should be cross platform. You may need to install the micropython USB drivers to ensure your operating system recognizes the board and can open a serial connection to it, see micropython windows setup and the micropython docs. The micropython drivers are unsigned so to install them on Windows 10, follow the instructions here under Install Unsigned Drivers from Advanced Boot Menu. You should only need to do this the first time you install the drivers on a computer.

Installation

Download the latest version of pyPhotometry as a zip file from the releases page.

Unzip the file and you will have the following folder structure:

- GUI   # Graphical user interface code.
- uPY   # Code that runs on the Micropython Microcontroller.
- tools # Tools for importing pyPhotometry data.
- data  # Default data directory.

Hardware

The acquisition board can be purchased from the Open Ephys store for €350 or built from components. Assembly instructions for a red/green photometry system are provided in the hardware user guide.

Running an experiment

Connect a pyPhotometry acquisition board to the computer with a USB cable, it will show up as both a USB serial port and a flash drive.

Copy the files photometry_upy.py and hardware_config.py from pyPhotometry/uPY to the root directory of the acquisition board flash drive.

Load the GUI by running the file photometry_gui.py in the folder pyPhotometry/GUI, you will see a GUI window like that shown above.

Select your aqusition board using the Serial port drop down menu and connect to the board with the connect button.

Select the data acquisition mode, for more information see the GUI user guide.

Press Start to start data acquisition.

Adjust the LED currents (and photoreciever gain if applicable) to bring the signals into the center of the 0 - 3.3V range covered by the analog inputs. Signals that exceed 3.3V it will be clipped. If the signal is very low the signal to noise ratio will be less good. When adjusting the LED current it is recommended to use the 'two colour continous' acquisition mode as this mode does not use baseline subtraction so the signal you see is the raw photoreciever voltage.

To record data enter a subject ID and data directory and press Record.

For information on opening data files generated by pyPhotometry see Importing data.

If you encounter problems take a look at the troubleshooting page or contact the google group.