Skip to content

Commit

Permalink
FIX: return timetable correctly for ophys pupil_location
Browse files Browse the repository at this point in the history
TEST: BehaviorTutorial
  • Loading branch information
vijayiyer05 committed Sep 2, 2022
1 parent d6e2f3c commit ed93846
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions +bot/+item/+concrete/OphysSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
end

function tt = get.pupil_location(bos)
tt = bos.fetch_cached('pupil_location', @bos.fetch_pupil_location);
tt = bos.fetch_cached('pupil_location', @bos.fetch_pupil_location);
end

function tt = get.pupil_size(bos)
Expand Down Expand Up @@ -539,9 +539,10 @@
end


function [timestamps, pupil_location] = fetch_pupil_location(bos, as_spherical_coords)
function tt = fetch_pupil_location(bos, as_spherical_coords)
% fetch_pupil_location - METHOD Return the pupil location trace for this experimental session
%
% OLD (FOR INFO PURPOSES)
% Usage: [timestamps, pupil_location] = fetch_pupil_location(bos, <as_spherical_coords>)
%
% `timestamps` will be a Tx1 vector of times in seconds,
Expand Down Expand Up @@ -583,12 +584,17 @@
pupil_location = h5read(nwb_file, h5path(nwb_key, 'data'))';
timestamps = seconds(h5read(nwb_file, h5path(nwb_key, 'timestamps')));

tt = timetable(timestamps,pupil_location);
if as_spherical_coords
varNames = ["theta (deg)" "phi (deg)"];
else
varNames = ["x (cm)" "y (cm)"];
end

tt = timetable(timestamps,pupil_location(:,1),pupil_location(:,2), 'VariableNames',varNames);

catch cause
% - Couldn't find the eye tracking data
catch cause
base = MException('BOT:NoEyeTracking', ...
'No eye tracking data is available for this experiment.');
'Failed to retrieve the eye tracking data for this experiment.');
base = base.addCause(cause);
throw(base);
end
Expand All @@ -598,6 +604,7 @@
function tt = fetch_pupil_size(bos)
% fetch_pupil_size - METHOD Return the pupil area trace for this experimental session
%
% OLD (FOR INFO PURPOSES)
% Usage: [timestamps, pupil_areas] = fetch_pupil_size(bos)
%
% `timestamps` will be a Tx1 vector of times in seconds,
Expand Down

0 comments on commit ed93846

Please sign in to comment.