From 06447a7b46302ce6493157c158963a6156d613c4 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Wed, 7 Jun 2023 15:27:29 -0500 Subject: [PATCH 1/5] Change `S_mot` and `S_mov` to list in compute_SVD --- facemap/process.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/facemap/process.py b/facemap/process.py index f0e5162..40c9dab 100755 --- a/facemap/process.py +++ b/facemap/process.py @@ -255,8 +255,8 @@ def compute_SVD( ni_mov[0] += ncb ns += 1 - S_mot = np.zeros(500, "float32") - S_mov = np.zeros(500, "float32") + S_mot = [] + S_mov = [] # take SVD of concatenated spatial PCs if ns > 1: for nr in range(len(U_mot)): @@ -267,14 +267,14 @@ def compute_SVD( U_mot[nr], k=min(ncomps, U_mot[nr].shape[0] - 1) ) U_mot[nr] = usv[0] - S_mot = usv[1] + S_mot.append(usv[1]) if movSVD: U_mov[nr] = U_mov[nr][:, : ni_mov[0]] usv = utils.svdecon( U_mov[nr], k=min(ncomps, U_mov[nr].shape[0] - 1) ) U_mov[nr] = usv[0] - S_mov = usv[1] + S_mov.append(usv[1]) elif nr > 0: if motSVD: U_mot[nr] = U_mot[nr][:, : ni_mot[nr]] @@ -282,14 +282,14 @@ def compute_SVD( U_mot[nr], k=min(ncomps, U_mot[nr].shape[0] - 1) ) U_mot[nr] = usv[0] - S_mot = usv[1] + S_mot.append(usv[1]) if movSVD: U_mov[nr] = U_mov[nr][:, : ni_mov[nr]] usv = utils.svdecon( U_mov[nr], k=min(ncomps, U_mov[nr].shape[0] - 1) ) U_mov[nr] = usv[0] - S_mov = usv[1] + S_mov.append(usv[1]) utils.update_mainwindow_message(MainWindow, GUIobject, "Finished computing svd") From d83147f7a7317c447317d0552397375999373d55 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Thu, 8 Jun 2023 14:49:01 -0500 Subject: [PATCH 2/5] Add `S_mot` and `S_mov` reshape --- facemap/process.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/facemap/process.py b/facemap/process.py index 40c9dab..ce9a06a 100755 --- a/facemap/process.py +++ b/facemap/process.py @@ -783,6 +783,8 @@ def run( U_mot_reshape = U_mot.copy() U_mov_reshape = U_mov.copy() + S_mot_reshape = S_mot.copy() + S_mov_reshape = S_mov_copy() if fullSVD: U_mot_reshape[0] = utils.multivideo_reshape( U_mot_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds @@ -790,6 +792,12 @@ def run( U_mov_reshape[0] = utils.multivideo_reshape( U_mov_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds ) + S_mot_reshape[0] = utils.multivideo_reshape( + S_mot_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds + ) + S_mov_reshape[0] = utils.multivideo_reshape( + S_mov_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds + ) if nroi > 0: k = 1 for r in rois: @@ -802,10 +810,16 @@ def run( U_mov_reshape[k] = np.reshape( U_mov[k].copy(), (ly, lx, U_mov[k].shape[-1]) ) + S_mot_reshape[k] = np.reshape( + S_mot[k].copy(), (ly, lx, S_mot[k].shape[-1]) + ) + S_mov_reshape[k] = np.reshape( + S_mov[k].copy(), (ly, lx, S_mov[k].shape[-1]) + ) k += 1 else: U_mot, U_mov, S_mot, S_mov = [], [], [], [] - U_mot_reshape, U_mov_reshape = [], [] + U_mot_reshape, U_mov_reshape, S_mot_reshape, S_mov_reshape = [], [], [], [] # Add V_mot and/or V_mov calculation: project U onto all movie frames ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # and compute pupil (if selected) From 4fad3c11f110a7b1ad26848a664ad79a7b786413 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Thu, 8 Jun 2023 15:19:35 -0500 Subject: [PATCH 3/5] Remove `S_mot_reshape` and S_mov_reshape` from `fullSVD` --- facemap/process.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/facemap/process.py b/facemap/process.py index ce9a06a..fc60235 100755 --- a/facemap/process.py +++ b/facemap/process.py @@ -784,7 +784,7 @@ def run( U_mot_reshape = U_mot.copy() U_mov_reshape = U_mov.copy() S_mot_reshape = S_mot.copy() - S_mov_reshape = S_mov_copy() + S_mov_reshape = S_mov.copy() if fullSVD: U_mot_reshape[0] = utils.multivideo_reshape( U_mot_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds @@ -792,12 +792,6 @@ def run( U_mov_reshape[0] = utils.multivideo_reshape( U_mov_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds ) - S_mot_reshape[0] = utils.multivideo_reshape( - S_mot_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds - ) - S_mov_reshape[0] = utils.multivideo_reshape( - S_mov_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds - ) if nroi > 0: k = 1 for r in rois: From 87c3691e5e13e56ff547559b6b1a13e0da37847c Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Thu, 12 Oct 2023 10:13:08 -0500 Subject: [PATCH 4/5] Remove s_mot & s_mov reshape --- facemap/process.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/facemap/process.py b/facemap/process.py index fc60235..d64f522 100755 --- a/facemap/process.py +++ b/facemap/process.py @@ -804,12 +804,6 @@ def run( U_mov_reshape[k] = np.reshape( U_mov[k].copy(), (ly, lx, U_mov[k].shape[-1]) ) - S_mot_reshape[k] = np.reshape( - S_mot[k].copy(), (ly, lx, S_mot[k].shape[-1]) - ) - S_mov_reshape[k] = np.reshape( - S_mov[k].copy(), (ly, lx, S_mov[k].shape[-1]) - ) k += 1 else: U_mot, U_mov, S_mot, S_mov = [], [], [], [] From d4ede6ce30b22425f76ebf2fe28ab1e55572c0e5 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Tue, 17 Oct 2023 17:13:39 -0500 Subject: [PATCH 5/5] Remove `not` from savepath logic --- facemap/process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facemap/process.py b/facemap/process.py index 103c247..8c3c9de 100644 --- a/facemap/process.py +++ b/facemap/process.py @@ -703,7 +703,7 @@ def run( rois = proc["rois"] sy = proc["sy"] sx = proc["sx"] - savepath = proc["savepath"] if savepath is not None else savepath + savepath = proc["savepath"] if savepath is None else savepath Lybin, Lxbin, iinds = binned_inds(Ly, Lx, sbin) LYbin, LXbin, sybin, sxbin = utils.video_placement(Lybin, Lxbin)