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

BUG: singular values for more than 1 ROI are not stored in S_mot and S_mov #107

Open
kushalbakshi opened this issue Jun 9, 2023 · 0 comments · May be fixed by #128
Open

BUG: singular values for more than 1 ROI are not stored in S_mot and S_mov #107

kushalbakshi opened this issue Jun 9, 2023 · 0 comments · May be fixed by #128

Comments

@kushalbakshi
Copy link

kushalbakshi commented Jun 9, 2023

Version information:

0.1.dev758+g4fad3c1 from conda info | grep facemap

Describe the issue:

Singular values for the motionSVD and movieSVD within the proc.npy output only contain a single 1D array of size = number of components from the last ROI in the proc.npy file. Below is some example code to help demonstrate:

In [1]: import numpy as np

In [2]: dataset = np.load(./Whisker_proc.npy', allow_pickle=True).item()

In [3]: dataset["rois"] = [roi for roi in dataset["rois"] if "SVD" in roi["rtype"]]   # Keeps only SVD regions

In [4]: len(dataset["movSVD"])
Out[4]: 4

In [6]: dataset["movSVD"][3].shape
Out[6]: (32504, 124)

In [7]: dataset["movSv"].shape
Out[7]: (124,)

In [8]: dataset["movSVD"][2].shape
Out[8]: (32504, 287)

Since dataset["movSVD"] is a list with data for each ROI, dataset["movSv"] should contain the singular values as a list for each ROI. Instead, dataset["movSv"] only contains a single array where the statement dataset["movSVD"][-1].shape[1] == dataset["movSv"].shape[0] is always True. It is currently not possible to view singular values for other ROIs from the .npy output.

This creates an IndexError if facemap data is inserted into a DataJoint pipeline from the proc.npy file because the pipeline expects to receive singular values for each ROI.

Since the behavior described above holds true for both motionSVD and movieSVD, I have created a fix on my fork of facemap where S_mot and S_mov are initiated as lists and the array containing singular values for each ROI is appended to this list. The updates pass the pytests present in the package. I can issue a PR if this issue is approved as a bug by the devs.

Error message:

No response

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 a pull request may close this issue.

1 participant