diff --git a/+hw/Timeline.m b/+hw/Timeline.m index 60f5046e..c9ffcfc6 100644 --- a/+hw/Timeline.m +++ b/+hw/Timeline.m @@ -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); @@ -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 diff --git a/cortexlab/+tl/bindMpepServer.m b/cortexlab/+tl/bindMpepServer.m index 8b24d81e..afe90a85 100644 --- a/cortexlab/+tl/bindMpepServer.m +++ b/cortexlab/+tl/bindMpepServer.m @@ -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', ... @@ -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