Skip to content

Commit 7c44b0f

Browse files
committed
NWB_AppendSweepLowLevel: Add assertion if GetDAQDataSingleColumnWaveNG returns nothing
Some broken experiments have differing sweep data in the datafolder and the labnotebook. Let's add assertions in case we could not get the required single channel data.
1 parent fda7a15 commit 7c44b0f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Packages/MIES/MIES_NeuroDataWithoutBorders.ipf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,8 @@ threadsafe static Function NWB_AppendSweepLowLevel(STRUCT NWBAsyncParameters &s)
12501250
params.samplingRate = ConvertSamplingIntervalToRate(GetSamplingInterval(s.DAQConfigWave, params.channelType)) * KILO_TO_ONE
12511251
col = AFH_GetDAQDataColumn(s.DAQConfigWave, params.channelNumber, params.channelType)
12521252
writtenDataColumns[col] = 1
1253-
WAVE params.data = GetDAQDataSingleColumnWaveNG(s.numericalValues, s.textualValues, s.sweep, sweepDFR, params.channelType, params.channelNumber)
1253+
WAVE/Z params.data = GetDAQDataSingleColumnWaveNG(s.numericalValues, s.textualValues, s.sweep, sweepDFR, params.channelType, params.channelNumber)
1254+
ASSERT_TS(WaveExists(params.data), "Missing AD data for channel " + num2str(adc) + " of headstage " + num2str(i) + ".")
12541255
NWB_GetTimeSeriesProperties(s.nwbVersion, s.numericalKeys, s.numericalValues, params, tsp)
12551256
params.groupIndex = IsFinite(params.groupIndex) ? params.groupIndex : GetNextFreeGroupIndex(s.locationID, path)
12561257
WriteSingleChannel(s.locationID, path, s.nwbVersion, params, tsp, compressionMode = s.compressionMode)
@@ -1263,7 +1264,8 @@ threadsafe static Function NWB_AppendSweepLowLevel(STRUCT NWBAsyncParameters &s)
12631264
params.samplingRate = ConvertSamplingIntervalToRate(GetSamplingInterval(s.DAQConfigWave, params.channelType)) * KILO_TO_ONE
12641265
col = AFH_GetDAQDataColumn(s.DAQConfigWave, params.channelNumber, params.channelType)
12651266
writtenDataColumns[col] = 1
1266-
WAVE params.data = GetDAQDataSingleColumnWaveNG(s.numericalValues, s.textualValues, s.sweep, sweepDFR, params.channelType, params.channelNumber)
1267+
WAVE/Z params.data = GetDAQDataSingleColumnWaveNG(s.numericalValues, s.textualValues, s.sweep, sweepDFR, params.channelType, params.channelNumber)
1268+
ASSERT_TS(WaveExists(params.data), "Missing DA data for channel " + num2str(dac) + " of headstage " + num2str(i) + ".")
12671269
NWB_GetTimeSeriesProperties(s.nwbVersion, s.numericalKeys, s.numericalValues, params, tsp)
12681270
params.groupIndex = IsFinite(params.groupIndex) ? params.groupIndex : GetNextFreeGroupIndex(s.locationID, path)
12691271
WAVE/Z/T params.epochs = EP_FetchEpochs_TS(s.numericalValues, s.textualValues, s.sweep, params.channelNumber, params.channelType)
@@ -1308,7 +1310,8 @@ threadsafe static Function NWB_AppendSweepLowLevel(STRUCT NWBAsyncParameters &s)
13081310

13091311
NWB_GetTimeSeriesProperties(s.nwbVersion, s.numericalKeys, s.numericalValues, params, tsp)
13101312
params.groupIndex = IsFinite(params.groupIndex) ? params.groupIndex : GetNextFreeGroupIndex(s.locationID, path)
1311-
WAVE params.data = GetDAQDataSingleColumnWaveNG(s.numericalValues, s.textualValues, s.sweep, sweepDFR, params.channelType, i)
1313+
WAVE/Z params.data = GetDAQDataSingleColumnWaveNG(s.numericalValues, s.textualValues, s.sweep, sweepDFR, params.channelType, i)
1314+
ASSERT_TS(WaveExists(params.data), "Missing TTL data for channel " + num2str(i) + ".")
13121315
WAVE/Z/T params.epochs = EP_FetchEpochs_TS(s.numericalValues, s.textualValues, s.sweep, i, params.channelType)
13131316

13141317
s.locationID = WriteSingleChannel(s.locationID, path, s.nwbVersion, params, tsp, compressionMode = s.compressionMode, nwbFilePath = s.nwbFilePath)

0 commit comments

Comments
 (0)