I am using a legacy local version of CaImAn (v1.9.16) for longitudinal consistency in an endoscopic (CNMF-E) processing pipeline. I am implementing an iterative refinement strategy where spatial and temporal estimates from a first pass are used to seed a second pass.
When providing Ain, Cin, b_in, and f_in to the CNMF object and setting only_init=True (following the CNMF-E demo logic), the fit() function completes but leaves the estimates.YrA attribute as None.
When calling evaluate_components() immediately after, the process crashes because the evaluation logic attempts to sum the traces and residuals (C + YrA).
Minimal Reproducible Example (v1.9.16)
# Seeded Initialization for CNMF-E
# Ain, Cin, b_in, and f_in are all from the last cnmfe pass
cnm = cnmf.CNMF(n_processes=n_processes,
dview=dview,
Ain=iterativeA,
Cin=iterativeC,
b_in=iterativeb,
f_in=iterativef,
params=opts)
# opts has 'only_init': True and 'method_init': 'corr_pnr' (or 'seeded')
cnm.fit(images)
# Result: cnm.estimates.YrA is None
# This call fails:
cnm.estimates.evaluate_components(images, cnm.params, dview=dview)
Traceback
File "caiman/components_evaluation.py", line 608, in estimate_components_quality_auto
traces = C + YrA
TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'
Questions
- In v1.9.16, is it expected that
only_init=True skips the residual (YrA) calculation even when Ain is provided?
- To maintain the CNMF-E model while achieving iterative refinement, is the recommended workaround to manually call
compute_residuals() before evaluation, or should only_init be set to False for the seeded run?
- In the official demo_pipeline_cnmfE.ipynb,
only_init is set to True (Cell 11); I am concerned that changing this to False to resolve the YrA/evaluation crash might bypass the specialized CNMF-E local background model in favor of standard CNMF refinement.
- Is there a specific parameter configuration in v1.9.16 that ensures the background components are properly updated during a seeded refinement pass without reverting to the CNMF model?
Environment
CaImAn version: 1.9.16
Installation: Local source files (.../Downloads..../CaImAn-main/...)
Data Type: 1-photon/CNMF-E
I am using a legacy local version of CaImAn (v1.9.16) for longitudinal consistency in an endoscopic (CNMF-E) processing pipeline. I am implementing an iterative refinement strategy where spatial and temporal estimates from a first pass are used to seed a second pass.
When providing
Ain,Cin,b_in, andf_into theCNMFobject and settingonly_init=True(following the CNMF-E demo logic), thefit()function completes but leaves theestimates.YrAattribute asNone.When calling
evaluate_components()immediately after, the process crashes because the evaluation logic attempts to sum the traces and residuals (C + YrA).Minimal Reproducible Example (v1.9.16)
Traceback
Questions
only_init=Trueskips the residual (YrA) calculation even whenAinis provided?compute_residuals()before evaluation, or shouldonly_initbe set toFalsefor the seeded run?only_initis set toTrue(Cell 11); I am concerned that changing this toFalseto resolve the YrA/evaluation crash might bypass the specialized CNMF-E local background model in favor of standard CNMF refinement.Environment
CaImAn version: 1.9.16
Installation: Local source files (.../Downloads..../CaImAn-main/...)
Data Type: 1-photon/CNMF-E