Package: mesmerize-core
mesmerize-coreMesmerize core backendInstallation|ExamplesA batch management system for calcium imaging analysis using the CaImAn library.
It containspandas.DataFrameandpandas.Seriesextensions that interface with CaImAn for running the various algorithms and organizing input & output data.ThisreplacestheMesmerize legacy desktop application.mesmerize-coreis 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.DocumentationWe recommend starting out with the demo notebooknotebooks/mcorr_cnmf.ipynbDocumentation is available at:https://mesmerize-core.readthedocs.io/User guide:https://mesmerize-core.readthedocs.io/en/latest/user_guide.htmlPlease use the GitHub issue tracker for any issues. For smaller questions or discussion use gitter.gitter:https://gitter.im/mesmerize_discussion/mesmerize-vizVideo tutorial/virtual workshop from September 2022:https://www.youtube.com/watch?v=0AGiAaslJdkOverviewVisualizationFor visualization we strongly recommendfastplotlib, a very new but very fast plotting library. Here are some examples offastplotlibvisualizations usingmesmerize-coreoutputs. You can create these interactive plots within jupyter notebooks, therefore they will also work on cloud computing intrastructure!View raw and motion corrected movie side by side:Contours from CNMF, good components shown here in cyan and bad components in magenta:Input movie, constructed movie(A * C), residuals(Y - A * C - b * f), and reconstructed background(b * f):Interactive Component evaluation after CNMF:https://user-images.githubusercontent.com/9403332/191207883-2393664d-b5e1-49a5-84d1-8ed7eadcf7a0.mp4As mentioned, fastplotlib is meant to be a fast plotting library which can handlemillionsof points. You can create highly complex and interactive plots to combine outputs from the CaImAn algorithms with other experimentally relevant analysis, such as behavioral data.ExamplesSee thenotebooksdirectory for detailed examples.Note thatfastplotlibis required for the visualizations.InstallationFor usersThe instructions below will installmesmerize-core.For visualization installfastplotlibinto the same environment asmesmerize-core:pipinstall"fastplotlib[notebook]"You may need to install Vulkan drivers depending on your system, see thefastplotlibrepo for more information:https://github.com/kushalkolar/fastplotlib#graphics-driversCondamesmerize-coreis availabe as a conda package which also gives you CaImAn! These instructions will give you a workingmesmerize-corealong withcaimanin the same environment.Important note: Sometimes conda or mamba will get stuck at a step, such as creating an environment or installing a package. I found that pressingEnteron your keyboard can sometimes help it continue when it pauses.Installmambainto your base environment. Skip this step if you havemamba. This step may take 10 minutes and display several messages like "Solving environment: failed with..." but it should eventually installmamba.condainstall-cconda-forgemamba# if conda is behaving slow, this command can sometimes helpcondaclean-aTo create a new environment and installmesmerize-coreinto it do this:mambacreate-nmescore-cconda-forgemesmerize-corecaimanis a dependency ofmesmerize-coreso it will automatically grabcaimantooIf you already have an environment withcaiman:mambainstall-nname-of-env-with-caimanmesmerize-coreActivate environment. You can only usemesmerize-corein the environment that it's installed into.mambaactivatemescoreInstallcaimanmanagerIf you are using an older version ofcaiman< 1.9.16, then please seeStep 4 in the old README.caimanmanagerinstallIf you have issues with this step, please post an issue on the caiman github or gitter:https://github.com/flatironinstitute/CaImAn/issuesRunipythonand verify thatmesmerize_coreis installed:# run in ipythonimportmesmerize_core
mesmerize_core.__version__Installfastplotlibfor visualization into the same environment (run this in the anaconda prompt, not ipython). You may also need to install Vulkan drivers depending on your system, see thefastplotlibrepo for more information:https://github.com/kushalkolar/fastplotlib#graphics-driverspipinstall"fastplotlib[notebook]"Optional: installsimplejpegfor much faster notebook visualization, you will need C compilers andlibjpeg-turbofor this to work:pipinstallsimplejpegpython virtual environments# create a new env in some directory# tested on python3.9 and 3.10python3.10-mvenvpython-venvs/mesmerize-coresourcepython-venvs/mesmerize-core/bin/activate# get latest pip setuptools and wheelpipinstall--upgradesetuptoolswheelpip# cd into or make a dir that has your reposmkdirreposcdrepos# install caimangitclonehttps://github.com/flatironinstitute/CaImAn.gitcdCaImAn
pipinstall-rrequirements.txt
pipinstall.
caimanmanagerinstall# install mesmerize-corepipinstallmesmerize-core# install fastplotlibpipinstall"fastplotlib[notebook]"# you should now be able to import mesmerize_core# start ipythonipython# run in ipythonimportmesmerize_core
mesmerize_core.__version__For developmentconda# install mamba in your base environmentcondainstall-cconda-forgemamba
condaclean-a# on linux and mac you can use python=3.10condacreate--namemesmerize-corepython=3.10# on windows you MUST use python=3.9condacreate--namemesmerize-corepython=3.9# activate environmentcondaactivatemesmerize-core
condaclean-a# clone this repogitclonehttps://github.com/nel-lab/mesmerize-core.gitcdmesmerize-core# update env with environment file# this installs caiman as wellmambaenvupdate-nmesmerize-core--fileenvironment.yml# install caimanmanagercaimanmanagerinstall# install mesmerize-corepipinstall.# install pytest and run tests to make sure everything works properlymambainstallpytestMESMERIZE_KEEP_TEST_DATA=1DOWNLOAD_GROUND_TRUTHS=1pytest-s.python venvs# create a new env in some directory# tested on python3.9 and 3.10python3.10-mvenvpython-venvs/mesmerize-coresourcepython-venvs/mesmerize-core/bin/activate# get latest pip setuptools and wheelpipinstall--upgradesetuptoolswheelpip# cd into or make a dir that has your reposmkdirreposcdrepos# install caimangitclonehttps://github.com/flatironinstitute/CaImAn.gitcdCaImAn
pipinstall-rrequirements.txt
pipinstall.
caimanmanagerinstall# clone this repo and install mesmerize-corecd..
gitclonehttps://github.com/nel-lab/mesmerize-core.gitcdmesmerize-core
pipinstall-e.# run tests to make sure everything worksMESMERIZE_KEEP_TEST_DATA=1DOWNLOAD_GROUND_TRUTHS=1pytest-s.