-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamine_motion_correction.m
More file actions
38 lines (29 loc) · 1.2 KB
/
examine_motion_correction.m
File metadata and controls
38 lines (29 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
%% This script shows you how to look the motion estimated by spikeinterface in your recordings
mouse = 'M25002';
base_folder = 'Z:\ibn-vision\DATA\SUBJECTS';
date = '20250215';
% Define recording folder
recording_folder = fullfile(base_folder, mouse, 'ephys', date);
% Find all subfolders containing 'motion'
motion_dirs = dir(fullfile(recording_folder, '*motion*'));
motion_dirs = motion_dirs([motion_dirs.isdir]); % Only keep folders
% Loop through each motion folder
for i = 1:length(motion_dirs)
displacement = readNPY(fullfile(recording_folder, motion_dirs(i).name,'motion/displacement_seg0.npy'));
spatial_bins = readNPY(fullfile(recording_folder, motion_dirs(i).name,'motion/spatial_bins_um.npy'));
temporal_bins = readNPY(fullfile(recording_folder, motion_dirs(i).name,'motion/temporal_bins_s_seg0.npy'));
% 3D plot
figure('Name', motion_dirs(i).name);
hold on;
for j = 1:length(spatial_bins)
plot3(temporal_bins, ...
spatial_bins(j) * ones(size(temporal_bins)), ...
displacement(:, j));
end
xlabel('Time');
ylabel('Depth');
zlabel('Drift');
title(['Drift trace - ' motion_dirs(i).name]);
view(3);
grid on;
end