Skip to content

Commit ae7a6a5

Browse files
authored
Merge pull request #12 from flatironinstitute/main
Pull from `upstream/main`
2 parents 6e577c7 + 0b5a9e1 commit ae7a6a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1848
-1380
lines changed

.github/workflows/run_tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ jobs:
2929
environment-file: environment-minimal.yml
3030
activate-environment: caiman
3131
conda-solver: libmamba
32+
miniforge-version: latest
3233

3334
- name: Install OS Dependencies
3435
shell: bash -l {0}
3536
run: |
36-
sudo apt-get install libglapi-mesa libegl-mesa0 libegl1 libopengl0 libgl1-mesa-glx
37+
sudo apt-get update && sudo apt-get install libglapi-mesa libegl-mesa0 libegl1 libopengl0
3738
3839
- name: Install Dependencies
3940
shell: bash -l {0}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ __pycache__/
5252

5353
# C extensions
5454
*.so
55-
*.c
55+
caiman/source_extraction/cnmf/oasis.cpp
5656

5757
#movie tif
5858
*.tif

CONTRIBUTING.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# CaImAn contributors guide :hammer:
2-
CaImAn is an open source project where *everyone* is welcome and encouraged to contribute. We have external contributors from all over the world, and we are always looking for more help. This guide explains how to contribute: if you have questions about the process, please feel free to reach out at [GitHub Discussions](https://github.com/flatironinstitute/CaImAn/discussions). Everyone needs help contributing and finds git/GitHub confusing, so please don't be shy about asking.
1+
# CaImAn guide to contributing
2+
CaImAn is an open source project with contributors from many people at many places. Help is available on [Gitter](https://app.gitter.im/#/room/#agiovann_Constrained_NMF:gitter.im) or [Github Discussions](https://github.com/flatironinstitute/CaImAn/discussions).
33

4-
There are many different ways you can contribute to Caiman. The first and easiest way is to bring problems to our attention: if you find a bug, or think there is a feature that is lacking in Caiman, please [open an issue at Github](https://github.com/flatironinstitute/CaImAn/issues). You can also contribute just by *participating* in the different forums.
4+
If you run into issues or want to suggest features, you can [open an issue on Github](https://github.com/flatironinstitute/CaImAn/issues).
55

66
Second, let's say you want to improve something yourself:
77

88
- Documentation like what you are currently reading
99
- The demo notebooks
1010
- The code base
1111

12-
We welcome *all* such contributions. To make them, you need to make changes on your local version of Caiman and then push make a *Pull Request* (PR) to our GitHub repository. We will walk through this process in the rest of the document.
12+
To contribute, start by making changes on your local version of Caiman and then push make a *Pull Request* (PR) to our GitHub repository. We will walk through this process in the rest of the document.
1313

14-
Before you go through the work required to improve something, we recommend that you let us know your plans on GitHub either in discussions or issues. This way, we can avoid duplicated effort (if someone is already working on it), or wasted time (it could turn out the changes might not be feasible right now because it conflicts with some other major feature we are working on). If needed, can usually set up a video chat to talk about a feature proposal if that works for you.
14+
Before you go through the work required to improve something, we recommend that you reach out on GitHub by filing a feature request in an issue. This way, we can avoid duplicated effort (if someone is already working on it), or wasted time (we may not agree on direction).
1515

1616
## Background: how do pull requests work?
1717
In this section we'll give general background on how making a contribution/PR works. If you know this stuff and just want to get started quickly, feel free to skip to the next section.
@@ -28,7 +28,7 @@ The workflow for contributing to Caiman is roughly illustrated by the numbers in
2828
3) Make a PR: this is when you request that your changes become merged into `dev` at Caiman. This merge won't be immediate, you will get feedback on your code, and probably be asked to make some changes.
2929
4) Periodically, as features accumulate in the `dev` branch (every month or so), the `dev` branch will be merged with `main`. This will become a new version of Caiman that people install when they run `mamba install caiman`.
3030

31-
Below we have instructions on how to do all of the above steps. While all of this may seem like a lot, some of the steps are extremely simple. Also, once you have done it once, you will have the recipe and it will be pretty easy. Finally, it is a very rewarding experience to contribute to an open source project -- we hope you'll take the plunge!
31+
Below we have instructions on how to do all of the above steps.
3232

3333
## First, create a dedicated development environment
3434
If you have downloaded Caiman for standard use, you probably installed it using `conda` or `mamba` as described on the README page. As a contributor, you will want to set up a dedicated development environment. This means you will be setting up a version of Caiman you will edit and tweak, uncoupled from your main installation for everyday use. To set up a development environment so you can follow the workflow outlined above, do the following:
@@ -57,7 +57,7 @@ Go to the [Caiman repo](https://github.com/flatironinstitute/CaImAn) and hit the
5757

5858
This installs Caiman directly from the downloaded source code. The `-e` stands for 'editable': when you edit the files, the changes should immediately be reflected in the code you run.
5959

60-
Note this section is partly based on the excellent [docs from Matplotlib](https://matplotlib.org/devdocs/devel/development_setup.html#installing-for-devs).
60+
Note this section is partly based on the [docs from Matplotlib](https://matplotlib.org/devdocs/devel/development_setup.html#installing-for-devs).
6161

6262

6363
## Second, work on a feature
@@ -86,21 +86,15 @@ Note that all PRs are reviewed by other programmers. This is an important part o
8686
You may be asked to make some changes (or to *think* about making some changes). You will sometimes need to do more some more work on your branch and make more changes after making an initial PR. In this case, the workflow is simple: you will work within your your local `my_feature` branch as before, and run the `push` command again. Conveniently, this will automatically push the changes to the same work-in-progress PR at Caiman. Eventually, the feature will be merged into `dev` and your work is done!
8787

8888
## Fourth, wait for the work to show up in main :clock8:
89-
Once your work is done, the `dev` branch will eventually be merged into `main` by the developers who maintain Caiman (label 4 in the figure). This is done every month or two, and is the stage when your work will actually be available to the people who download Caiman. It's at this point your name will appear when you click on the [list of Contributors](https://github.com/flatironinstitute/CaImAn/graphs/contributors) at GitHub. Please give yourself a pat on the back -- we really appreciate the folks who go through all this work to help make the package better!
89+
Once your work is done, the `dev` branch will eventually be merged into `main` by the developers who maintain Caiman (label 4 in the figure). This is done every month or two, and is the stage when your work will actually be available to the people who download Caiman. It's at this point your name will appear when you click on the [list of Contributors](https://github.com/flatironinstitute/CaImAn/graphs/contributors) at GitHub.
9090

9191
# What next?
9292
Once you have gone through the above steps, you can delete your local feature branch. Before working on a new feature, you will want to make sure that your fork stays up to date with Caiman. You can do this with the user interface at GitHub (there is a button to sync up your repo with the original repository on a particular branch).
9393

94-
Nobody remembers all the git commands, don't worry if you constantly are looking things up: that's what *everyone* does. If you want to learn more, check out the following resources:
94+
If you want to learn more, check out the following resources:
9595

9696
* [Getting started with git/github](https://github.com/EricThomson/git_learn)
9797
* [GitHub on Contributing to a Project](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)
9898
* [GitHub skillbuilding](https://skills.github.com/)
9999
* [Scipy git resources](https://docs.scipy.org/doc/scipy/dev/gitwash/gitwash.html#using-git)
100100

101-
Again, if you want to contribute and find any of the above bits confusing, please reach out!
102-
103-
104-
105-
106-

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pipeline {
3434
export THEANO_FLAGS="base_compiledir=$TEMPDIR/theano_tmp"
3535
cd $TEMPDIR
3636
caimanmanager.py install
37-
nosetests --traverse-namespace caiman
37+
pytest --pyargs caiman
3838
caimanmanager.py demotest
3939
'''
4040
}
@@ -58,7 +58,7 @@ pipeline {
5858
export CAIMAN_DATA=$TEMPDIR/caiman_data
5959
cd $TEMPDIR
6060
caimanmanager.py install
61-
nosetests --traverse-namespace caiman
61+
pytest --pyargs caiman
6262
'''
6363
}
6464
}

README.md

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,71 @@
11
<a href="https://colab.research.google.com/drive/1vkp-uPV8tKavmX12bcN2L-jYH8_MgmHL?usp=sharing"><img src="https://img.shields.io/badge/-Colab%20Demo-blue" /></a>
22

33

4-
CaImAn
4+
Caiman
55
======
66
<img src="https://github.com/flatironinstitute/CaImAn/blob/main/docs/LOGOS/Caiman_logo_2.png" width="400" align="right">
77

88
A Python toolbox for large-scale **Ca**lcium **Im**aging **An**alysis.
99

10-
CaImAn implements a set of essential methods required to analyze calcium and voltage imaging data. It provides fast and scalable algorithms for motion correction, source extraction, spike deconvolution, and registering neurons across multiple sessions. It is suitable for both two-photon and one-photon fluorescence microscopy data, and can be run in both offline and online modes. Documentation is [here](https://caiman.readthedocs.io/en/latest/).
10+
Caiman implements a set of essential methods required to analyze calcium and voltage imaging data. It provides fast and scalable algorithms for motion correction, source extraction, spike deconvolution, and registering neurons across multiple sessions. It is suitable for both two-photon and one-photon fluorescence microscopy data, and can be run in both offline and online modes. Documentation is [here](https://caiman.readthedocs.io/en/latest/).
1111

12-
Caiman Central
13-
--------------
14-
- [Caiman Central](https://github.com/flatironinstitute/caiman_central) is the hub for sharing information about CaImAn. Information on quarterly community meetings, workshops, other events, and any other communications between the developers and the user community can be found there.
12+
# Installation
13+
There are two primary ways to install Caiman.
1514

16-
# Quick start :rocket:
17-
Follow these three steps to get started quickly, from installation to working through a demo notebook. If you do not already have conda installed, [you can find it here](https://docs.conda.io/en/latest/miniconda.html). There is a video walkthrough of the following steps [here](https://youtu.be/b63zAmKihIY?si=m7WleTwdU0rJup_2).
15+
## Route A
16+
The easiest route is to install the miniforge distribution of Anaconda, and use that to install the rest using prebuilt packages. Most users should take this path.
1817

19-
### Step 1: Install caiman
18+
## Route B
19+
The alternative route is to make sure you have a working compiler, create a python virtualenv, grab the caiman sources, and use pip to populate the virtualenv and build Caiman. This route is not as tested and is not presently documented; it is a standard pip-based install.
20+
21+
# Quick start (Route A)
22+
Follow these three steps to get started quickly, from installation to working through a demo notebook. If you do not already have conda installed, [you can find it here](https://github.com/conda-forge/miniforge). The miniforge distribution of conda is preferred; it will require fewer steps and likely encounter fewer issues. If you are using a different distro of conda, you will likely need to add `-c conda-forge` to the commands you use to make your environment.
23+
24+
Windows users will temporarily need to use an alternative install path.
25+
26+
### Step 1: Install Caiman
2027
The following is all done in your anaconda prompt, starting in your base environment:
2128

22-
conda install -n base -c conda-forge mamba # install mamba in base environment
23-
mamba create -n caiman -c conda-forge caiman # install caiman
24-
conda activate caiman # activate virtual environment
29+
mamba create -n caiman caiman # build a caiman environment
30+
conda activate caiman # activate the environment
31+
32+
### Step 1: Install Caiman (alternative for Windows users)
33+
Windows users will need to follow an alternative set of steps because tensorflow does not have good packaging for Windows with conda (packaging changes are underway to solve this but are not available as of this writing).
34+
35+
First, you will need to install Visual Studio 2019 or possibly a later version, with the C++ compiler and commandline utilities.
36+
Then you will clone this repo to your windows system, and enter the checkout directory.
37+
38+
Next, you will build and activate a mostly-empty conda environment:
39+
40+
mamba create -n caiman python=3.11 pip vs2019_win-64
41+
conda activate caiman
42+
43+
Finally, you will use pip to install Caiman's prerequisites and Caiman itself:
44+
pip install .
45+
46+
This step may fail if the compiler is not correctly installed and is the most fragile part of this install route; reach out if you encounter issues.
47+
48+
After this, assuming you succeed, leave the source directory. Later steps will not function correctly when run in the source/checkout directory.
2549

2650
### Step 2: Download code samples and data sets
27-
Create a working directory called `caiman_data` that includes code samples and related data. Run the following command from the same virtual environment that you created in Step 1:
51+
Create a working directory called `caiman_data` that includes code samples and related data. Run the following command from the same conda environment that you created in Step 1:
2852

2953
caimanmanager install
3054

3155
### Step 3: Try out a demo notebook
3256
Go into the working directory you created in Step 2, and open a Jupyter notebook:
3357

3458
cd <your home>/caiman_data/
35-
jupyter notebook
59+
jupyter lab
3660

3761
Jupyter will open. Navigate to demos/notebooks/ and click on `demo_pipeline.ipynb` to get started with a demo.
3862

39-
> Note that what counts as `<your home>` in the first line depends on your OS/computer. Be sure to fill in your actual home directory. On Linux/Mac it is `~` while on Windows it will be something like `C:\Users\your_user_name\`
63+
> `<your home>` in the first line is your home directory, its location depdnding on your OS/computer. On Linux/Mac it is `~` while on Windows it will be something like `C:\Users\your_user_name\`
4064
4165
## For installation help
42-
Caiman should install easily on Linux, Mac, and Windows. If you run into problems, we have a dedicated [installation page](./docs/source/Installation.rst): the details there should help you troubleshoot. If you don't find what you need there, *please* [create an issue](https://github.com/flatironinstitute/CaImAn/issues) at GitHub, and we will help you get it sorted out.
66+
Caiman should install easily on Linux, Mac, and Windows. If you run into problems, we have a dedicated [installation page](./docs/source/Installation.rst). If you don't find what you need there, [create an issue](https://github.com/flatironinstitute/Caiman/issues) on GitHub.
4367

44-
# Demo notebooks :page_with_curl:
68+
# Demo notebooks
4569
Caiman provides demo notebooks to showcase each of our main features, from motion correction to online CNMF. We recommend starting with the CNMF notebook (`demo_pipeline.ipynb`), which contains more explanation and details than the other notebooks: it covers many concepts that will be used without explanation in the other notebooks. The CNMFE notebook (`demo_pipeline_cnmfE.ipynb`), is also more detailed. Once you've gotten things set up and worked through those "anchor" notebooks, the best way to get started is to work through the demo notebook that most closely matches your use case; you should be able to adapt it for your particular needs.
4670

4771
The main use cases and notebooks are listed in the following table:
@@ -67,12 +91,12 @@ Caiman also provides commandline demos, similar to the notebooks, demonstrating
6791

6892
# How to get help
6993
- [Online documentation](https://caiman.readthedocs.io/en/latest/) contains a lot of general information about Caiman, the parameters, how to interpret its outputs, and more.
70-
- [GitHub Discussions](https://github.com/flatironinstitute/CaImAn/discussions) is our preferred venue for users to ask for help.
94+
- [GitHub Discussions](https://github.com/flatironinstitute/Caiman/discussions) is our preferred venue for users to ask for help.
7195
- The [Gitter forum](https://app.gitter.im/#/room/#agiovann_Constrained_NMF:gitter.im) is our old forum: we sometimes will ask people to join us there when something can best be solved in real time (e.g., installation problems).
72-
- If you have found a bug, we recommend searching the [issues at github](https://github.com/flatironinstitute/CaImAn/issues) and opening a new issue if you can't find the solution there.
96+
- If you have found a bug, we recommend searching the [issues at github](https://github.com/flatironinstitute/Caiman/issues) and opening a new issue if you can't find the solution there.
7397
- If there is a feature you would like to see implemented, feel free to come chat at the above forums or open an issue at Github.
7498

75-
# How to contribute :hammer:
99+
# How to contribute
76100
Caiman is an open-source project and improves because of contributions from users all over the world. If there is something about Caiman that you would like to work on, then please reach out. We are always looking for more contributors, so please come read the [contributors page](./CONTRIBUTING.md) for more details about how.
77101

78102
# Videos
@@ -89,7 +113,7 @@ The following talks are more in depth:
89113
* https://www.youtube.com/watch?v=z6TlH28MLRo
90114

91115

92-
# Related repositories :pushpin:
116+
# Related repositories
93117
There are many repositories that use Caiman, or help make using Caiman easier.
94118

95119
* [use\_cases repo](https://github.com/flatironinstitute/caiman_use_cases): additional code (unmaintained) demonstrating how to reproduce results in some Caiman-related papers, and how to use/extend Caiman.
@@ -119,13 +143,12 @@ If possible, we'd also ask that you cite the papers where the original algorithm
119143
# Main developers
120144
* (emeritus) Eftychios A. Pnevmatikakis, **Flatiron Institute, Simons Foundation**
121145
* (emeritus) Andrea Giovannucci, **University of North Carolina, Chapel Hill**
122-
* Johannes Friedrich, **Allen Institute, Seattle Washington**
123-
* Changjia Cai, **University of North Carolina, Chapel Hill**
146+
* (emeritus) Johannes Friedrich, **Allen Institute, Seattle Washington**
147+
* (emeritus) Changjia Cai, **University of North Carolina, Chapel Hill**
148+
* Kushal Kolar, **Flatiron Institute, Simons Foundation**
124149
* Pat Gunn, **Flatiron Institute, Simons Foundation**
125-
* Eric Thomson, **Flatiron Institute, Simons Foundation**
126-
127-
A complete list of contributors can be found [here](https://github.com/flatironinstitute/Caiman/graphs/contributors). Currently Pat Gunn, Johannes Friedrich, and Eric Thomson are the most active contributors.
128150

151+
A complete list of contributors can be found [here](https://github.com/flatironinstitute/Caiman/graphs/contributors).
129152

130153
# Acknowledgements
131154
Special thanks to the following people for letting us use their datasets in demo files:
@@ -136,6 +159,12 @@ Special thanks to the following people for letting us use their datasets in demo
136159
* Manolis Froudarakis, Jake Reimers, Andreas Tolias, Baylor College of Medicine
137160
* Clay Lacefield, Randy Bruno, Columbia University
138161
* Daniel Aharoni, Peyman Golshani, UCLA
162+
* Darcy Peterka, Columbia
163+
164+
Also a special thanks to:
165+
* Eric Thompson, for various strong contributions to code and demos, both before and during his employment at the Flatiron Institute.
166+
* Cai Changjia, for Volpy
167+
* Ethan Blackwood, for several contributions in various areas
139168

140169
# License
141170
This program is free software; you can redistribute it and/or

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.11.2
1+
1.11.5

0 commit comments

Comments
 (0)