Skip to content

Commit

Permalink
SFH: Remove trailing ; in old epoch name fallback in SFH_GetEpochName…
Browse files Browse the repository at this point in the history
…sFromInfo

- In EP_FetchEpochs we add a traling ; to the epoch tags if not present
  If we have a old non-list based epoch tag just with a name, this changes the
  name. Assuming a missing short name indicates an old epoch tag, the trailing
  semicolon is removed again to have a clean roundtrip.
  • Loading branch information
MichaelHuth committed Jul 21, 2023
1 parent da7dd1d commit 1340c20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Packages/MIES/MIES_SweepFormula_Helpers.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,16 @@ End

Function/WAVE SFH_GetEpochNamesFromInfo(WAVE/T epochInfo)

string epName, epShortName
string epName, epShortName, epLongName
variable i
variable numEpochs = DimSize(epochInfo, ROWS)

Make/FREE/T/N=(numEpochs) epNames
for(i = 0; i < numEpochs; i += 1)
epName = epochInfo[i][EPOCH_COL_TAGS]
epShortName = EP_GetShortName(epName)
epNames[i] = SelectString(IsEmpty(epShortName), epShortName, epName)
epLongName = RemoveEnding(epName, ";")
epNames[i] = SelectString(IsEmpty(epShortName), epShortName, epLongName)
endfor

return epNames
Expand Down
5 changes: 3 additions & 2 deletions Packages/tests/Basic/UTF_SweepFormula.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,7 @@ End
static Function TestOperationEpochs()

variable i, j, sweepNumber, channelNumber, numResultsRef, numSweeps, numChannels
string str, trace, key, name, win, device, epoch2, textKey, textValue
string str, trace, key, name, win, device, epoch2, textKey, textValue, epochLongName
variable activeChannelsDA = 4

[win, device] = CreateFakeDataBrowserWindow()
Expand Down Expand Up @@ -2865,7 +2865,8 @@ static Function TestOperationEpochs()
endfor

// find epoch without shortname
str = "epochs(\"" + epoch2 + "\", select(channels(DA), 0))"
epochLongName = RemoveEnding(epoch2, ";")
str = "epochs(\"" + epochLongName + "\", select(channels(DA), 0))"
WAVE/WAVE dataWref = SF_ExecuteFormula(str, win, useVariables=0)
CHECK_EQUAL_VAR(DimSize(dataWref, ROWS), activeChannelsDA)

Expand Down

0 comments on commit 1340c20

Please sign in to comment.