Skip to content

Commit

Permalink
bugfixes + tested for heatmaps and video, copy and non-copying modes
Browse files Browse the repository at this point in the history
  • Loading branch information
calebweinreb committed Apr 3, 2024
1 parent e5fe556 commit 570a97a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 2 additions & 6 deletions snub/gui/panels/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
2 changes: 1 addition & 1 deletion snub/gui/tracks/spike.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
6 changes: 4 additions & 2 deletions snub/io/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 570a97a

Please sign in to comment.