소스 검색

Added info on hdf5lib2 error

dervinism 1 년 전
부모
커밋
3291384a19
1개의 변경된 파일7개의 추가작업 그리고 23개의 파일을 삭제
  1. 7 23
      convert2nwb.m

+ 7 - 23
convert2nwb.m

@@ -144,26 +144,6 @@ for iSess = 1:numel(sessionID)
   end
   [inds, waveformIndexIndex] = util.create_indexed_column(waveformIndexIndex');
   
-  % Convert rel_horz_pos, rel_vert_pos, and waveform_mean to cell arrays of
-  % strings. For some reason I cannot store them in the NWB file in any
-  % other form than strings on one machine but not the other. So if you
-  % encounter an hdf5lib2 error. You may need to uncomment the code lines
-  % below and use variables converted to cell arrays of strings. Also don't
-  % forget to correct lines number 198, 201, and 226.
-  % For more details see https://github.com/NeurodataWithoutBorders/matnwb/issues/462
-%   if ~isempty(spikes)
-%     rel_horz_pos = num2cell(cell2mat(table2array(metadata(:,7)))./1000);
-%     rel_vert_pos = num2cell(cell2mat(table2array(metadata(:,8)))./1000);
-%     for iUnit = 1:numel(rel_horz_pos)
-%       rel_horz_pos{iUnit} = num2str(rel_horz_pos{iUnit});
-%       rel_vert_pos{iUnit} = num2str(rel_vert_pos{iUnit});
-%       waveformMeans{iUnit} = num2str(waveformMeans{iUnit});
-%     end
-%   else
-%     rel_horz_pos = [];
-%     rel_vert_pos = [];
-%   end
-  
   % Store spiking and waveform data inside the nwb object
   % see https://neurodatawithoutborders.github.io/matnwb/doc/+types/+core/Units.html
   if ~isempty(spikes)
@@ -195,10 +175,10 @@ for iSess = 1:numel(sessionID)
       'data', cell2mat(metadata{:,6}), ...
       'description', 'Local probe channel with the largest cluster waveform amplitude'), ...
       'rel_horz_pos', types.hdmf_common.VectorData( ...
-      'data', cell2mat(metadata{:,7})./1000, ... % use rel_horz_pos in Matlab R2021a
+      'data', cell2mat(metadata{:,7})./1000, ...
       'description', 'Probe-relative horizontal position in mm'), ...
       'rel_vert_pos', types.hdmf_common.VectorData( ...
-      'data', cell2mat(metadata{:,8})./1000, ... % use rel_vert_pos in Matlab R2021a
+      'data', cell2mat(metadata{:,8})./1000, ...
       'description', 'Probe tip-relative vertical position in mm'), ...
       'isi_violations', types.hdmf_common.VectorData( ...
       'data', cell2mat(metadata{:,9}), ...
@@ -223,7 +203,7 @@ for iSess = 1:numel(sessionID)
       'description',  'Probe recording channels', ...
       'data', cell2mat(table2array(metadata(:,1)))), ...
       'waveform_mean', types.hdmf_common.VectorData( ...
-      'data', cell2mat(waveformMeans), ... % use waveformMeans Matlab R2021a
+      'data', cell2mat(waveformMeans), ...
       'description', ['Mean waveforms on the probe channel with the largest waveform amplitude.' ...
       'MUA waveforms are excluded. The order that waveforms are stored match the order of units in the unit table.']) ...
       );
@@ -288,6 +268,10 @@ for iSess = 1:numel(sessionID)
   end
   
   % Save the NWB file for the session
+  % If you encounter an hdf5lib2 error, you may need make sure that you are
+  % not storing cell arrays of numbers in VectorData and that you delete
+  % old NWB files rather than try overwriting them. For more details see
+  % https://github.com/NeurodataWithoutBorders/matnwb/issues/462
   if iSess < 10
     nwbExport(nwb, [animalDerivedDataFolderNWB filesep 'ecephys_session_0' num2str(iSess) '.nwb']);
   else