/phy

phy: interactive visualization and manual spike sorting of large-scale ephys data

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

phy: interactive visualization and manual spike sorting of large-scale ephys data

Build Status codecov.io Documentation Status GitHub release PyPI release

phy is an open-source Python library providing a graphical user interface for visualization and manual curation of large-scale electrophysiological data. It is optimized for high-density multielectrode arrays containing hundreds to thousands of recording sites (mostly Neuropixels probes).

Phy provides two GUIs:

  • Template GUI (recommended): for datasets sorted with KiloSort and Spyking Circus,
  • Kwik GUI (legacy): for datasets sorted with klusta and klustakwik2.

phy 2.0b1 screenshot

What's new

  • [7 Sep 2021] Release of phy 2.0 beta 5, with some install and bug fixes
  • [7 Feb 2020] Release of phy 2.0 beta 1, with many new views, new features, various improvements and bug fixes...

Links

Installation instructions

Phy requires a recent GPU and an SSD for storing your data (the GUI may be slow if the data is on an HDD).

  1. You need a recent Python distribution.

  2. Open a terminal and type:

pip install phy --pre --upgrade
# If you plan to use the Kwik GUI, type the following without the leading hash # character:
# pip install klusta klustakwik2
  1. Phy should now be installed. Open the GUI on a dataset as follows (the phy2 environment should still be activated):
cd path/to/my/spikesorting/output
phy template-gui params.py

Dependencies

For your information, here are the Python dependencies of phy (as found in requirements.txt):

phylib
mtscomp
numpy
matplotlib
scipy
h5py
dask
cython
pillow
colorcet
pyopengl
requests
qtconsole
tqdm
joblib
click
mkdocs
PyQtWebEngine

Dealing with the error ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidget

In some environments, you might get an error message related to QtWebEngineWidget. Run the command pip install PyQtWebEngine and try launching phy again. This command should not run if the error message doesn't appear, as it could break the PyQt5 installation.

Upgrading from phy 1 to phy 2

  • Do not install phy 1 and phy 2 in the same Python environment.
  • It is recommended to delete ~/.phy/*GUI/state.json when upgrading.

Developer instructions

To install the development version of phy in a fresh environment, do:

git clone git@github.com:cortex-lab/phy.git
cd phy
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .
cd ..
git clone git@github.com:cortex-lab/phylib.git
cd phylib
pip install -e . --upgrade

Troubleshooting

Running phy from a Python script

In addition to launching phy from the terminal with the phy command, you can also launch it from a Python script or an IPython terminal. This may be useful when debugging or profiling. Here's a code example to copy-paste in a new launch.py text file within your data directory:

from phy.apps.template import template_gui
template_gui("params.py")

Credits

phy is developed and maintained by Cyrille Rossant.

Contributors to the repository are: