Skip to content

JCorson/Python_LSPS

Repository files navigation

Python LSPS

Python control system for laser scanning photostimulation (LSPS) experiments on in vitro brain slice preparations. The system steers a laser across a configurable grid of stimulation sites using galvanometer scanning mirrors, triggers electrophysiology recording sweeps via a Molecular Devices DigiData digitizer, captures a tissue image at the end of each run, and saves all data to a .npz file for analysis in Python. A PySide6 GUI provides a live camera feed with a real-time stimulation-grid overlay and experiment controls.


Users

Hardware System

PC (Python / PySide6)
        │
        │  USB serial — 115,200 baud
        │
   Arduino Uno
        ├── I2C 0x62 ──► MCP4725 DAC ──► X Galvo Mirror ─┐
        ├── I2C 0x63 ──► MCP4725 DAC ──► Y Galvo Mirror ─┘  (laser positioning)
        │
        ├── Digital pin 16 ──────────────────────────────► DigiData  "Start Sweep" trigger
        └── Digital pin 17 ◄────────────────────────────── DigiData  "Recording Done"

PC (OpenCV)
        │
        └── USB / frame-grabber ────────────────────────► Camera (e.g. Dage-MTI IR-1000)

The Arduino positions the laser by writing 12-bit DAC values to two Adafruit MCP4725 boards over I2C. A rising-then-falling edge on pin 16 triggers a DigiData recording sweep; the Arduino polls pin 17 and waits for the DigiData to signal completion before moving to the next site.

Running the Application

Install the package and launch the GUI:

uv sync
uv run lsps

Developers

Setting Up a Dev Environment

uv sync --group dev

This installs all runtime dependencies plus the dev tools (pytest, pytest-cov, ruff).

Running the Test Suite

uv run pytest --cov=src/lsps --cov-report=term-missing

Code Formatting and Linting

uv run ruff format src/ tests/   # auto-format
uv run ruff check src/ tests/    # lint

To auto-fix lint issues flagged as safe to fix automatically:

uv run ruff check --fix src/ tests/

License

This project is licensed under the GNU General Public License v3.0 or later. See LICENSE for the full text.

About

This llibrary is for executing a laser scanning photostimulation experiment in python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors