Skip to content

BelloneLab/pyBer

Repository files navigation

pyBer logo

pyBer

Fiber photometry, from raw photons to publishable figures, without leaving the app.
Load it. Clean it. Align it. Model it. Export it. All in one polished desktop GUI.

Python 3.11 PySide6 + pyqtgraph Windows GPLv3 Formats


Why pyBer?

Photometry analysis usually means duct-taping five scripts together and praying your timestamps line up. pyBer puts the whole pipeline behind one interactive window: artifact cleaning, motion correction, behavior and DIO alignment, sub-millisecond camera-to-fiber synchronization, PSTHs, transient detection, and temporal modeling. Interactive workflow on top, deterministic and testable processing code underneath.

Built for neuroscientists who want to see every step, not just trust a black box.


See it in action

Preprocess raw traces into clean dFF

Raw signal, fitted-isosbestic baseline, and motion-corrected dFF, side by side, with DIO markers laid right over the trace. Filtering, baseline, artifact handling, and export all live in the rail on the left.

Preprocessing panel

Sync fiber photometry time with reference time

Point an ROI at a sync LED in a video, extract the on/off train, or load a reference signal recorded simultaneously, and auto-align with the same signal recorded with photometry.

LED barcode sync extraction


Quick install

Install Miniforge or Anaconda first, then:

cd path\to\pyBer
conda env create -f environment.yml
conda activate pyBer
Rscript -e "install.packages('fastFMM', repos='https://cloud.r-project.org')"
python .\pyBer\main.py

The fastFMM step is only needed for the FLMM temporal modeling panel. Everything else works without it.

Launch from VS Code

  1. Open the repository folder in VS Code.
  2. Select the interpreter from the pyBer conda environment.
  3. Open pyBer/main.py.
  4. Press Run, or:
conda activate pyBer
python .\pyBer\main.py

If VS Code grabs the wrong Python, run Python: Select Interpreter and pick the environment created from environment.yml.


What you can do

  • 🧹 Preprocess raw traces: filtering, resampling, baseline correction, motion correction, and artifact handling.
  • 🔍 Hunt artifacts with interpolation, cutout, local low-pass filtering, or no-op.
  • 🎥 Synchronize photometry time to camera or behavior time from shared TTL/barcode columns, and export a time_aligned column for downstream work.
  • 📊 Align to behavior (DIO, behavior states, onsets, or transitions) and build individual or group PSTHs, heatmaps, and event-duration plots.
  • Detect transients and compare amplitudes with baseline-prominence normalized metrics.
  • 🧠 Model with a continuous GLM or trial-level FLMM, then rank feature contribution with leave-one-feature-out summaries.
  • 💾 Export processed CSV or HDF5 with stable, self-describing column names and a .pyber.json metadata sidecar (embedded inside the HDF5), ready for Python, MATLAB, R, or Prism. What you select is what you get, and the exact output definition is always recorded.

Documentation

The full user guide lives in docs/index.md: installation, first launch, preprocessing, postprocessing, transient detection, temporal modeling, group workflows, export, and troubleshooting.

Repository layout

Path What it is
pyBer/main.py Application entry point and preprocessing window.
pyBer/analysis_core.py Preprocessing and signal-processing backend.
pyBer/gui_preprocessing.py Preprocessing panels.
pyBer/gui_postprocessing.py Postprocessing, PSTH, sync, metrics, and export.
pyBer/led_extract.py LED / barcode sync-signal extraction.
pyBer/time_sync.py Edge detection, pairing, and cross-correlation alignment.
pyBer/temporal_modeling.py GLM and FLMM modeling panel.
environment.yml Conda environment for development and user installs.
pyBer.spec PyInstaller build configuration.

Build the executable

From an activated environment:

conda activate pyBer
python -m PyInstaller --noconfirm --clean pyBer.spec

The executable is written to dist/pyBer.exe.

Notes

pyBer sets PYTHONNOUSERSITE=1 so stale packages from the user Python folder cannot shadow the conda environment. This keeps Qt, pyqtgraph, numpy, and rpy2 stable on Windows.


Made with 🧠 and a lot of dFF at the Bellone Lab.

About

Analysis of fiber photometry data with GUI

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages