From e6ea2ab5c6e3bcc4c6fc329f32bd86bf77eb58f9 Mon Sep 17 00:00:00 2001 From: Atika-Syeda Date: Wed, 1 Nov 2023 09:42:50 -0400 Subject: [PATCH 1/2] Minor edits --- facemap/gui/ops_user.npy | Bin 401 -> 410 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/facemap/gui/ops_user.npy b/facemap/gui/ops_user.npy index fb89223221678c6b8420869027741d5c6909b498..008b271efa39ead616a86d9e70828d2a367137fc 100755 GIT binary patch delta 56 zcmbQpJd1gQJR>9fWCcbYH6;cH2K|iu+*JMIlA_GK^qj;beZ92A8|WCcbYSxE*42K|iu+*JMIlA_GK^qj;beV6?5yqx^Rl;X)nj2Zwa CbPf6d From 5bf15298e4ece619364017bada03b85cf35cb19f Mon Sep 17 00:00:00 2001 From: Atika-Syeda Date: Mon, 20 Nov 2023 16:46:46 -0500 Subject: [PATCH 2/2] Fix issue 127 --- facemap/gui/gui.py | 16 ++++++++++------ facemap/gui/ops_user.npy | Bin 410 -> 415 bytes facemap/process.py | 37 ++++++++++++++++++++++--------------- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/facemap/gui/gui.py b/facemap/gui/gui.py index 2dce18e..34d4059 100644 --- a/facemap/gui/gui.py +++ b/facemap/gui/gui.py @@ -510,9 +510,11 @@ def make_buttons(self): # Check boxes self.motSVD_checkbox = QCheckBox("motSVD") self.motSVD_checkbox.setStyleSheet("color: gray;") + self.motSVD_checkbox.setChecked(True) self.process_groupbox.layout().addWidget(self.motSVD_checkbox, 0, 0) self.movSVD_checkbox = QCheckBox("movSVD") self.movSVD_checkbox.setStyleSheet("color: gray;") + self.movSVD_checkbox.setChecked(True) self.process_groupbox.layout().addWidget(self.movSVD_checkbox, 0, 1) self.keypoints_checkbox = QCheckBox("Keypoints") self.keypoints_checkbox.setStyleSheet("color: gray;") @@ -1167,7 +1169,6 @@ def update_buttons(self): self.pauseButton.setChecked(True) self.process.setEnabled(True) self.saverois.setEnabled(True) - self.multivideo_svd_checkbox.setChecked(True) self.save_mat.setChecked(True) #self.load_trace2_button.setEnabled(True) @@ -1528,7 +1529,6 @@ def load_keypoints(self): self.pose_likelihood = np.array( [self.pose_likelihood] ) # size: keypoints x frames - # TODO: Choose colors for each label: provide option for palette that is color-blind friendly colors = cm.get_cmap("jet")( np.linspace(0, 1.0, len(self.keypoints_labels[video_id])) ) @@ -1894,15 +1894,19 @@ def plot_trace(self, wplot, proctype, wroi, color, keypoints_group_selected=None else: ir = wroi + 1 cmap = cm.get_cmap("hsv") - nc = min(10, self.motSVDs[ir].shape[1]) + if self.motSVDs == []: + svd_trace = self.movSVDs + else: + svd_trace = self.motSVDs + nc = min(10, svd_trace[ir].shape[1]) cmap = (255 * cmap(np.linspace(0, 0.2, nc))).astype(int) - norm = (self.motSVDs[ir][:, 0]).std() - tr = (self.motSVDs[ir][:, :10] ** 2).sum(axis=1) ** 0.5 / norm + norm = (svd_trace[ir][:, 0]).std() + tr = (svd_trace[ir][:, :10] ** 2).sum(axis=1) ** 0.5 / norm for c in np.arange(0, nc, 1, int)[::-1]: pen = pg.mkPen( tuple(cmap[c, :]), width=1 ) # , style=QtCore.Qt.DashLine) - tr2 = self.motSVDs[ir][:, c] / norm + tr2 = svd_trace[ir][:, c] / norm tr2 *= np.sign(skew(tr2)) selected_plot.plot(tr2, pen=pen) pen = pg.mkPen(color) diff --git a/facemap/gui/ops_user.npy b/facemap/gui/ops_user.npy index 008b271efa39ead616a86d9e70828d2a367137fc..635607eb36209be32b736f419b791b85c1647eaa 100755 GIT binary patch delta 91 zcmbQmJfC@k4`Z-80|SG8Mt*LpesM`rW?p(uVv@c~etBL_equ_oesN-MK~8FXZhl#2 pYH^`p1Upc5T4_#BaF|P>P-g@OkXxKs22_w(QYhR}3M566^Z-<}9jO2S delta 86 zcmbQwJd1gQ52K$F0|SG8Mt*LpesM`rW?p(uVv@dIT4Hi)ZeoFcN@7W(esW^2VWD6I lJ5XU-X--aXm`kBhM+66uTbx*y8lRh3QYhR}3M566^Z 0 and wmot.size > 0: wmot = np.array(wmot).astype(int) @@ -787,24 +790,28 @@ def run( U_mot_reshape = U_mot.copy() U_mov_reshape = U_mov.copy() if fullSVD: - U_mot_reshape[0] = utils.multivideo_reshape( - U_mot_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds - ) - U_mov_reshape[0] = utils.multivideo_reshape( - U_mov_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds - ) + if motSVD: + U_mot_reshape[0] = utils.multivideo_reshape( + U_mot_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds + ) + if movSVD: + U_mov_reshape[0] = utils.multivideo_reshape( + U_mov_reshape[0], LYbin, LXbin, sybin, sxbin, Lybin, Lxbin, iinds + ) if nroi > 0: k = 1 for r in rois: if r["rind"] == 1: ly = r["yrange_bin"].size lx = r["xrange_bin"].size - U_mot_reshape[k] = np.reshape( - U_mot[k].copy(), (ly, lx, U_mot[k].shape[-1]) - ) - U_mov_reshape[k] = np.reshape( - U_mov[k].copy(), (ly, lx, U_mov[k].shape[-1]) - ) + if motSVD: + U_mot_reshape[k] = np.reshape( + U_mot[k].copy(), (ly, lx, U_mot[k].shape[-1]) + ) + if movSVD: + U_mov_reshape[k] = np.reshape( + U_mov[k].copy(), (ly, lx, U_mov[k].shape[-1]) + ) k += 1 else: U_mot, U_mov, S_mot, S_mov = [], [], [], []