Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #154

Merged
merged 6 commits into from
Nov 27, 2024
Merged

Dev #154

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion facemap/.github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
platform: [ubuntu-latest]
#, windows-latest, macos-latest]
python-version: [3.8, 3.9, "3.10"]

steps:
Expand Down
28 changes: 15 additions & 13 deletions facemap/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 ~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -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"]
Expand Down
13 changes: 7 additions & 6 deletions facemap/gui/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"]):
Expand All @@ -214,17 +213,19 @@ 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,
parent=parent,
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:
Expand Down
Binary file removed facemap/gui/ops_user.npy
Binary file not shown.
1 change: 1 addition & 0 deletions facemap/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion facemap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading