-
Notifications
You must be signed in to change notification settings - Fork 71
Description
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