Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesoscope ibl #319

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions +hw/Timeline.m
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,17 @@ function stop(obj)
% timebase for Alyx and optionally into universal timebase if
% conversion is provided. TODO: Make timelineToALF a class method
if exist('+alf/timelineToALF','file') && exist('writeNPY','file')
alf.timelineToALF(obj.Data, [],...
fileparts(dat.expFilePath(obj.Data.expRef, 'timeline', 'master')))
% save only to master repo as data are redundent
masterSavePath = fileparts(dat.expFilePath(obj.Data.expRef, 'timeline', 'master'));
ALFpath = fullfile(masterSavePath, 'raw_sync_data');
if ~exist(ALFpath, 'dir')
mkdir(ALFpath)
end
alf.timelineToALF(obj.Data, [], fullfile(masterSavePath, 'raw_sync_data'))
else
warning('did not write files into alf format. Check that alyx-matlab and npy-matlab repositories are in path');
end

%Register ALF components and hardware structures to Alyx
%database. TODO: Make this process more robust.
subject = dat.parseExpRef(obj.Data.expRef);
Expand Down Expand Up @@ -643,6 +648,8 @@ function livePlot(obj, data)
if isempty(obj.Axes)
f = figure('Units', 'Normalized');
obj.Axes = gca; % store a handle to the axes
% ensure underscores in channel names not interpreted as underscores
obj.Axes.TickLabelInterpreter = 'none';
if isprop(obj, 'FigurePosition') && ~isempty(obj.FigurePosition)
set(f, 'Position', obj.FigurePosition); % set the figure position
end
Expand Down
13 changes: 13 additions & 0 deletions cortexlab/+tl/bindMpepServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ function processMpep(listener, msg)
tls.AlyxInstance = ai;
case 'expstart'
% create a file path & experiment ref based on experiment info
stubsPaths = prepareExperiment(info.expRef, 'timeline', ...
'fullPathInSettings', true, 'computerID', 'timeline');
tlSavePath = fileparts(dat.expFilePath(info.expRef, 'timeline', 'master'));
assert(tlSavePath == fileparts(stubsPaths{1}), ...
'iblrig local data path does not match dat.paths master repo location')
try % start Timeline
assert(~tlObj.IsRunning, ...
'Rigbox:tl:bindMpepServer:timelineAlreadyRunning', ...
Expand All @@ -101,6 +106,14 @@ function processMpep(listener, msg)
end
case 'expend'
tlObj.stop(); % stop Timeline
% Touch a flag file to disk for the copy script to find
masterSavePath = fileparts(dat.expFilePath(info.expRef, 'timeline', 'master'));
[fID, errmsg] = fopen(fullfile(masterSavePath, 'transfer_me.flag'), 'w');
if isempty(errmsg)
fclose(fID);
else
warning('Failed to create transfer flag: %s', errmsg)
end
case 'expinterrupt'
tlObj.stop(); % stop Timeline
end
Expand Down