Skip to content

Add more VolPy tests - #1596

Merged
pgunn merged 1 commit into
flatironinstitute:devfrom
eeshaanjum:volpy-tests
Nov 14, 2026
Merged

pgunn merged 1 commit into
flatironinstitute:devfrom
eeshaanjum:volpy-tests

Conversation

@eeshaanjum

Copy link
Copy Markdown

Description

#1587 added the first three VolPy tests, all on a single cell. This adds 24 more to caiman/tests/test_volpy.py, and changes no code outside that file.

What they cover:

  • VOLPY.fit() on a synthetic three-cell movie with negative-going spikes: each cell's own spikes are found, index picks a subset of cells, weights from a first run can be passed to a second, and a run on a multiprocessing pool matches a serial one.
  • spikepursuit.volspike() with weight_update='NMF', the simple threshold, one iteration, an even context_size and a raised min_spikes, plus its two input errors.
  • adaptive_thresh(), simple_thresh() and denoise_spikes() on traces with known spikes.
  • The atm method, through atm.volspike() and through VOLPY, and its helper functions.
  • reconstructed_movie() and volparams.change_params().

The tests run about 85% of the lines in spikepursuit.py and atm.py and 94% of volpy.py. What's left is mostly plotting. I didn't try to cover the GUI and Mask R-CNN code in utils.py.

Two things came up while writing these, and I've filed them separately instead of touching the code here:

The three existing tests are unchanged, except that test_volspike_detection now uses a shared match_spikes() helper instead of its own loop.

Type of change

None of the listed options fits. This only adds tests.

Branching

Targets dev.

Has your PR been tested?

Yes, on macOS 14.7 (Apple M1 Pro):

  • caimanmanager test on Python 3.12: 79 passed (51 before).
  • test_volpy.py on its own under Python 3.12, 3.11 and 3.9, several times each: 31 passed every time, in about 20 seconds.
  • To check the tests can fail, I broke VolPy in nine small ways one at a time (ignoring flip_signal, shrinking the context region, picking the wrong ROI, and so on). Each one was caught by at least one test.
  • yapf --diff on the test file is clean.

Everything was run on macOS, so I'll watch the Linux CI here. I didn't run caimanmanager demotest, since nothing outside the test file changed.

@eeshaanjum

Copy link
Copy Markdown
Author

The three checks failed in "Install OS Dependencies", before any tests ran. It looks like the same libglapi-mesa problem from #1593, so I don't think it's related to this change.

@pgunn if it would save you some time, I'm happy to look at the CI image and send a small PR for it. Otherwise I'll re-run the checks here once it's fixed.

@pgunn

pgunn commented Nov 14, 2026

Copy link
Copy Markdown
Member

If you rebase that should get the tests going again hopefully

Cover VOLPY.fit, the atm method, the threshold functions and reconstructed_movie
@pgunn
pgunn merged commit 3783d48 into flatironinstitute:dev Nov 14, 2026
3 checks passed
@pgunn

pgunn commented Nov 14, 2026

Copy link
Copy Markdown
Member

Thanks! Solid work

@eeshaanjum

Copy link
Copy Markdown
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants