Fix unbound local error in online_cnmf when use_corr_img is true but is1p is false #1384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, in the method
OnACID._prepare_object
,d1
andd2
are only set whenself.is1p
is true, but are only used if the parameteronline['use_corr_img'] is true. I was trying to run it with
use_corr_imgbut without setting the other parameters in a way that causes
is1p` to be true, so I got an unbound local error.Since these variables are only used in one place in this function, I just moved the line that defines them to be right before they are used. I'm not 100% sure the functionality is correct, but the line just reads from
estimates.dims
, which seems pretty straightforward.Type of change
Please delete options that are not relevant.
Has your PR been tested?
Did not run the tests myself (relying on CI) but I did check that making this change prevented the error I was getting when trying to call
fit_online
with these parameters.