From 68e97e71f40161027ea96fba930492a388aeb6fd Mon Sep 17 00:00:00 2001 From: k1o0 Date: Fri, 1 Dec 2023 10:28:52 +0000 Subject: [PATCH 1/3] Prepare IBL experiment on Timeline PC --- +hw/Timeline.m | 5 +++-- cortexlab/+tl/bindMpepServer.m | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/+hw/Timeline.m b/+hw/Timeline.m index 60f5046e..5ae9469a 100644 --- a/+hw/Timeline.m +++ b/+hw/Timeline.m @@ -494,8 +494,9 @@ 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')); + 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 diff --git a/cortexlab/+tl/bindMpepServer.m b/cortexlab/+tl/bindMpepServer.m index 8b24d81e..58af2a80 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(obj.Data.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,9 @@ 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(obj.Data.expRef, 'timeline', 'master')); + fclose(fopen(fullfile(masterSavePath, 'transfer_me.flag'), 'w')) case 'expinterrupt' tlObj.stop(); % stop Timeline end From 78e9a925406f5a3f5b50c185baccb4cca4ecf594 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Dec 2023 17:20:57 +0000 Subject: [PATCH 2/3] Minor fixes --- +hw/Timeline.m | 8 ++++++-- cortexlab/+tl/bindMpepServer.m | 13 +++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/+hw/Timeline.m b/+hw/Timeline.m index 5ae9469a..26d8f950 100644 --- a/+hw/Timeline.m +++ b/+hw/Timeline.m @@ -494,13 +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') - # save only to master repo as data are redundent + % 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); diff --git a/cortexlab/+tl/bindMpepServer.m b/cortexlab/+tl/bindMpepServer.m index 58af2a80..afe90a85 100644 --- a/cortexlab/+tl/bindMpepServer.m +++ b/cortexlab/+tl/bindMpepServer.m @@ -88,7 +88,7 @@ function processMpep(listener, msg) % create a file path & experiment ref based on experiment info stubsPaths = prepareExperiment(info.expRef, 'timeline', ... 'fullPathInSettings', true, 'computerID', 'timeline'); - tlSavePath = fileparts(dat.expFilePath(obj.Data.expRef, 'timeline', 'master')); + 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 @@ -106,9 +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(obj.Data.expRef, 'timeline', 'master')); - fclose(fopen(fullfile(masterSavePath, 'transfer_me.flag'), 'w')) + % 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 From 60c56874d40b24fcaaf1efa1672de0366064c525 Mon Sep 17 00:00:00 2001 From: Miles Wells Date: Tue, 19 Dec 2023 15:02:14 +0200 Subject: [PATCH 3/3] Fix Timeline y axis label formatting --- +hw/Timeline.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/+hw/Timeline.m b/+hw/Timeline.m index 26d8f950..c9ffcfc6 100644 --- a/+hw/Timeline.m +++ b/+hw/Timeline.m @@ -648,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