Skip to main content

Important note for new users and new projects

The caiman library, its algorithms, and software are old and dated at this point. We STRONGLY recommend new users or existing users with new projects to migrate to masknmf. masknmf is an entirely new library written from the ground-up, using newer algorithms, better software architectures, and follows better practices that are coherent with the scientific python community. masknmf also scales to larger datasets since it uses lazy-loading and lazy-compute structures. This means you can use it with very large datsets that are hundreds of gigabytes in size. It is also being developed in conjunction with fastplotlib which gives you the latest visualization tools.

mesmerize-core and mesmerize-viz are still being maintained for existing users who need assistance with ongoing projects, but we strongly encourage new users or new projects to migrate to masknmf. You will probably save significant time by using masknmf instead of mesmerize. You will get better results and a more versatile and robust analysis and visualization experience with masknmf.

mesmerize-core

Linux pip Linux Conda MacOS Conda Windows Conda Documentation Status Conda Version

Mesmerize core backend

Installation | Examples

A batch management system for calcium imaging analysis using the CaImAn library. It contains pandas.DataFrame and pandas.Series extensions that interface with CaImAn for running the various algorithms and organizing input & output data.

This replaces the Mesmerize legacy desktop application.
mesmerize-core is MUCH faster, more efficient, and offers many more features! For example there are simple extensions which you can just call to get the motion correction shifts, CNMF reconstructed movie, CNMF residuals, contours etc.

Documentation

We recommend starting out with the demo notebook notebooks/mcorr_cnmf.ipynb

Documentation is available at: https://mesmerize-core.readthedocs.io/
User guide: https://mesmerize-core.readthedocs.io/en/latest/user_guide.html

Getting Help

Please use the GitHub issue tracker for any issues, and discussions for discussions. We no longer use gitter. If you are in the Slack, we usually only respond on slack around workshops. GitHub is for long term support.

Video tutorial/virtual workshop from September 2022 (quite outdated, if you have question post on github): https://www.youtube.com/watch?v=0AGiAaslJdk

Overview

batch_management

Visualization

Install mesmerize-viz for visualization. Mesmerize-viz gives you ready-to-use viuslizations for motion correction and CNMF - including component exploration, interactive component evaluation using metrics, and manual addition or removal of components.

pip install mesmerize-viz

:exclamation: Harware requirements The large CNMF visualizations with contours etc. usually require either a dedicated GPU or integrated GPU with access to at least 1GB of VRAM.

You may need to install drivers depending on your system, see the fastplotlib repo for more information: https://github.com/kushalkolar/fastplotlib#graphics-drivers

If you use fastplotlib directly you can create highly complex and interactive plots to combine outputs from the CaImAn algorithms with other experimentally relevant analysis, such as behavioral data.

epic

Examples

See the notebooks directory for detailed examples.

Installation

For users

The instructions below will install mesmerize-core.

Conda

mesmerize-core is available as a conda package which also gives you CaImAn. These instructions will give you a working mesmerize-core along with caiman in the same environment.

Important note: Sometimes conda or mamba will get stuck at a step, such as creating an environment or installing a package. Pressing Enter on your keyboard can sometimes help it continue when it pauses.

  1. Install mamba into your base environment. Skip this step if you have mamba. This step may take 10 minutes and display several messages like "Solving environment: failed with..." but it should eventually install mamba.
conda install -c conda-forge mamba

# if conda is behaving slow, this command can sometimes help
conda clean -a
  1. To create a new environment and install mesmerize-core into it do this:

```bash` mamba create -n mescore -c conda-forge mesmerize-core


`caiman` is a dependency of `mesmerize-core` so it will automatically grab `caiman` too

If you already have an environment with `caiman`:

