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.

nwbSessionParams.m 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. % Session-specific NWB parameters
  2. % Parameters that are different for different animals are:
  3. % sessionID
  4. % sessionDescription
  5. % sessionNotes
  6. % areas
  7. % endCh
  8. % probeInserted
  9. % electrodeName
  10. % nChannelsPerShank
  11. % electrodeCoordinates
  12. % electrodeImplantationType
  13. % General info
  14. sessionID = {'20200324161349'};
  15. sessionDescription = {'anaesthesia'};
  16. sessionNotes = {'Probe 1: X Y Z D 1064.7 0 3992.4 4113.9. Probe 2: X Y Z D 1061.7 0 3918.7 4113.9. Anaesthesia recording with 0.5% isoflurane, heater set to 43 degrees, and the temperature probe showing 37.8 degrees. Increased isoflurane to 0.75% at minute 21.'};
  17. endCh{1}{1} = [88 117 149 342 384]; % Corresponding probe end channels starting from the tip of the probe. Corresponding and previous end channels are used to work out probe channels that reside in the corresponding brain area.
  18. endCh{1}{2} = [41 091 138 217 304 384];
  19. for iSess = 1:numel(sessionID)
  20. sessionStartTime{iSess} = datetime(str2double(sessionID{iSess}(1:4)), str2double(sessionID{iSess}(5:6)), str2double(sessionID{iSess}(7:8)),...
  21. str2double(sessionID{iSess}(9:10)), str2double(sessionID{iSess}(11:12)), str2double(sessionID{iSess}(13:14))); %#ok<*SAGROW>
  22. % Probe #1 info
  23. ref = 1; % probe reference
  24. probeInserted{iSess}{ref} = true; % If the probe used at all
  25. if probeInserted{iSess}{ref} && ~isempty(endCh{iSess}{ref})
  26. electrodeName{iSess}{ref} = 'Neuropixels 1.0';
  27. electrodeDescription{iSess}{ref} = ['Single shank high density probe in position ' num2str(ref)];
  28. electrodeManufacturer{iSess}{ref} = 'imec';
  29. electrodeFolder{iSess}{ref} = [animalRawDataFolder filesep sessionID{iSess} '1'];
  30. if ~exist(electrodeFolder{iSess}{ref}, 'file') % in case a probe is missing
  31. electrodeFolder{iSess}{ref} = electrodeFolder{iSess}{ref}(1:end-1);
  32. end
  33. if contains(electrodeName{iSess}{ref}, 'neuropixels', 'IgnoreCase',true)
  34. electrodeMap = [electrodeFolder{iSess}{ref} filesep 'forPRB_Neuropixels.mat'];
  35. else
  36. electrodeMap = [electrodeFolder{iSess}{ref} filesep 'forPRB_' electrodeName{iSess}{ref} '.mat'];
  37. end
  38. load(electrodeMap, 'ycoords');
  39. nShanks{iSess}{ref} = 1;
  40. nChannelsPerShank{iSess}{ref} = 384;
  41. nChannelsPerShank{iSess}{ref} = min([numel(ycoords) nChannelsPerShank{iSess}{ref}]);
  42. nCh{iSess}{ref} = nChannelsPerShank{iSess}{ref}*nShanks{iSess}{ref}; % total number of probe channels
  43. areas = {'VB','LP','LGN','CA3','S1'}; % brain areas that this probe spans
  44. electrodeLocation{iSess}{ref} = electrodeLocations(areas, endCh{iSess}{ref}, nCh{iSess}{ref}); % Brain area assigned to each recording channel.
  45. electrodeCoordinates{iSess}{ref} = [-1.8, -2.5, 0]; % Electrode insertion location on the cortical surface in Paxinos coords: AP (posterior negative), ML (left negative), DV (recording site position starting with the tip of the probe.
  46. electrodeCoordinates{iSess}{ref} = repmat(electrodeCoordinates{iSess}{ref}, nCh{iSess}{ref}, 1); % Coordinates of each probe recording channel (the probe rotation angle is not taken into account). Y coordinates are relative to the tip of the probe.
  47. if size(ycoords,1) == 1
  48. electrodeCoordinates{iSess}{ref}(:,3) = ycoords(1:nCh{iSess}{ref})'./1000;
  49. else
  50. electrodeCoordinates{iSess}{ref}(:,3) = ycoords(1:nCh{iSess}{ref})./1000;
  51. end
  52. electrodeLabel{iSess}{ref} = ['probe' num2str(ref)];
  53. electrodeImplantationType{iSess}{ref} = 'acute';
  54. else % The case when the probe #1 is missing
  55. electrodeName{iSess}{ref} = []; %#ok<*UNRCH>
  56. electrodeDescription{iSess}{ref} = [];
  57. electrodeManufacturer{iSess}{ref} = [];
  58. electrodeFolder{iSess}{ref} = [];
  59. nShanks{iSess}{ref} = [];
  60. nChannelsPerShank{iSess}{ref} = [];
  61. nCh{iSess}{ref} = [];
  62. electrodeLocation{iSess}{ref} = [];
  63. electrodeCoordinates{iSess}{ref} = [];
  64. electrodeLabel{iSess}{ref} = [];
  65. electrodeImplantationType{iSess}{ref} = [];
  66. end
  67. % Probe #2 info
  68. ref = 2;
  69. probeInserted{iSess}{ref} = true;
  70. if probeInserted{iSess}{ref} && ~isempty(endCh{iSess}{ref})
  71. electrodeName{iSess}{ref} = 'Neuropixels 1.0';
  72. electrodeDescription{iSess}{ref} = ['Single shank high density probe in position ' num2str(ref)];
  73. electrodeManufacturer{iSess}{ref} = 'imec';
  74. electrodeFolder{iSess}{ref} = [animalRawDataFolder filesep sessionID{iSess} '26'];
  75. if ~exist(electrodeFolder{iSess}{ref},'file') || numel(dir(electrodeFolder{iSess}{ref})) <= 2 % in case the raw data folder name is shorter
  76. electrodeFolder{iSess}{ref} = electrodeFolder{iSess}{ref}(1:end-1);
  77. end
  78. if ~exist(electrodeFolder{iSess}{ref}, 'file') % in case a probe is missing
  79. electrodeFolder{iSess}{ref} = electrodeFolder{iSess}{ref}(1:end-1);
  80. end
  81. if strcmpi(electrodeFolder{iSess}{1}, electrodeFolder{iSess}{2})
  82. probeInserted{iSess}{ref} = false;
  83. continue
  84. end
  85. if contains(electrodeName{iSess}{ref}, 'neuropixels', 'IgnoreCase',true)
  86. electrodeMap = [electrodeFolder{iSess}{ref} filesep 'forPRB_Neuropixels.mat'];
  87. else
  88. electrodeMap = [electrodeFolder{iSess}{ref} filesep 'forPRB_' electrodeName{iSess}{ref} '.mat'];
  89. end
  90. load(electrodeMap, 'ycoords');
  91. nShanks{iSess}{ref} = 1;
  92. nChannelsPerShank{iSess}{ref} = 384;
  93. nChannelsPerShank{iSess}{ref} = min([numel(ycoords) nChannelsPerShank{iSess}{ref}]);
  94. nCh{iSess}{ref} = nChannelsPerShank{iSess}{ref}*nShanks{iSess}{ref};
  95. areas = {'VB','Po','LP','DG','CA1','RSC'};
  96. electrodeLocation{iSess}{ref} = electrodeLocations(areas, endCh{iSess}{ref}, nCh{iSess}{ref});
  97. electrodeCoordinates{iSess}{ref} = [-1.8, -0.5, 0];
  98. electrodeCoordinates{iSess}{ref} = repmat(electrodeCoordinates{iSess}{ref}, nCh{iSess}{ref}, 1);
  99. if size(ycoords,1) == 1
  100. electrodeCoordinates{iSess}{ref}(:,3) = ycoords(1:nCh{iSess}{ref})'./1000;
  101. else
  102. electrodeCoordinates{iSess}{ref}(:,3) = ycoords(1:nCh{iSess}{ref})./1000;
  103. end
  104. electrodeLabel{iSess}{ref} = ['probe' num2str(ref)];
  105. electrodeImplantationType{iSess}{ref} = 'acute';
  106. else % The case when the probe #2 is missing
  107. electrodeName{iSess}{ref} = []; %#ok<*UNRCH>
  108. electrodeDescription{iSess}{ref} = [];
  109. electrodeManufacturer{iSess}{ref} = [];
  110. electrodeFolder{iSess}{ref} = [];
  111. nShanks{iSess}{ref} = [];
  112. nChannelsPerShank{iSess}{ref} = [];
  113. nCh{iSess}{ref} = [];
  114. electrodeLocation{iSess}{ref} = [];
  115. electrodeCoordinates{iSess}{ref} = [];
  116. electrodeLabel{iSess}{ref} = [];
  117. electrodeImplantationType{iSess}{ref} = [];
  118. end
  119. end
  120. %% Local functions
  121. function electrodeLocationVec = electrodeLocations(areas, endCh, nCh)
  122. % electrodeLocationVec = electrodeLocations(areas, endCh, nCh)
  123. % Function assigns brain area to a channel
  124. for iCh = 1:nCh
  125. areaInd = find(endCh >= iCh,1);
  126. electrodeLocationVec{iCh} = areas{areaInd};
  127. end
  128. end