diff --git a/facemap/gui/gui.py b/facemap/gui/gui.py index 10f6814..4d4b90c 100644 --- a/facemap/gui/gui.py +++ b/facemap/gui/gui.py @@ -74,7 +74,7 @@ def __init__( QtCore.QCoreApplication.setApplicationName("Facemap") pg.setConfigOptions(imageAxisOrder="row-major") - self.setGeometry(15, 5, 1470, 800)#(55, 5, 1470, 800) + self.setGeometry(15, 5, 1700, 800)#(55, 5, 1470, 800) self.setWindowTitle("Facemap") self.setStyleSheet("QMainWindow {background: 'black';}") self.styleUnpressed = ( @@ -120,7 +120,7 @@ def __init__( self.central_widget.setLayout(self.scene_grid_layout) # --- cells image self.sizeObject = QtGui.QGuiApplication.primaryScreen().availableGeometry() - self.resize(self.sizeObject.width(), self.sizeObject.height()) + #self.resize(self.sizeObject.width(), self.sizeObject.height()) self.video_window = pg.GraphicsLayoutWidget() self.video_window.viewport().setAttribute(QtCore.Qt.WidgetAttribute.WA_AcceptTouchEvents, False) @@ -385,7 +385,10 @@ def dropEvent(self, event): url = event.mimeData().urls()[0] if url.isLocalFile() and url.toString().endswith(('.mp4', '.avi')): video_path = url.toLocalFile() - io.open_file(self, (video_path, 'Movie files (*.h5 *.mj2 *.mp4 *.mkv *.avi *.mpeg *.mpg *.asf *m4v)')) + io.open_file(self, (video_path, 'Movie files (*.h5 *.mj2 *.mp4 *.mkv *.avi *.mpeg *.mpg *.asf *.m4v)')) + elif url.isLocalFile() and url.toString().endswith((".npy", ".mat")): + proc_path = url.toLocalFile() + io.open_proc(self, proc_path) def make_buttons(self): # ~~~~~~~~~~~~~~~~~~~~~~~~ SVD variables ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1235,16 +1238,15 @@ def process_batch(self): print(files) for file_idx, f in enumerate(files): proc = np.load(f, allow_pickle=True).item() - if proc["motSVD"] or proc["movSVD"]: - savename = process.run( - proc["filenames"], - motSVD=proc["motSVD"], - movSVD=proc["movSVD"], - GUIobject=QtWidgets, - proc=proc, - savepath=proc["save_path"], - ) - self.update_status_bar("Processed " + savename) + savename = process.run( + proc["filenames"], + motSVD=proc["motSVD"], + movSVD=proc["movSVD"], + GUIobject=QtWidgets, + proc=proc, + savepath=proc["save_path"], + ) + self.update_status_bar("Processed " + savename) if self.keypoints_checkbox.isChecked(): self.filenames = proc["filenames"] self.bbox = proc["pose_settings"]["bbox"] diff --git a/facemap/gui/io.py b/facemap/gui/io.py index 6b2a443..38a4953 100644 --- a/facemap/gui/io.py +++ b/facemap/gui/io.py @@ -185,6 +185,7 @@ def open_proc(parent, file_name=None): parent.sigma_box.setText(str(r["pupil_sigma"])) else: psig = None + parent.ROIs.append( roi.sROI( rind=r["rind"], @@ -201,8 +202,6 @@ def open_proc(parent, file_name=None): ivid=r["ivid"], ) ) - parent.update_ROI_vis_comboBox() - parent.ROIs[-1].position(parent) if "reflector" in r: for i, reflector_roi in enumerate(r["reflector"]): @@ -214,8 +213,7 @@ def open_proc(parent, file_name=None): reflector_roi["xrange"][-1] - reflector_roi["xrange"][0], ] - parent.rROI[-1].append( - roi.reflectROI( + parent.rROI[-1].append(roi.reflectROI( iROI=r["iROI"], wROI=i, pos=pos, @@ -223,8 +221,11 @@ def open_proc(parent, file_name=None): yrange=reflector_roi["yrange"], xrange=reflector_roi["xrange"], ellipse=reflector_roi["ellipse"], - ) - ) + )) + + parent.update_ROI_vis_comboBox() + parent.ROIs[-1].position(parent) + if parent.fullSVD: parent.iROI = k - 1 else: diff --git a/facemap/gui/ops_user.npy b/facemap/gui/ops_user.npy deleted file mode 100755 index e1ba391..0000000 Binary files a/facemap/gui/ops_user.npy and /dev/null differ diff --git a/facemap/process.py b/facemap/process.py index 1d46e19..b688dac 100644 --- a/facemap/process.py +++ b/facemap/process.py @@ -710,6 +710,7 @@ def run( Lybin, Lxbin, iinds = binned_inds(Ly, Lx, sbin) LYbin, LXbin, sybin, sxbin = utils.video_placement(Lybin, Lxbin) + # number of mot/mov ROIs nroi = 0 if rois is not None: for r in rois: diff --git a/facemap/utils.py b/facemap/utils.py index 6fd298b..f469c47 100644 --- a/facemap/utils.py +++ b/facemap/utils.py @@ -756,5 +756,5 @@ def svdecon(X, k=100): """ U, Sv, V = PCA( n_components=k, svd_solver="randomized", random_state=np.random.RandomState(0) - )._fit(X) + )._fit(X)[:3] return U, Sv, V diff --git a/setup.py b/setup.py index dbb2fec..8f258d1 100644 --- a/setup.py +++ b/setup.py @@ -4,12 +4,12 @@ import setuptools install_deps = [ - "numpy>=1.16", + "numpy>=1.16,<2.0", "scipy", "natsort", "tqdm", "numba>=0.43.1", - "opencv-python-headless", + "opencv-python-headless<4.10", "torch>=1.9", "h5py", "scikit-learn",