Contributing / Developer Guide¶
This guide is for contributors and developers who want to work on PixelMap.
Development Setup¶
Prerequisites¶
Python 3.10+
uv (recommended) or pip
Installation¶
git clone https://github.com/m-beau/pixelmap.git
cd pixelmap
# Install with dev dependencies
uv sync
# Or with pip
pip install -e ".[dev]"
Running Locally¶
# Launch the GUI
uv run pixelmap
# Or if installed with pip
pixelmap
Architecture Overview¶
pixelmap/
├── __init__.py # Public API exports
├── backend.py # Core electrode selection logic
├── constants.py # Probe configurations and presets
├── types.py # Data classes (Electrode, etc.)
├── gui/
│ ├── gui.py # Panel frontend
│ ├── app_util.py # GUI helper functions
│ └── assets/ # Images and static files
├── utils/
│ └── imro.py # IMRO file reading/writing
└── wiring_maps/ # CSV/JSON files defining electrode-ADC wiring
Key Modules¶
backend.pyCore logic for electrode selection and validation. Handles ADC wiring constraints via
find_forbidden_electrodes()and generates valid channel configurations.gui/gui.pyBrowser-based interface built with NiceGUI. Handles user interactions, electrode visualization, and IMRO file downloads.
utils/imro.pyFunctions for reading, writing, and parsing IMRO files. The
generate_imro_channelmap()function is the main entry point for programmatic use.constants.pyProbe group definitions, electrode counts, and preset configurations. Edit this when adding new probe types or presets.
types.pyData classes used throughout the codebase, including the
Electrodeclass.
Testing¶
# Run all tests
pytest
# Run with coverage
pytest --cov=pixelmap
# Run specific test file
pytest tests/test_backend.py
Writing Tests¶
Tests are in the tests/ directory. When adding new functionality:
Add tests for the new feature
Ensure existing tests still pass
Aim for coverage of edge cases
Code Style¶
We use Ruff for linting and formatting:
# Check for issues
ruff check .
# Auto-fix issues
ruff check --fix .
# Format code
ruff format .
Adding New Probe Types¶
To add support for a new probe (e.g., Quadbase, NXT):
Add wiring map: Create
wiring_maps/<probe_type>_wiring.csvdefining electrode-to-ADC mappingsUpdate constants: In
constants.py, add entries to:PROBE_TYPE_MAP- SpikeGLX probe typesPROBE_N- Electrode and channel countsSUPPORTED_*_PRESETS- Available presets (if applicable)
Update GUI: In
gui/gui.py, add the probe to the dropdown optionsAdd tests: Create tests for the new probe type
Update docs: Add to the supported probes table in
index.mdandREADME.md
Contributing¶
To contribute:
Fork the repository
Create a branch with a descriptive name (e.g.,
feature/your-feature-nameorfix/bug-description)Make your changes and run tests:
pytestPush to your fork and open a pull request to the
devbranch
See CONTRIBUTING.md for full guidelines on reporting bugs, requesting features, and code style.