From 570a97accb165b2aafb25dc7865fa372c07f0063 Mon Sep 17 00:00:00 2001 From: Caleb Weinreb Date: Tue, 2 Apr 2024 22:48:42 -0400 Subject: [PATCH] bugfixes + tested for heatmaps and video, copy and non-copying modes --- snub/gui/panels/video.py | 8 ++------ snub/gui/tracks/spike.py | 2 +- snub/io/project.py | 6 ++++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/snub/gui/panels/video.py b/snub/gui/panels/video.py index b4c7eaf..c23e505 100644 --- a/snub/gui/panels/video.py +++ b/snub/gui/panels/video.py @@ -31,12 +31,8 @@ def numpy_to_qpixmap(image: np.ndarray) -> QPixmap: class VideoPanel(Panel, HeaderMixin): def __init__(self, config, video_path=None, timestamps_path=None, **kwargs): super().__init__(config, **kwargs) - self.video_frame = VideoFrame( - os.path.join(config["project_directory"], video_path) - ) - self.timestamps = np.load( - os.path.join(config["project_directory"], timestamps_path) - ) + self.video_frame = VideoFrame(video_path) + self.timestamps = np.load(timestamps_path) self.current_frame_index = None self.is_visible = True self.update_current_time(config["init_current_time"]) diff --git a/snub/gui/tracks/spike.py b/snub/gui/tracks/spike.py index 20a0894..c459881 100644 --- a/snub/gui/tracks/spike.py +++ b/snub/gui/tracks/spike.py @@ -33,7 +33,7 @@ def __init__( ): super().__init__(config, selected_intervals, data_path=heatmap_path, **kwargs) self.heatmap_range = heatmap_range - spike_data = np.load(os.path.join(config["project_directory"], spikes_path)) + spike_data = np.load(spikes_path) self.spike_times, self.spike_labels = spike_data[:, 0], spike_data[:, 1].astype( int ) diff --git a/snub/io/project.py b/snub/io/project.py index 866a8d5..2be69ba 100644 --- a/snub/io/project.py +++ b/snub/io/project.py @@ -503,11 +503,13 @@ def add_video( # optionally copy video if copy: - videopath = name + os.path.splitext(videopath)[1] - videopath_abs = os.path.join(project_directory, videopath) + videopath_abs = os.path.join( + project_directory, name + os.path.splitext(videopath)[1] + ) if not os.path.exists(videopath_abs): shutil.copy(videopath, videopath_abs) print("Copying video to " + videopath_abs) + videopath = name + os.path.splitext(videopath)[1] else: videopath = os.path.realpath(videopath)