Skip to content

Commit 2c80ad0

Browse files
Merge branch 'main' of https://github.com/mouseland/facemap into main
2 parents d6ca13a + a92c93a commit 2c80ad0

File tree

6 files changed

+26
-22
lines changed

6 files changed

+26
-22
lines changed

facemap/gui/gui.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(
7474
QtCore.QCoreApplication.setApplicationName("Facemap")
7575

7676
pg.setConfigOptions(imageAxisOrder="row-major")
77-
self.setGeometry(15, 5, 1470, 800)#(55, 5, 1470, 800)
77+
self.setGeometry(15, 5, 1700, 800)#(55, 5, 1470, 800)
7878
self.setWindowTitle("Facemap")
7979
self.setStyleSheet("QMainWindow {background: 'black';}")
8080
self.styleUnpressed = (
@@ -120,7 +120,7 @@ def __init__(
120120
self.central_widget.setLayout(self.scene_grid_layout)
121121
# --- cells image
122122
self.sizeObject = QtGui.QGuiApplication.primaryScreen().availableGeometry()
123-
self.resize(self.sizeObject.width(), self.sizeObject.height())
123+
#self.resize(self.sizeObject.width(), self.sizeObject.height())
124124

125125
self.video_window = pg.GraphicsLayoutWidget()
126126
self.video_window.viewport().setAttribute(QtCore.Qt.WidgetAttribute.WA_AcceptTouchEvents, False)
@@ -385,7 +385,10 @@ def dropEvent(self, event):
385385
url = event.mimeData().urls()[0]
386386
if url.isLocalFile() and url.toString().endswith(('.mp4', '.avi')):
387387
video_path = url.toLocalFile()
388-
io.open_file(self, (video_path, 'Movie files (*.h5 *.mj2 *.mp4 *.mkv *.avi *.mpeg *.mpg *.asf *m4v)'))
388+
io.open_file(self, (video_path, 'Movie files (*.h5 *.mj2 *.mp4 *.mkv *.avi *.mpeg *.mpg *.asf *.m4v)'))
389+
elif url.isLocalFile() and url.toString().endswith((".npy", ".mat")):
390+
proc_path = url.toLocalFile()
391+
io.open_proc(self, proc_path)
389392

390393
def make_buttons(self):
391394
# ~~~~~~~~~~~~~~~~~~~~~~~~ SVD variables ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1235,16 +1238,15 @@ def process_batch(self):
12351238
print(files)
12361239
for file_idx, f in enumerate(files):
12371240
proc = np.load(f, allow_pickle=True).item()
1238-
if proc["motSVD"] or proc["movSVD"]:
1239-
savename = process.run(
1240-
proc["filenames"],
1241-
motSVD=proc["motSVD"],
1242-
movSVD=proc["movSVD"],
1243-
GUIobject=QtWidgets,
1244-
proc=proc,
1245-
savepath=proc["save_path"],
1246-
)
1247-
self.update_status_bar("Processed " + savename)
1241+
savename = process.run(
1242+
proc["filenames"],
1243+
motSVD=proc["motSVD"],
1244+
movSVD=proc["movSVD"],
1245+
GUIobject=QtWidgets,
1246+
proc=proc,
1247+
savepath=proc["save_path"],
1248+
)
1249+
self.update_status_bar("Processed " + savename)
12481250
if self.keypoints_checkbox.isChecked():
12491251
self.filenames = proc["filenames"]
12501252
self.bbox = proc["pose_settings"]["bbox"]

facemap/gui/io.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def open_proc(parent, file_name=None):
185185
parent.sigma_box.setText(str(r["pupil_sigma"]))
186186
else:
187187
psig = None
188+
188189
parent.ROIs.append(
189190
roi.sROI(
190191
rind=r["rind"],
@@ -201,8 +202,6 @@ def open_proc(parent, file_name=None):
201202
ivid=r["ivid"],
202203
)
203204
)
204-
parent.update_ROI_vis_comboBox()
205-
parent.ROIs[-1].position(parent)
206205

207206
if "reflector" in r:
208207
for i, reflector_roi in enumerate(r["reflector"]):
@@ -214,17 +213,19 @@ def open_proc(parent, file_name=None):
214213
reflector_roi["xrange"][-1]
215214
- reflector_roi["xrange"][0],
216215
]
217-
parent.rROI[-1].append(
218-
roi.reflectROI(
216+
parent.rROI[-1].append(roi.reflectROI(
219217
iROI=r["iROI"],
220218
wROI=i,
221219
pos=pos,
222220
parent=parent,
223221
yrange=reflector_roi["yrange"],
224222
xrange=reflector_roi["xrange"],
225223
ellipse=reflector_roi["ellipse"],
226-
)
227-
)
224+
))
225+
226+
parent.update_ROI_vis_comboBox()
227+
parent.ROIs[-1].position(parent)
228+
228229
if parent.fullSVD:
229230
parent.iROI = k - 1
230231
else:

facemap/gui/ops_user.npy

-415 Bytes
Binary file not shown.

facemap/process.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ def run(
710710
Lybin, Lxbin, iinds = binned_inds(Ly, Lx, sbin)
711711
LYbin, LXbin, sybin, sxbin = utils.video_placement(Lybin, Lxbin)
712712

713+
# number of mot/mov ROIs
713714
nroi = 0
714715
if rois is not None:
715716
for r in rois:

facemap/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,5 +756,5 @@ def svdecon(X, k=100):
756756
"""
757757
U, Sv, V = PCA(
758758
n_components=k, svd_solver="randomized", random_state=np.random.RandomState(0)
759-
)._fit(X)
759+
)._fit(X)[:3]
760760
return U, Sv, V

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
import setuptools
55

66
install_deps = [
7-
"numpy>=1.16",
7+
"numpy>=1.16,<2.0",
88
"scipy",
99
"natsort",
1010
"tqdm",
1111
"numba>=0.43.1",
12-
"opencv-python-headless",
12+
"opencv-python-headless<4.10",
1313
"torch>=1.9",
1414
"h5py",
1515
"scikit-learn",

0 commit comments

Comments
 (0)