@@ -97,27 +97,36 @@ RecordEngineManager* NWBRecordEngine::getEngineManager()
9797 " experiment_aqnwb" + std::to_string (experimentNumber) + " .nwb" ;
9898
9999 this ->io = AQNWB::createIO (" HDF5" , filename);
100+ this ->io ->open ();
100101
101102 // create recording array mapping for channel information
102103 NWBRecordEngine::createRecordingArrays ();
103104
104105 // create the nwbfile
105106 std::string dataCollection = " Open Ephys GUI Version " + CoreServices::getGUIVersion ().toStdString ();
106- this ->nwbfile = std::make_unique<AQNWB ::NWB ::NWBFile>(AQNWB::generateUuid (), io);
107- this ->nwbfile ->initialize (" Recording with the Open Ephys GUI" , dataCollection);
107+ this ->nwbfile = std::make_unique<AQNWB ::NWB ::NWBFile>(this ->io );
108+ Status initStatus = this ->nwbfile ->initialize (AQNWB::generateUuid (), " Recording with the Open Ephys GUI" , dataCollection);
109+ AQNWB::checkStatus (initStatus, " NWBFile initialization" );
108110 // TODO - have option to initialize cache size based on # of channels
109111
112+ // create the electrodes table
113+ Status elecTableStatus = this ->nwbfile ->createElectrodesTable (this ->recordingArrays );
114+ AQNWB::checkStatus (elecTableStatus, " Electrodes table initialization" );
115+
110116 // create recording containers
111117 this ->recordingContainers = std::make_unique<AQNWB ::NWB ::RecordingContainers>();
112- this ->nwbfile ->createElectricalSeries (
113- this ->recordingArrays , this ->recordingArraysNames , AQNWB ::BaseDataType::I16 , this ->recordingContainers .get (), this ->esContainerIndexes );
118+ Status elecSeriesStatus = this ->nwbfile ->createElectricalSeries (
119+ this ->recordingArrays , this ->recordingArraysNames , AQNWB ::IO ::BaseDataType::I16 , this ->recordingContainers .get (), this ->esContainerIndexes );
120+ AQNWB::checkStatus (elecSeriesStatus, " ElectricalSeries creation" );
114121 // TODO add io_settings to set chunk size for different data types
115122
116- this ->nwbfile ->createSpikeEventSeries (
117- this ->spikeRecordingArrays , this ->spikeRecordingArraysNames , AQNWB ::BaseDataType::I16 , this ->recordingContainers .get (), this ->spikeContainerIndexes );
123+ Status spikeEventSeriesStatus = this ->nwbfile ->createSpikeEventSeries (
124+ this ->spikeRecordingArrays , this ->spikeRecordingArraysNames , AQNWB ::IO ::BaseDataType::I16 , this ->recordingContainers .get (), this ->spikeContainerIndexes );
125+ AQNWB::checkStatus (spikeEventSeriesStatus, " SpikeEventSeries creation" );
118126
119127 // start recording
120- this ->io ->startRecording ();
128+ Status startRecordingStatus = this ->io ->startRecording ();
129+ AQNWB::checkStatus (startRecordingStatus, " Start recording" );
121130 }
122131 }
123132
@@ -140,15 +149,15 @@ void NWBRecordEngine::writeContinuousData(int writeChannel,
140149 AQNWB ::Types::SizeType datasetIndex = 0 ;
141150 for (auto & channelVector : this ->recordingArrays ) {
142151 for (auto & ch : channelVector) {
143- if (ch.globalIndex == realChannel) {
152+ if (ch.getGlobalIndex () == realChannel) {
144153 channel = &ch;
145154 break ;
146155 }
147156 }
148157 }
149158
150159 std::unique_ptr<int16_t []> intBuffer = AQNWB::transformToInt16 (static_cast <SizeType>(size), channel->getBitVolts (), dataBuffer);
151- this ->recordingContainers ->writeElectricalSeriesData (this ->esContainerIndexes [channel->groupIndex ],
160+ this ->recordingContainers ->writeElectricalSeriesData (this ->esContainerIndexes [channel->getGroupIndex () ],
152161 *channel,
153162 static_cast <SizeType>(size),
154163 intBuffer.get (),
@@ -257,7 +266,7 @@ void NWBRecordEngine::createRecordingArrays()
257266 channelInfo->getBitVolts ()));
258267 }
259268 this ->recordingArrays .push_back (channelVector);
260- this ->recordingArraysNames .push_back (channelVector[0 ].groupName );
269+ this ->recordingArraysNames .push_back (channelVector[0 ].getGroupName () );
261270 }
262271
263272 // create recording arrays for spike channels in nwb file
0 commit comments