Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nb=0 #1172

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

nb=0 #1172

wants to merge 3 commits into from

Conversation

j-friedrich
Copy link
Contributor

Description

Enable to run CNMF without background components (nb=0) for cases when the background has already been removed in a pre-processing step using other means. Fixes #1068. (and a deprecation mentioned in #1130)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Has your PR been tested?

Yes
python caimanmanager.py test
and
python caimanmanager.py demotest

@EricThomson
Copy link
Contributor

Sounds very cool -- thanks! Will review in the next day.


Y_resf = np.dot(Y, f.T)
b = np.maximum(Y_resf, 0) / (np.linalg.norm(f)**2)
if Y.shape[-1] < 30000:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to consider making this threshold overridable or at least less magical

else:
print('estimating f')
f = 0
for xxx in np.where(not_px)[0]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we give this variable a better name?

@@ -197,7 +197,8 @@ def update_temporal_components(Y, A, b, Cin, fin, bl=None, c1=None, g=None, sn=N

A = scipy.sparse.hstack((A, b)).tocsc()
S = np.zeros(np.shape(Cin))
Cin = np.vstack((Cin, fin))
if fin is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment explaining how this works?

@pgunn
Copy link
Member

pgunn commented Sep 19, 2023

Generally looks good

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the selem keyword was deprecated at scikit learn, and we still have it, it might be nice to define what it means in this function: e.g., in the docs for it maybe just mention it stands for 'structuring element'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean skimage? I remember playing with this years ago, it means something like the "where stuff is multiplier" =S

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes oops scikitimage

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if Y.shape[-1] < 30000:
f = Y[not_px, :].mean(0)
else:
print('estimating f')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few print statements in here -- in final draft convert to logger info or debug statements?

Copy link
Contributor

@EricThomson EricThomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and is pushing things in an important direction. This makes changes to both block coordinate descent update functions, so let's just keep an eye open for weirdness. 😄

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.

4 participants