From 1340c205f31b7dfc0379d96bfa82017e77864318 Mon Sep 17 00:00:00 2001 From: Michael Huth Date: Thu, 20 Jul 2023 02:39:12 +0200 Subject: [PATCH] SFH: Remove trailing ; in old epoch name fallback in SFH_GetEpochNamesFromInfo - 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. --- Packages/MIES/MIES_SweepFormula_Helpers.ipf | 5 +++-- Packages/tests/Basic/UTF_SweepFormula.ipf | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Packages/MIES/MIES_SweepFormula_Helpers.ipf b/Packages/MIES/MIES_SweepFormula_Helpers.ipf index c61f70bfb7..7555f698d6 100644 --- a/Packages/MIES/MIES_SweepFormula_Helpers.ipf +++ b/Packages/MIES/MIES_SweepFormula_Helpers.ipf @@ -780,7 +780,7 @@ End Function/WAVE SFH_GetEpochNamesFromInfo(WAVE/T epochInfo) - string epName, epShortName + string epName, epShortName, epLongName variable i variable numEpochs = DimSize(epochInfo, ROWS) @@ -788,7 +788,8 @@ Function/WAVE SFH_GetEpochNamesFromInfo(WAVE/T epochInfo) 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 diff --git a/Packages/tests/Basic/UTF_SweepFormula.ipf b/Packages/tests/Basic/UTF_SweepFormula.ipf index d7e4d2f8be..bc9debfc25 100644 --- a/Packages/tests/Basic/UTF_SweepFormula.ipf +++ b/Packages/tests/Basic/UTF_SweepFormula.ipf @@ -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() @@ -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)