• Stars
    star
    620
  • Rank 71,901 (Top 2 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created about 9 years ago
  • Updated 17 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Computational toolbox for large scale Calcium Imaging Analysis, including movie handling, motion correction, source extraction, spike deconvolution and result visualization.

CaImAn

A Python toolbox for large scale Calcium Imaging data Analysis and behavioral analysis.

CaImAn implements a set of essential methods required in the analysis pipeline of large scale calcium imaging data. Fast and scalable algorithms are implemented for motion correction, source extraction, spike deconvolution, and component registration across multiple days. It is suitable for both two-photon and one-photon fluorescence microscopy data, and can be run in both batch and online modes. CaImAn also contains some routines for the analysis of behavior from video cameras. A list of features as well as relevant references can be found here.

Requirements

Right now, CaImAn works and is supported on the following platforms:

  • Linux on 64-bit x86 CPUs
  • MacOS on 64-bit x86 CPUs
  • Windows on 64-bit x86 CPUs

32G RAM is required for a good experience, and depending on datasets, more may be necessary.

CaImAn presently targets Python 3.9. Parts of CaImAn are written in C++, but apart possibly during install, this is not visible to the user. There is also an older implementation of CaImAn in Matlab (unsupported). That version can be used with MCMC spike inference

Other hardware

  • ARM-based versions of Apple hardware work (if on a 16G model), but currently happen under x86 emulation and we cannot support them as well. A native OSX port is planned for late 2021/early 2022.
  • Support for Linux on ARM (e.g. AWS Graviton) is not available (but it may work with the port of conda, if you compile Caiman yourself - we do not have binary packages and this is untested). If you care about this, please let us know.

Install

The supported ways to install CaImAn use the Anaconda python distribution. If you do not already have it, first install a 3.x version for your platform from here. Familiarise yourself with Conda before going further. If you are using an M1-based Mac, please ignore the ARM builds of conda; install an x86 version instead (ignore any warnings you get while doing so; it will work fine).

We strongly recommend installing the mamba package into your base environment, with 'conda install -c conda-forge mamba', using it to build your conda environment. Mamba performs the same environment creation tasks that the base conda tool does, but far faster. In the instructions below, we assume you're using mamba, but if you're not, you can run the same commands with the conda tool instead.

There are a few supported install methods.

The easiest (and strongly recommended on Windows) is to use a binary conda package, installed as the environment is built. Install this with 'mamba create -n caiman -c conda-forge caiman'. This is suitable for most use, if you don't need to change the internals of the caiman package. You do not need to fetch the source code with this approach.

Another option is to build it yourself; you will need a working compiler (easy on Linux, fairly easy on OSX, fairly involved on Windows). Clone the sources of this repo, create an environment with all the prereqs with 'mamba env create -n caiman -f environment.yml', activate the environment, and then do a 'pip install .' or 'pip install -e .' The former is a user install, the latter is more suitable for active development on the caiman sources.

There are other ways to build/use caiman, but they may get less or no support depending on how different they are.

More detailed docs on installation can be found here.

After installing the software, the caimanmanager.py script (which will be put in your path on Linux and OSX) is used to unpack datafiles and demos into a directory called caiman_data. Invoke it with the "install" argument.

If you are on Windows, the mechanism to put caimanmanager.py in your path may not work; in this case, you can locate it by typing python to bring up an interactive shell, and then

>>> import sysconfig
>>> sysconfig.get_path('scripts')

You can invoke it as follows:

python C:/PATH/ABOVE/caimanmanager.py install

If you want to use GPU functionality and have a GPU where you're running CaImAn (most likely a Linux system), you'll want, after you build your conda environment, to switch to a GPU build of the tensorflow package (conda list will tell you, after the version string, what build variant you have - you most likely will get an mlk build, but a "conda search -c conda-forge tensorflow" will probably show you some gpu variants you can switch to - pick one appropriate for your conda version, ideally of the same version of tensorflow you otherwise got). If you need help switching versions, reach out to us on the gitter channel.

Getting Started

If you used caimanmanager to unpack the demos and data files, you will find in the caiman_data folder a set of demos and jupyter notebooks. demo_pipeline.py and demo_behavior.py (or their notebook equivalents) are good introductions to the code.

Papers and data

Main paper

A paper explaining most of the implementation details and benchmarking can be found here.

@article{giovannucci2019caiman,
  title={CaImAn: An open source tool for scalable Calcium Imaging data Analysis},
  author={Giovannucci, Andrea and Friedrich, Johannes and Gunn, Pat and Kalfon, Jeremie and Brown, Brandon L and Koay, Sue Ann and Taxidis, Jiannis and Najafi, Farzaneh and Gauthier, Jeffrey L and Zhou, Pengcheng and Khakh, Baljit S and Tank, David W and Chklovskii, Dmitri B and Pnevmatikakis, Eftychios A},
  journal={eLife},
  volume={8},
  pages={e38173},
  year={2019},
  publisher={eLife Sciences Publications Limited}
}

All the results and figures of the paper can be regenerated using this package. For more information visit this page.

CaImAn implements a variety of algorithms for analyzing calcium (and voltage) imaging data. A list of references that provide the theoretical background and original code for the included methods can be found here.

If you use this code please cite the corresponding papers where original methods appeared as well the companion paper.

Videos

These talks by Andrea Giovannucci from past CaImAn workshops/events are an excellent start for newcomers. They go through NoRMCorre, CNMF(E) and VolPy.

Open Neuroscience talks, this is a good high-level introduction to CaImAn:

https://www.youtube.com/watch?v=5APzPRbzUIA

Nemonic workshops, more in depth:

https://www.youtube.com/watch?v=KjHrjhvhRy0

https://www.youtube.com/watch?v=rUwIqU6gVvw

https://www.youtube.com/watch?v=NZZ6_zo0YIM

https://www.youtube.com/watch?v=z6TlH28MLRo

Real-time analysis of microendoscopic 1p data

Our online algorithms can be used for real-time analysis of live-streaming data. An example for real-time analysis of microendoscopic 1p data is shown in the notebook demos/notebooks/demo_realtime_cnmfE.ipynb. For more information about the approach check the paper.

Analysis pipeline for Voltage Imaging data

VolPy is an analysis pipeline for voltage imaging data. The analysis is based on following objects:

  • MotionCorrect: An object for motion correction which can be used for both rigid and piece-wise rigid motion correction.
  • volparams: An object for setting parameters of voltage imaging. It can be set and changed easily and is passed into the algorithms.
  • VOLPY: An object for running the spike detection algorithm and saving results.

The object detection network Mask R-CNN in VolPy is now compatible with tensorflow 2.4 or above.

To see examples of how these methods are used, please consult the demo_pipeline_voltage_imaging.py script in the demos/general folder. For more information about the approach check the general paper on this pipeline.

Documentation & Wiki

Documentation of the code can be found here.

Other docs:

Main developers:

  • (emeritus) Eftychios A. Pnevmatikakis, Flatiron Institute, Simons Foundation
  • (emeritus) Andrea Giovannucci, University of North Carolina, Chapel Hill
  • Johannes Friedrich, Flatiron Institute, Simons Foundation
  • Changlia Cai, University of North Carolina, Chapel Hill
  • Pat Gunn, Flatiron Institute, Simons Foundation

A complete list of contributors can be found here.

Currently Pat Gunn and Johannes Friedrich are the most active maintainers.

Supplementary repos

  • use_cases repo - Contains additional code (unmaintained) demonstrating how to use/extend CaImAn

Related packages

  • jnormcorre - JAX implementation of NoRMCorre for motion correction using JAX acceleration
  • funimag - matrix decomposition for denoising and compression
  • mesmerize-core - parameter optimization, data organization and visualizations with caiman
  • improv - a platform for creating online analysis workflows

If you have questions about these related packages please reach out to them directly.

Questions, comments, issues

For support, you can create a Github issue describing any bugs you wish to report, or any feature requests you may have.

You may also use the gitter chat room for discussion.

Finally, you may reach out via email to one of the primary maintainers (above).

Acknowledgements

Special thanks to the following people for letting us use their datasets in demo files:

  • Weijian Yang, Darcy Peterka, Rafael Yuste, Columbia University
  • Sue Ann Koay, David Tank, Princeton University
  • Manolis Froudarakis, Jake Reimers, Andreas Tolias, Baylor College of Medicine
  • Clay Lacefield, Randy Bruno, Columbia University
  • Daniel Aharoni, Peyman Golshani, UCLA

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

More Repositories

1

DeepFRI

Deep functional residue identification
Python
291
star
2

finufft

Non-uniform fast Fourier transform library of types 1,2,3 in dimensions 1,2,3
C++
280
star
3

CaImAn-MATLAB

Complete Matlab pipeline for large scale calcium imaging data analysis
MATLAB
248
star
4

NoRMCorre

Matlab routines for online non-rigid motion correction of calcium imaging data
MATLAB
139
star
5

deepblast

Neural Networks for Protein Sequence Alignment
Python
107
star
6

FMM3D

Flatiron Institute Fast Multipole Libraries --- This codebase is a set of libraries to compute N-body interactions governed by the Laplace and Helmholtz equations, to a specified precision, in three dimensions, on a multi-core shared-memory machine.
Fortran
90
star
7

cufinufft

Nonuniform fast Fourier transforms of types 1 and 2, in 1D, 2D, and 3D, on the GPU
Cuda
83
star
8

jax-finufft

JAX bindings to the Flatiron Institute Non-uniform Fast Fourier Transform (FINUFFT) library
Python
77
star
9

sparse_dot

Python wrapper for Intel Math Kernel Library (MKL) matrix multiplication
Python
73
star
10

nemos

NEural MOdelS, a statistical modeling framework for neuroscience.
Python
73
star
11

sciware

Learning materials for scientific software development
HTML
61
star
12

mountainsort

Spike sorting software
C++
48
star
13

inferelator

Task-based gene regulatory network inference using single-cell or bulk gene expression data conditioned on a prior network.
Python
45
star
14

mountainlab-js

MountainLab is data processing, sharing and visualization software for scientists. It is built around MountainSort, spike sorting software, but is designed to be more generally applicable.
JavaScript
43
star
15

bayes-kit

Bayesian inference and posterior analysis for Python
Python
41
star
16

neurosift

Browser-based NWB visualization and DANDI exploration
TypeScript
40
star
17

online_psp

A collection of computationally efficient algorithms for online subspace learning and principal component analysis
Python
38
star
18

spikeforest2

SpikeForest -- spike sorting analysis for website -- version 2
Python
34
star
19

mcmc-monitor

Monitor MCMC runs in the browser
TypeScript
34
star
20

nixpack

nix+spack = nixpack (spanix?)
Python
34
star
21

figurl

Shareable, interactive scientific figures in the cloud
Python
31
star
22

disBatch

Tool to distribute a list of computational tasks over a pool of compute resources. The pool can grow or shrink.
Python
31
star
23

mountainsort5

MountainSort spike sorting algorithm, version 5
Python
30
star
24

ironclust

Spike sorting software being developed at Flatiron Institute, based on JRCLUST (Janelia Rocket Cluster)
Jupyter Notebook
28
star
25

st_gridnet

A Python implementation of the model described in our publication "A convolutional neural network for common-coordinate registration of high-resolution histology images" developed principally for applications to registration of spatial transcriptomics image data.
Python
25
star
26

mountainsort_examples

Examples of using MountainSort spike sorting software.
Jupyter Notebook
25
star
27

SkellySim

Hydrodynamic Cytoskeleton Simulator
C++
23
star
28

catvae

Categorical Variational Autoencoders
Jupyter Notebook
22
star
29

spikeforest

Spike sorting benchmarking system
Python
22
star
30

online_psp_matlab

Benchmark of online PCA algorithms
MATLAB
22
star
31

fmm2d

This codebase is a set of libraries to compute N-body interactions governed by the Laplace and Helmholtz equations, to a specified precision, in two dimensions, on a multi-core shared-memory machine.
Fortran
21
star
32

nifty-ls

A fast Lomb-Scargle periodogram. It's nifty, and uses a NUFFT!
Python
20
star
33

slurm-prometheus-exporter

Prometheus exporter for slurm job/node data
Haskell
20
star
34

kachery-cloud

Python
20
star
35

dendro

Analyze neuroscience data in the cloud
TypeScript
19
star
36

comptools24

Computational Tools for PDEs with Complicated Geometries and Interfaces workshop materials, June 10-14, 2024.
MATLAB
18
star
37

aLENS

a Living ENsemble Simulator -- a lens to help you watch biophysics
C++
17
star
38

spikeforest_old

SpikeForest -- spike sorting analysis for website
Python
16
star
39

baobzi

An adaptive fast function approximator based on tree search
C++
14
star
40

isosplit5

ISO-SPLIT clustering (stand-alone version)
C++
14
star
41

bio-sfa

Code for reproducing the experiment from the paper "A biologically plausible neural network for Slow Feature Analysis"
Jupyter Notebook
12
star
42

pytorch-finufft

Pytorch wrappers for the FINUFFT library
Python
11
star
43

sf_benchmarks

Special function benchmarks
C++
10
star
44

mantis

Manifold-tiling Localized Receptive Fields are Optimal in Similarity-preserving Neural Networks
Python
10
star
45

flathub

A simple elasticsearch frontend for serving astrophysical simulation catalog data
Haskell
10
star
46

ccq-software-build

CCQ software build scripts
Shell
10
star
47

public_www

Basic templates for individual user pages in the public/_www directory
SCSS
9
star
48

inferelator-prior

Gene regulatory network inference using DNA-binding motifs and chromatin accessibility data.
Python
9
star
49

Ensemble-reweighting-using-Cryo-EM-particles

Jupyter Notebook
9
star
50

boxcodes3d

This repository contains box codes for evaluating volume potentials for Laplace, Helmholtz, Maxwell, and Stokes
Fortran
9
star
51

bio-nica

Code for reproducing the experiments in the paper "Bio-NICA: A biologically inspired single-layer network for Nonnegative Independent Component Analysis"
Jupyter Notebook
9
star
52

cppdlr

Discrete Lehmann representation of imaginary time Green's functions
C++
8
star
53

nix-modules

nixpkgs-based module builds of cluster packages
Nix
8
star
54

bio-cca

Code accompanying the paper "A biologically plausible neural network for multi-channel Canonical Correlation Analysis"
Jupyter Notebook
8
star
55

reactopya

React components paired with Python classes for backend computation
JavaScript
8
star
56

PointCloud_Regression

Point Cloud regression with new algebraic representation on ModelNet dataset (ICCV 2023)
Python
8
star
57

clair

Clair (Clang Introspection and Reflection) tools. A set of clang tools developed for Flatiron/CCQ
C++
8
star
58

adapol

Adaptive Pole Fitting for Quantum Many-Body Physics
Jupyter Notebook
8
star
59

DLR_DMFT_scripts

Python
7
star
60

kbucket

System for sharing data for scientific research
JavaScript
7
star
61

ccn-template

Template repository for CCN software projects
Python
7
star
62

neutorch

neuron segmentation and synapse detection using PyTorch
Python
7
star
63

SlurmUtil

slurm monitoring tools and interface
Python
7
star
64

q2-matchmaker

A qiime2 plugin for case-control differential abundance analysis
Jupyter Notebook
6
star
65

mountainlab

Scientific data analysis, sharing, and visualization
C++
6
star
66

least_absolute_regression

Least absolute error regression implemented using Linear Programming, primarily to illustrate repository structure conventions.
Jupyter Notebook
6
star
67

neuropixels-data-sep-2020

Example neuropixels datasets for purposes of developing spike sorting algorithms
Python
6
star
68

ephys-viz

Neurophysiology visualization components deployable to the notebook, web, or desktop
JavaScript
6
star
69

inverse-obstacle-scattering2d

This repository contains codes for solving inverse obstacle scattering problems to recover the shape of the obstacle for sound soft, sound hard, and penetrable objects
Fortran
6
star
70

cryoSBI

Python
6
star
71

kachery-p2p

Peer-to-peer content-addressable file sharing using kachery
TypeScript
5
star
72

gp-shootout

Benchmark and compare large-scale Gaussian process regression methods in 1D, 2D, and 3D, from MATLAB
MATLAB
5
star
73

ccn-software-fens-2024

Materials for CCN software workshop at FENS 2024
Python
5
star
74

looking_glass_3d_test

Test of displaying 3d genomic data using webgl in a "Looking glass" holographic display
5
star
75

caiman_central

Central hub for resources related to Caiman calcium imaging analysis package.
Jupyter Notebook
5
star
76

labbox-ephys

TypeScript
4
star
77

FREYA

Canine breast cancer analysis pipeline
Jupyter Notebook
4
star
78

spikesortercomparison

Notes on metrics and datasets for community spike sorting comparison and validation
TeX
4
star
79

hither

Run batches of Python functions in containers and on remote servers
Python
4
star
80

ILCnetworks

Gene regulatory networks for intestinal innate lymphoid cells
Jupyter Notebook
4
star
81

Fermi_surface_visualization

Interactive visualization of Fermi surfaces representing electron energies and velocities in crystal structures.
Python
4
star
82

flatiron-coffee

Meet your colleagues across the Institute
Python
4
star
83

spike-front

Front end tool for benchmarking spike sorting algorithms.
JavaScript
4
star
84

ccm_widgets

Reactopya widgets of relevance to the Center for Computational Mathematics, Flatiron Institute
JavaScript
4
star
85

Cryo-EM-Heterogeneity-Challenge-1

The Inaugural Flatiron Institute Cryo-EM Heterogeneity Community Challenge
Jupyter Notebook
4
star
86

kvsstcp

Key value storage server. Light weight (single python module with no non-standard module dependencies). Simple protocol minimizes effort needed to write a client (example for C and FORTRAN provided).
Python
4
star
87

bio-lda

Code accompanying the paper "A linear discriminant analysis model of imbalanced associative learning in the mushroom body compartment"
Jupyter Notebook
3
star
88

Baobzi.jl

Wrapper library for Baobzi interpolator library
Julia
3
star
89

ftk

Factorization of the translation kernel for fast rigid image alignment
Python
3
star
90

sciware-testing-cpp

C++
3
star
91

binary_classification_metrics

Visualizations and other code for exploring binary classification metrics.
Jupyter Notebook
3
star
92

inverse-volume-scattering2d

This repository contains beta MATLAB codes for data generation of forward medium problems using a hybrid HPS-HBS solver, and an inverse medium solver
MATLAB
3
star
93

stan-playground

Run Stan models in the browser
TypeScript
3
star
94

qt-mountainview

Visualization of spike sorting experiments to be used as a plugin package to mountainlab-js
C++
3
star
95

fgt2d

This repository contains codes for evaluating sums and integrals of gaussians in two dimensions
Fortran
3
star
96

spikeforest_recordings

Ephys recordings for the SpikeForest project
Python
3
star
97

quantum_rosetta_private

Playing with quantum computing algorithms for protein and peptide design and structure prediction, with interfaces for the Rosetta software suite. (Repository created by Vikram K. Mulligan, [email protected]).
C#
3
star
98

mcmc-monitor-old

Monitor MCMC runs
Python
3
star
99

h5_to_json

Represent hdf5 files via json, separating out large binary content into individual files
Python
3
star
100

mountainsort_examples-old

Examples for getting started with MountainSort spike sorting software
MATLAB
2
star