Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHuth committed Jan 31, 2023
1 parent 09637ca commit 77820a9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
1 change: 1 addition & 0 deletions Packages/MIES/MIES_Structures.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ EndStructure
Structure SF_PlotMetaData
string dataType // from SF_META_DATATYPE constant
string opStack // from SF_META_OPSTACK constant
string opStackNice // from SF_META_OPSTACKNICE constant
string xAxisLabel // from SF_META_XAXISLABEL constant
string yAxisLabel // from SF_META_YAXISLABEL constant
EndStructure
40 changes: 36 additions & 4 deletions Packages/MIES/MIES_SweepFormula.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,7 @@ static Function [WAVE/WAVE formulaResults, STRUCT SF_PlotMetaData plotMetaData]

plotMetaData.dataType = JWN_GetStringFromWaveNote(wvYRef, SF_META_DATATYPE)
plotMetaData.opStack = JWN_GetStringFromWaveNote(wvYRef, SF_META_OPSTACK)
plotMetaData.opStackNice = JWN_GetStringFromWaveNote(wvYRef, SF_META_OPSTACKNICE)
plotMetaData.xAxisLabel = SelectString(useXLabel, SF_XLABEL_USER, JWN_GetStringFromWaveNote(wvYRef, SF_META_XAXISLABEL))
plotMetaData.yAxisLabel = JWN_GetStringFromWaveNote(wvYRef, SF_META_YAXISLABEL) + dataUnits

Expand All @@ -1102,7 +1103,14 @@ static Function/S SF_GetTraceAnnotationText(STRUCT SF_PlotMetaData& plotMetaData
string channelId, prefix
string traceAnnotation

prefix = RemoveEnding(ReplaceString(";", plotMetaData.opStack, " "), " ")
strswitch(plotMetaData.dataType)
case SF_DATATYPE_APFREQUENCY:
prefix = StringFromList(0, plotMetaData.opStackNice, ",")
break
default:
prefix = RemoveEnding(ReplaceString(";", plotMetaData.opStack, " "), " ")
break
endswitch

strswitch(plotMetaData.dataType)
case SF_DATATYPE_TP:
Expand Down Expand Up @@ -3969,7 +3977,8 @@ static Function/WAVE SF_OperationData(variable jsonId, string jsonPath, string g
DebugPrint("Call to SFH_GetSweepsForFormula returned no results")
endif

JWN_SetStringInWaveNote(output, SF_META_OPSTACK, AddListItem(SF_OP_DATA, ""))
SFH_AddOpToOpStack(output, "", SF_OP_DATA)
SFH_AddOpToOpStackNice(output, "", SF_OP_DATA)

return SFH_GetOutputForExecutor(output, graph, SF_OP_DATA)
End
Expand Down Expand Up @@ -4222,7 +4231,7 @@ End
static Function/WAVE SF_OperationApFrequency(variable jsonId, string jsonPath, string graph)

variable i, numArgs, keepX
string xLabel
string xLabel, methodStr, argSetup

numArgs = SFH_GetNumberOfArguments(jsonID, jsonPath)
SFH_ASSERT(numArgs <= 6, "ApFrequency has 6 arguments at most.")
Expand Down Expand Up @@ -4274,6 +4283,13 @@ static Function/WAVE SF_OperationApFrequency(variable jsonId, string jsonPath, s
Make/FREE method = {SF_APFREQUENCY_FULL}
endif

argSetup = ReplaceStringByKey("Operation", "", SF_OP_APFREQUENCY)
argSetup = ReplaceStringByKey("XAxisType", argSetup, xAxisType[0])
argSetup = ReplaceStringByKey("Normalize", argSetup, normalize[0])
argSetup = ReplaceStringByKey("ResultType", argSetup, timeFreq[0])
argSetup = ReplaceNumberByKey("Level", argSetup, level[0])
argSetup = ReplaceStringByKey("Method", argSetup, SF_OperationApFrequencyMethodToString(method[0]))

WAVE/WAVE output = SFH_CreateSFRefWave(graph, SF_OP_APFREQUENCY, DimSize(input, ROWS))
output = SF_OperationApFrequencyImpl(input[p], level[0], method[0], timeFreq[0], normalize[0], xAxisType[0])

Expand All @@ -4283,7 +4299,7 @@ static Function/WAVE SF_OperationApFrequency(variable jsonId, string jsonPath, s
JWN_SetStringInWaveNote(output, SF_META_XAXISLABEL, xLabel)
endif

SFH_TransferFormulaDataWaveNoteAndMeta(input, output, SF_OP_APFREQUENCY, SF_DATATYPE_APFREQUENCY, keepX=keepX)
SFH_TransferFormulaDataWaveNoteAndMeta(input, output, SF_OP_APFREQUENCY, SF_DATATYPE_APFREQUENCY, keepX=keepX, opNice=argSetup)

return SFH_GetOutputForExecutor(output, graph, SF_OP_APFREQUENCY)
End
Expand Down Expand Up @@ -4342,6 +4358,22 @@ static Function/WAVE SF_OperationApFrequencyImpl(WAVE data, variable level, vari
return outD
End

static Function/S SF_OperationApFrequencyMethodToString(variable method)

switch(method)
case SF_APFREQUENCY_FULL:
return "Full"
case SF_APFREQUENCY_INSTANTANEOUS:
return "Instantaneous"
case SF_APFREQUENCY_INSTANTANEOUS_PAIR:
return "Instantaneous Pair"
case SF_APFREQUENCY_APCOUNT:
return "APCount"
default:
ASSERT(0, "Unknown apfrequency method")
endswitch
End

static Function SF_ApFrequencyInstantaneous(WAVE peaksAt)

variable numPeaks
Expand Down
6 changes: 3 additions & 3 deletions Packages/MIES/MIES_SweepFormula_Helpers.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,14 @@ Function SFH_CleanUpInput(WAVE input)
#endif
End

static Function SFH_AddOpToOpStack(WAVE w, string oldStack, string opShort)
Function SFH_AddOpToOpStack(WAVE w, string oldStack, string opShort)

JWN_SetStringInWaveNote(w, SF_META_OPSTACK, AddListItem(opShort, oldStack))
End

static Function SFH_AddOpToOpStackNice(WAVE w, string oldStack, string opNice)
Function SFH_AddOpToOpStackNice(WAVE w, string oldStack, string opNice)

JWN_SetStringInWaveNote(w, SF_META_OPSTACKNICE, AddListItem(opNice, oldStack))
JWN_SetStringInWaveNote(w, SF_META_OPSTACKNICE, AddListItem(opNice, oldStack, ","))
End

Function/WAVE SFH_GetOutputForExecutorSingle(WAVE/Z data, string graph, string opShort[, string opNice, variable discardOpStack, WAVE clear])
Expand Down

0 comments on commit 77820a9

Please sign in to comment.