Welcome to NeuraLib’s documentation!
API Reference
Release Notes
Checkout Release notes
Installation
Create and activate a new conda environment (Python>=3.9, but >=3.11 not yet tested), then install:
conda create -n neuralib python=3.9
conda activate neuralib
pip install neura-library
If you wish to install all dependencies, run:
pip install neura-library[all]
If you wish to install the minimal required dependencies according to usage purpose:
Choices in
[]:atlas,scanner,calimg,segmentation,model,track,gpu,profile,imagelib,tools,fullExample of using
atlasmodule:
pip install neura-library[atlas]
If install as developer mode (Install pre-commit and linter check by ruff):
pip install neura-library[dev]
pre-commit install
ruff check .
Install uv, run in Unix or git bash (Windows):
curl -LsSf https://astral.sh/uv/install.sh | sh
Follow uv project structure doc:
uv init
Make sure python version (>=3.9, but >=3.11 not yet tested), both in pyproject.py and .python-version
uv python install 3.9
If you wish to install all dependencies, run:
uv add neura-library[all]
If you wish to install the minimal required dependencies according to usage purpose:
Choices in
[]:atlas,scanner,calimg,segmentation,model,track,gpu,profile,imagelib,tools,fullExample of using
atlasmodule:
uv add neura-library[atlas]
If install as developer mode (Install pre-commit and linter check by ruff):
uv add neura-library[dev]
pre-commit install
ruff check .
CLI project.scripts
brender -h
See examples in api
Notebook Demo
- Example usage of
neuralib.calimg - Example usage of
neuralib.tracking.facemap - Example usage of 2P dataset in
neuralib.model.rastermap - Example usage of widefield in
neuralib.model.rastermap - Example usage of
neuralib.segmentation - Example slice view of
neuralib.atlas - Example brain view of
neuralib.atlas.ibl - Example usage of
neuralib.plot
Modules
neuralib.atlas
Module for whole brain, slice view visualization and rois classification
neuralib.atlas.ccf: Customized hierarchical classification for the mouse brain atlasneuralib.atlas.brainrender: CLI-based wrapper for brainrenderneuralib.atlas.cellatlas: Volume and cell types counts for each brain region, refer to Cell Atlasneuralib.atlas.ibl: Slice view plotting wrapper for ibllib and iblatlas
neuralib.calimg
Module for 2-photon calcium imaging acquisition and result parsing
neuralib.calimg.scan_image: Data acquired from ScanImage (under DEV)neuralib.calimg.scanbox: Data acquired from Scanboxneuralib.calimg.suite2p: Result parser for suite2pneuralib.calimg.spikes: dF/F to spike activity (OASIS/Cascade)
neuralib.segmentation
Module for neuronal segmentation
neuralib.segmentation.cellpose: Result parser and batch running for cellposeneuralib.segmentation.stardist: Result parser and batch running for stardist
neuralib.locomotion
Module for handle animal’s locomotion
neuralib.locomotion.epoch: Selection of specific epoch (i.e., running, stationary)neuralib.locomotion.position: Position in environment, current only support 1D circular (i.e., linear treadmill)
neuralib.model
neuralib.model.bayes_decoding: Position decoding using population neuronal activity
neuralib.model.rastermap: Run and result parser for rastermap
neuralib.morpho
Morphological reconstruction data presentation
neuralib.tracking
neuralib.tracking.deeplabcut: Result parser for DeepLabCut
neuralib.tracking.facemap: Result parser for facemap
Utilities Modules
neuralib.argp
Use argparse as dataclass field
neuralib.persistence
Caching the analyzed results (i.e., concatenation for statistic purpose)
neuralib.sqlp
Python functions to build a SQL (sqlite3) statement.
neuralib.dashboard
Interactive dashboard visualization
neuralib.plot
Module for general plotting purpose
neuralib.imglib
Image processing library
neuralib.io
File IO and example dataset
neuralib.tools.gspread
Google spreadsheet API wrapper for read/write
neuralib.tools.slack_bot
Real-time Slack notification bot for analysis pipeline
neuralib.util.cli_args
Run script as subprocess
neuralib.util.color_logging
Logging with color format
neuralib.util.gpu
OS-dependent GPU info
neuralib.util.profile
Simple benchmark profile testing and debugging
neuralib.util.table
Rich table visualization
neuralib.util.segments
Epoch or value segments
Doc for Array type
Array[DType, [*Shape]]DType= array datatype.Shape= array shape.|= Union
Example
intorboolwith (N,3) array ->Array[int|bool, [N, 3]]floatarray with union shape (N,2) or (N,T,2) ->Array[float, [N, 2]|[N, T, 2]]