```bash
mamba install -n name-of-env-with-caiman mesmerize-core
  1. Activate environment. You can only use mesmerize-core in the environment that it's installed into.
mamba activate mescore
  1. Install caimanmanager

If you are using an older version of caiman < 1.9.16, then please see Step 4 in the old README.

caimanmanager install

If you have issues with this step, please post an issue on the caiman github or gitter: https://github.com/flatironinstitute/CaImAn/issues

  1. Run ipython and verify that mesmerize_core is installed:
# run in ipython
import mesmerize_core
mesmerize_core.__version__
  1. Install mesmerize-viz for visualization into the same environment (run this in the anaconda prompt, not ipython). You may also need to install graphics drivers depending on your system, see the fastplotlib repo for more information: https://github.com/kushalkolar/fastplotlib#graphics-drivers
pip install mesmerize-viz

Strongly recommended: install simplejpeg for much faster notebook visualization, you will need C compilers and libjpeg-turbo for this to work:

pip install simplejpeg

python virtual environments

# create a new env in some directory
# tested on python3.9 and 3.10
python3.10 -m venv python-venvs/mesmerize-core
source python-venvs/mesmerize-core/bin/activate

# get latest pip setuptools and wheel
pip install --upgrade setuptools wheel pip

# cd into or make a dir that has your repos
mkdir repos
cd repos

# install caiman
git clone https://github.com/flatironinstitute/CaImAn.git
cd CaImAn
pip install -r requirements.txt
pip install .
caimanmanager install

# install mesmerize-core
pip install mesmerize-core

# install mesmerize-viz
pip install mesmerize-viz

# install simplejpeg
pip install simplejpeg

# you should now be able to import mesmerize_core
# start ipython
ipython

# run in ipython
import mesmerize_core
mesmerize_core.__version__

For development

conda

# install mamba in your base environment
conda install -c conda-forge mamba
conda clean -a

conda create --name mesmerize-core

# activate environment
conda activate mesmerize-core
conda clean -a

# clone this repo
git clone https://github.com/nel-lab/mesmerize-core.git
cd mesmerize-core

# update env with environment file
# this installs caiman as well
mamba env update -n mesmerize-core --file environment.yml

# install caimanmanager
caimanmanager install

# install mesmerize-core
pip install .

# install pytest and run tests to make sure everything works properly
mamba install pytest
MESMERIZE_KEEP_TEST_DATA=1 DOWNLOAD_GROUND_TRUTHS=1 pytest -s .

python venvs

# create a new env in some directory
# tested on python3.9 and 3.10
python3.10 -m venv python-venvs/mesmerize-core
source python-venvs/mesmerize-core/bin/activate

# get latest pip setuptools and wheel
pip install --upgrade setuptools wheel pip

# cd into or make a dir that has your repos
mkdir repos
cd repos

# install caiman
git clone https://github.com/flatironinstitute/CaImAn.git
cd CaImAn
pip install -r requirements.txt
pip install .
caimanmanager install

# clone this repo and install mesmerize-core
cd ..
git clone https://github.com/nel-lab/mesmerize-core.git
cd mesmerize-core
pip install -e .

# run tests to make sure everything works
MESMERIZE_KEEP_TEST_DATA=1 DOWNLOAD_GROUND_TRUTHS=1 pytest -s .

Metadata

Release files for mesmerize-core 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mesmerize-core 0.6.0
File Size Uploaded
mesmerize_core-0.6.0.tar.gz 53.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mesmerize-core 0.6.0
File Interpreter ABI Platform
mesmerize_core-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 114.2 kB

Release files / mesmerize_core-0.6.0.tar.gz

Download URL mesmerize_core-0.6.0.tar.gz
Size 53.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0ab2ba4c6d17ddada291aa7cab85692dc39a4218ca1457fd76e731afe0d41a8f
BLAKE2b-256 checksum
How to use checksums
a8e58d7b9a8669f0ae52a719c7d6196f11947e433a5a6c069651361d9015f86f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / mesmerize_core-0.6.0-py3-none-any.whl

Download URL mesmerize_core-0.6.0-py3-none-any.whl
Size 60.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a1fa40f3e9d3ef72da38704c2028e4d2f47b539df27d17cf2b3e7643d9c66b6
BLAKE2b-256 checksum
How to use checksums
66bb6cb33b6c9653dd049735e2472261e9d8055749d1092dc79a26dc4acef5ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page