Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

fix_lut.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. function fix_lut(fld,monkey)
  2. % we use a LUT to store information about trials. this is created by
  3. % converting the log structure to a table and adding some extra columns.
  4. % however, apparently the log structure does't always have the same fields,
  5. % but the LUT needs to have the same columns to be able to concatenate.
  6. % this fucntion adds two empty columns, for stimonset and targonset, which
  7. % apparently were added to the log structure halfway throughout recording.
  8. % also, TarChoice is sometimes a cell, but it doesn't have to be because
  9. % it's only ever 1 value.
  10. datadir = fld.procdatadir;
  11. datainfo = session_info();
  12. fprintf('\n======================================================\n');
  13. fprintf(['-- Running fix_lut for ' monkey ' --\n']);
  14. fprintf('======================================================\n');
  15. if strcmp(monkey,'M1')
  16. info = datainfo(1);
  17. else
  18. info = datainfo(2);
  19. end
  20. sessions = info.dates;
  21. for sid = 1:length(sessions)
  22. % session info
  23. session = sessions{sid};
  24. q = strsplit(session,'_');
  25. cdate = q{2};
  26. block = str2num(q{3}(end-4));
  27. % load the data
  28. session_id = [monkey '_' cdate '_' num2str(block)];
  29. sessiondir = fullfile(datadir, monkey, session_id);
  30. % load the data for this session for this channel
  31. load(fullfile(sessiondir, [session_id '_LUT.mat'])); % loads 'lut'
  32. % add nans for stimonset
  33. if ~sum(strcmp('StimOnset',lut.Properties.VariableNames))
  34. StimOnset = nan(size(lut,1),1);
  35. lut = addvars(lut,StimOnset,'After','RewValue');
  36. end
  37. % add nans for targonset
  38. if ~sum(strcmp('TargOnset',lut.Properties.VariableNames))
  39. TargOnset = nan(size(lut,1),1);
  40. lut = addvars(lut,TargOnset,'After','StimOnset');
  41. end
  42. % make TarChoice not be a cell
  43. if iscell(lut.TarChoice)
  44. qq = nan(size(lut,1),1);
  45. qq(cellfun('isempty',lut.TarChoice)==0,1) = cell2mat(lut.TarChoice);
  46. lut.TarChoice = qq;
  47. end
  48. save(fullfile(sessiondir, [session_id '_LUT.mat']),'lut');
  49. end