Skip to content

Commit 466c735

Browse files
committed
NWB: Insert recreated epoch data into LNB on NWB_ExportAllData
Epoch data is recreated for each sweep and inserted with the additional LNB column "PostProcessed" set to 1.
1 parent 6abb374 commit 466c735

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

Packages/MIES/MIES_Epochs.ipf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ End
17411741
/// @param sweepDFR single sweep folder, e.g. for measurement with a device this wold be DFREF sweepDFR = GetSingleSweepFolder(deviceDFR, sweepNo)
17421742
/// @param sweepNo sweep number
17431743
/// @returns recreated 4D epoch wave
1744-
static Function/WAVE EP_RecreateEpochsFromLoadedData(WAVE numericalValues, WAVE/T textualValues, DFREF sweepDFR, variable sweepNo)
1744+
Function/WAVE EP_RecreateEpochsFromLoadedData(WAVE numericalValues, WAVE/T textualValues, DFREF sweepDFR, variable sweepNo)
17451745

17461746
STRUCT DataConfigurationResult s
17471747
variable channelNr, plannedTime, acquiredTime, adSize, firstUnacquiredIndex

Packages/MIES/MIES_MiesUtilities_Logbook.ipf

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,3 +1938,42 @@ Function ParseLogbookMode(string modeText)
19381938
break
19391939
endswitch
19401940
End
1941+
1942+
Function InsertRecreatedEpochsIntoLBN(WAVE numericalValues, WAVE/T textualValues, string device, variable sweepNo)
1943+
1944+
string epochList
1945+
variable channelNumber, channelType
1946+
variable rowIndex, colIndexEpochs, headstage
1947+
1948+
DFREF deviceDFR = GetDeviceDataPath(device)
1949+
DFREF sweepDFR = GetSingleSweepFolder(deviceDFR, sweepNo)
1950+
WAVE/Z recEpochs = EP_RecreateEpochsFromLoadedData(numericalValues, textualValues, sweepDFR, sweepNo)
1951+
if(!WaveExists(recEpochs))
1952+
print "Could not recreate Epochs."
1953+
return NaN
1954+
endif
1955+
1956+
[rowIndex, colIndexEpochs] = ED_InsertPostProcessRow(textualValues, device, sweepNo, DATA_ACQUISITION_MODE, EPOCHS_ENTRY_KEY)
1957+
1958+
for(channelType = 0; channelType < XOP_CHANNEL_TYPE_COUNT; channelType += 1)
1959+
for(channelNumber = 0; channelNumber < NUM_DA_TTL_CHANNELS; channelNumber += 1)
1960+
// Currently only implemented for DAC channel type
1961+
if(channelType != XOP_CHANNEL_TYPE_DAC)
1962+
continue
1963+
endif
1964+
1965+
epochList = EP_EpochWaveToStr(recEpochs, channelNumber, channelType)
1966+
if(IsEmpty(epochList))
1967+
continue
1968+
endif
1969+
1970+
headstage = AFH_GetHeadstageFromChannelNumberAndType(device, channelType, channelNumber)
1971+
if(!IsValidHeadstage(headstage))
1972+
printf "Could not resolve headstage for device %s, channel %d, type %d but got epoch info for it.\r", device, channelNumber, channelType
1973+
continue
1974+
endif
1975+
1976+
textualValues[rowIndex][colIndexEpochs][headstage] = epochList
1977+
endfor
1978+
endfor
1979+
End

Packages/MIES/MIES_NeuroDataWithoutBorders.ipf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ static Function NWB_AddDeviceSpecificData(STRUCT NWBAsyncParameters &s, variable
467467

468468
AddModificationTimeEntry(s.locationID, s.nwbVersion)
469469
NWB_AddDevice(s)
470-
NWB_WriteLabnotebooksAndComments(s)
471470
NWB_WriteTestpulseData(s, writeStoredTestPulses)
472471
End
473472

@@ -724,6 +723,8 @@ Function NWB_ExportAllData(variable nwbVersion, [string device, string overrideF
724723
WAVE s.DAQDataWave = TextSweepToWaveRef(sweepWave)
725724
WAVE s.DAQConfigWave = configWave
726725

726+
InsertRecreatedEpochsIntoLBN(s.numericalValues, s.textualValues, s.device, s.sweep)
727+
727728
NWB_AppendSweepLowLevel(s)
728729
stimsetList += AB_GetStimsetFromPanel(device, sweep)
729730

@@ -732,6 +733,8 @@ Function NWB_ExportAllData(variable nwbVersion, [string device, string overrideF
732733
endfor
733734
LOG_AddEntry(PACKAGE_MIES, "export", keys = {"size [MiB]"}, values = {num2str(NWB_GetExportedFileSize(device))})
734735

736+
NWB_WriteLabnotebooksAndComments(s)
737+
735738
NWB_AppendStimset(nwbVersion, s.locationID, stimsetList, compressionMode)
736739

737740
if(writeIgorHistory)

0 commit comments

Comments
 (0)