Open MichaelHuth opened 3 months ago
diff --git a/Packages/MIES/MIES_Constants.ipf b/Packages/MIES/MIES_Constants.ipf index 84e9b698c..ba30be858 100644 --- a/Packages/MIES/MIES_Constants.ipf +++ b/Packages/MIES/MIES_Constants.ipf @@ -2313,3 +2313,5 @@ /// @anchor FFTWinFunctions Constant SUTTER_MAX_MAX_TP_PULSES = 10000 Constant INVALID_SWEEP_NUMBER = -1 + +StrConstant LNB_JSON_PREFIX = "/keyIndices"
diff --git a/Packages/MIES/MIES_ExperimentDocumentation.ipf b/Packages/MIES/MIES_ExperimentDocumentation.ipf index 34d86af5e..1e555c5b0 100644 --- a/Packages/MIES/MIES_ExperimentDocumentation.ipf +++ b/Packages/MIES/MIES_ExperimentDocumentation.ipf @@ -493,6 +493,7 @@ static Function ED_WriteChangedValuesToNoteText(device, sweepNo) static Function [WAVE colIndizes, variable rowIndex] ED_FindIndizesAndRedimension(WAVE/T incomingKey, WAVE incomingValues, WAVE/T key, WAVE values, variable logbookType) variable numCols, numKeyRows, numKeyCols, i, j, numAdditions, idx variable lastValidIncomingKeyRow, descIndex, isUserEntry, headstageCont, headstageContDesc, isUnAssoc + variable jsonId string msg, searchStr numKeyRows = DimSize(key, ROWS) @@ -503,6 +504,7 @@ static Function [WAVE colIndizes, variable rowIndex] ED_FindIndizesAndRedimensio WAVE/T/ZZ desc + jsonId = GetLNBJsonId(values) numCols = DimSize(incomingKey, COLS) for(i = 0; i < numCols; i += 1) searchStr = incomingKey[0][i] @@ -522,6 +524,7 @@ static Function [WAVE colIndizes, variable rowIndex] ED_FindIndizesAndRedimensio key[0, lastValidIncomingKeyRow][idx] = incomingKey[p][i] indizes[i] = idx numAdditions += 1 + JSON_AddVariable(jsonId, LNB_JSON_PREFIX + "/" + ReplaceString("/", searchStr, "_"), idx) isUserEntry = (strsearch(searchStr, LABNOTEBOOK_USER_PREFIX, 0) == 0)
diff --git a/Packages/MIES/MIES_MiesUtilities.ipf b/Packages/MIES/MIES_MiesUtilities.ipf index 5c8ffa249..451c99abb 100644 --- a/Packages/MIES/MIES_MiesUtilities.ipf +++ b/Packages/MIES/MIES_MiesUtilities.ipf @@ -47,6 +47,8 @@ /// @brief This file holds utility functions which need to know about MIES inter static Constant ARCHIVE_SIZETHRESHOLD = 52428800 +static StrConstant LNB_JSONID_KEY = "jsonIdLNBKeys" + Menu "GraphMarquee" "Horiz Expand (VisX)", /Q, HorizExpandWithVisX() End @@ -1042,6 +1044,29 @@ threadsafe static Function [WAVE/Z wv, variable index] GetLastSettingChannelInte return [$"", NaN] End +threadsafe Function GetLNBJsonId(WAVE values) + + variable jsonId = GetNumberFromWaveNote(values, LNB_JSONID_KEY) + if(IsFinite(jsonId) && JSON_Exists(jsonId, "")) + return jsonId + endif + + jsonId = JSON_New() + SetNumberInWaveNote(values, LNB_JSONID_KEY, jsonId) + + JSON_AddTreeObject(jsonId, LNB_JSON_PREFIX) + Make/FREE/N=(DimSize(values, COLS)) indexHelper + MultiThread indexHelper = JSON_AddVariable(jsonId, LNB_JSON_PREFIX + "/" + ReplaceString("/", GetDimLabel(values, COLS, p), "_"), p) + + return jsonId +End + +threadsafe Function GetLNBSettingsColumn(WAVE values, string key) + + variable index = JSON_GetVariable(GetLNBJsonId(values), LNB_JSON_PREFIX + "/" + ReplaceString("/", key, "_"), ignoreErr = 1) + return IsNaN(index) ? -2 : index +End + threadsafe Function GetLNBSettingsColumn(WAVE values, string key) string cacheKey, sortedkeyWaveName
then replace in GetLastSetting the line with settingCol = FindDimLabel(values, COLS, setting) with a call to GetLNBSettingsColumn
settingCol = FindDimLabel(values, COLS, setting)
GetLNBSettingsColumn
requires a thread aware JSON XOP
then replace in GetLastSetting the line with
settingCol = FindDimLabel(values, COLS, setting)
with a call toGetLNBSettingsColumn
requires a thread aware JSON XOP