diff --git a/facemap/gui/cluster.py b/facemap/gui/cluster.py index 91a67e9..eb74302 100644 --- a/facemap/gui/cluster.py +++ b/facemap/gui/cluster.py @@ -736,8 +736,12 @@ def save_cluster_video(self, parent, fps, num_frames_gif): cumframes, Ly, Lx, capture = utils.get_frame_details(parent.filenames) capture = capture[0][0] num_clusters = len(np.unique(self.cluster_labels)) - filename, ext = parent.filenames[0][0].split(".") - filename = filename.split("/")[-1] # Use video filename + filename, ext = os.path.splitext( + parent.filenames[0][0] + ) # parent.filenames[0][0].split(".") + filename = os.path.basename( + filename + ) # filename.split("/")[-1] # Use video filename # Create 2D list of random frames selected from each cluster cluster_frames_2D_list = np.zeros((num_clusters, num_frames_gif)) diff --git a/facemap/gui/gui.py b/facemap/gui/gui.py index 32efb7c..f044d42 100755 --- a/facemap/gui/gui.py +++ b/facemap/gui/gui.py @@ -7,6 +7,7 @@ import numpy as np import pyqtgraph as pg import scipy.io as sio +from pathlib import Path from matplotlib import cm from PyQt5 import QtCore, QtWidgets from PyQt5.QtGui import QFont, QIcon, QPainterPath @@ -793,7 +794,7 @@ def update_pose_model_combo_box(self): models = model_loader.get_model_states_paths() models.append(model_loader.get_basemodel_state_path()) for m in models: - model_name = m.split("/")[-1].split(".")[0] + model_name = Path(m).stem # m.split("/")[-1].split(".")[0] if model_name == "facemap_model_state": continue self.pose_model_combobox.addItem(model_name) diff --git a/facemap/gui/io.py b/facemap/gui/io.py index a2a5a58..f9ad7cd 100755 --- a/facemap/gui/io.py +++ b/facemap/gui/io.py @@ -179,7 +179,7 @@ def open_proc(parent, file_name=None): if "pupil_sigma" in roi: psig = roi["pupil_sigma"] parent.pupil_sigma = psig - parent.sigmaBox.setText(str(roi["pupil_sigma"])) + parent.sigma_box.setText(str(roi["pupil_sigma"])) else: psig = None parent.ROIs.append( @@ -484,8 +484,12 @@ def load_trace_data(parent): def save_clustering_output(output, parent): - filename, ext = parent.filenames[0][0].split(".") - filename = filename.split("/")[-1] # Use video filename + filename, ext = os.path.splitext( + parent.filenames[0][0] + ) # parent.filenames[0][0].split(".") + filename = os.path.basename( + filename + ) # filename.split("/")[-1] # Use video filename savename = os.path.join(parent.save_path, ("%s_facemap_clusters.npy" % filename)) np.save(savename, output) parent.update_status_bar("Clustering output saved: " + savename) diff --git a/facemap/gui/ops_user.npy b/facemap/gui/ops_user.npy index 706fdcb..19beded 100755 Binary files a/facemap/gui/ops_user.npy and b/facemap/gui/ops_user.npy differ diff --git a/tests/test_svd_output.py b/tests/test_svd_output.py index b3d25eb..4ecd2bc 100644 --- a/tests/test_svd_output.py +++ b/tests/test_svd_output.py @@ -5,7 +5,7 @@ from facemap import process -r_tol, a_tol = 1, 1 #1e-2, 1 +r_tol, a_tol = 1, 1 # 1e-2, 1 def test_output_single_video(data_dir, video_names, expected_output_dir): @@ -113,7 +113,10 @@ def check_frames(test_output, expected_output): def check_U(test_output, expected_output): motionMask = np.allclose( - test_output["motMask"][0], expected_output["motMask"][0], rtol=r_tol+5, atol=a_tol+5 + test_output["motMask"][0], + expected_output["motMask"][0], + rtol=r_tol + 5, + atol=a_tol + 5, ) movieMask = np.allclose( test_output["movMask"][0], expected_output["movMask"][0], rtol=r_tol, atol=a_tol @@ -121,8 +124,8 @@ def check_U(test_output, expected_output): motionMask_reshape = np.allclose( test_output["motMask_reshape"][0], expected_output["motMask_reshape"][0], - rtol=r_tol+5, - atol=a_tol+5, + rtol=r_tol + 5, + atol=a_tol + 5, ) movMask_reshape = np.allclose( test_output["movMask_reshape"][0], @@ -133,7 +136,7 @@ def check_U(test_output, expected_output): print("motionMask", motionMask) print("movieMask", movieMask) print("motionMask_reshape", motionMask_reshape) - print("movMask_reshape", movMask_reshape) + print("movMask_reshape", movMask_reshape) return motionMask and movieMask and motionMask_reshape and movMask_reshape