This repository contains the code for analyzing microsaccade selectivity as a discriminative feature for object decoding in eye tracking data.
- Microsaccade detection and analysis
- Blink detection and removal
- Glitch detection and correction
- Data preprocessing and postprocessing
- Comprehensive test suite
- Logging support
- Python 3.11 or higher
- pip (Python package installer)
- Clone the repository:
git clone https://github.com/yourusername/ms-selectivity-feature.git
cd ms-selectivity-feature- Create and activate a virtual environment (recommended):
python -m venv msenv
source msenv/bin/activate # On Windows: msenv\Scripts\activate- Install the package:
pip install -e .For development, install with additional dependencies:
pip install -e ".[dev]"from src import detect_microsaccades, detect_blinks, detect_glitches
import numpy as np
# Load your eye tracking data
timestamps = np.load('data/timestamps.npy')
x_positions = np.load('data/x_positions.npy')
y_positions = np.load('data/y_positions.npy')
# Detect microsaccades
microsaccades = detect_microsaccades(
x_positions,
y_positions,
timestamps,
velocity_threshold=6.0,
min_duration=3,
max_duration=20
)
# Detect blinks
blinks = detect_blinks(
x_positions,
y_positions,
timestamps,
min_duration=50,
min_amplitude=2.0
)
# Detect glitches
glitches = detect_glitches(
x_positions,
y_positions,
timestamps,
threshold=5.0
)For more advanced usage examples, please refer to the examples directory.
- Install development dependencies:
pip install -e ".[dev]"- Install pre-commit hooks:
pre-commit installpytestFor coverage report:
pytest --cov=src tests/This project uses:
- Black for code formatting
- isort for import sorting
- flake8 for linting
- mypy for type checking
Run all checks:
black src tests
isort src tests
flake8 src tests
mypy srcPlease read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
If you use this code in your research, please cite:
@article{nouri2025microsaccade,
title={Microsaccade selectivity as discriminative feature for object decoding},
author={Nouri, Salar and Tehrani, Amirali Soltani and Faridani, Niloufar and Toosi, Ramin and Noroozi, Jalaledin and Dehaqani, Mohammad-Reza A},
journal={Iscience},
volume={28},
number={1},
year={2025},
publisher={Elsevier}
}- List any acknowledgments here
- Include references to related work
- Credit any collaborators or institutions