NeuraLib2
A modular Python toolkit for rodent systems neuroscience research.
NeuraLib2 is a collection of lightweight, modular packages designed for neuroscience data analysis. It is the successor to neuralib, split into focused packages to minimize dependencies and enable case-specific installation.
Brain atlas interfaces, 3D visualization, and anatomical data manipulation.
Spike inference, image registration, and widefield imaging analysis.
Unified interfaces for segmentation, tracking, and microscopy data.
Dimensionality reduction, Bayesian decoding, and locomotion analysis.
Installation
Install only the packages you need:
pip install neuralib-atlas
pip install neuralib-imaging # Basic
pip install neuralib-imaging[cascade] # With spike inference
pip install neuralib-imaging[widefield] # With widefield analysis
pip install neuralib-imaging[all] # All features
pip install neuralib-parser # Basic
pip install neuralib-parser[suite2p] # Suite2p support
pip install neuralib-parser[czi] # CZI format support
pip install neuralib-parser[all] # All features
pip install neuralib-metric # Basic
pip install neuralib-metric[rastermap] # With rastermap
pip install neuralib-metric[all] # All features
pip install neuralib-utils # Basic (required by all)
pip install neuralib-utils[dashboard] # With Bokeh dashboard
pip install neuralib-utils[plot] # With plotting tools
pip install neuralib-utils[all] # All features
git clone https://github.com/ytsimon2004/neuralib2.git
cd neuralib2/packages/<package-name>
uv pip install -e . # Basic
uv pip install -e ".[all]" # With all features
Packages
neuralib-atlas
Brain atlas tools and hierarchical representations of mouse brain anatomy.
|
Atlas data access (Allen CCF, Kim, Perens, Princeton) |
|
Allen Common Coordinate Framework operations |
|
Cell type distributions across brain regions |
|
3D brain region visualization |
neuralib-imaging
Cellular imaging and widefield imaging analysis tools.
|
Spike inference (CASCADE, OASIS deconvolution) |
|
Coordinate transformation and atlas alignment |
|
Widefield imaging (FFT, SVD, hemodynamic correction) |
neuralib-parser
Data parsers for neuroscience tools and file formats.
|
Cellpose segmentation result parser |
|
StarDist segmentation parser and CLI |
|
Suite2p imaging data parser |
|
Scanbox imaging data parser |
|
DeepLabCut tracking parser |
|
Facemap behavioral tracking parser |
|
Neuron morphology (SWC files) |
|
Confocal microscopy (Zeiss CZI, LSM) |
neuralib-metric
Analysis metrics and computational modeling tools.
Rastermap |
Dimensionality reduction for neural data |
Bayesian decoding |
Position decoding from neural activity |
Locomotion |
Locomotion epoch detection |
neuralib-utils
Core utilities and foundational tools. Required by all other packages.
|
File I/O (HDF5, JSON, CSV) |
|
Unified type system (pandas/polars DataFrames) |
|
Logging, DataFrame ops, GPU monitoring |
|
Persistence decorator for structured data caching |
|
Publication-quality plotting (PSTH, Venn) |
|
Bokeh-based interactive visualization |
|
Image processing utilities |
|
External integrations (Google Sheets, Slack) |
Command-Line Tools
nl_brainrender
Visualize brain region data with built-in rendering support. See BrainRender for examples.
nl_brainrender -h
Documentation
Reference
Array Annotation Syntax
Used in documentation to describe array-shaped data structures:
Array[DType, [*Shape]]
DType= data type (e.g.,int,float,bool)Shape= array shape (e.g.,[N, T])|= union of shapes or types
Examples:
Array[int|bool, [N, 3]]— Boolean or integer array with shape(N, 3)Array[float, [N, 2] | [N, T, 2]]— Float array with shape(N, 2)or(N, T, 2)