Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table operation in SweepFormula #2171

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion Packages/MIES/MIES_SweepFormula.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static StrConstant SF_OP_RMS = "rms"
static StrConstant SF_OP_VARIANCE = "variance"
static StrConstant SF_OP_STDEV = "stdev"
static StrConstant SF_OP_DERIVATIVE = "derivative"
static StrConstant SF_OP_TABLE = "table"
static StrConstant SF_OP_INTEGRATE = "integrate"
static StrConstant SF_OP_TIME = "time"
static StrConstant SF_OP_XVALUES = "xvalues"
Expand Down Expand Up @@ -208,7 +209,7 @@ Function/WAVE SF_GetNamedOperations()
SF_OP_CHANNELS, SF_OP_DATA, SF_OP_LABNOTEBOOK, SF_OP_WAVE, SF_OP_FINDLEVEL, SF_OP_EPOCHS, SF_OP_TP, \
SF_OP_STORE, SF_OP_SELECT, SF_OP_POWERSPECTRUM, SF_OP_TPSS, SF_OP_TPBASE, SF_OP_TPINST, SF_OP_TPFIT, \
SF_OP_PSX, SF_OP_PSX_KERNEL, SF_OP_PSX_STATS, SF_OP_PSX_RISETIME, SF_OP_PSX_PREP, SF_OP_PSX_DECONV_FILTER, \
SF_OP_MERGE, SF_OP_FIT, SF_OP_FITLINE, SF_OP_DATASET}
SF_OP_MERGE, SF_OP_FIT, SF_OP_FITLINE, SF_OP_DATASET, SF_OP_TABLE}

return wt
End
Expand Down Expand Up @@ -1020,6 +1021,9 @@ static Function/WAVE SF_FormulaExecutor(string graph, variable jsonID, [string j
case SF_OP_DERIVATIVE:
WAVE out = SF_OperationDerivative(jsonId, jsonPath, graph)
break
case SF_OP_TABLE:
WAVE out = SF_OperationTable(jsonID, jsonPath, graph)
break
case SF_OP_INTEGRATE:
WAVE out = SF_OperationIntegrate(jsonId, jsonPath, graph)
break
Expand Down Expand Up @@ -1770,6 +1774,13 @@ static Function SF_FormulaPlotter(string graph, string formula, [variable dmMode
WAVE wvX = dummy
endif

variable useTable = !!JWN_GetNumberFromWaveNote(wvY, "Table")

if(useTable)
Edit/HOST=$win/FG=(FL, FT, FR, FB) wvY.d
continue
endif

if(!WaveExists(wvX))
numTraces = yMxN
SF_CheckNumTraces(graph, numTraces)
Expand Down Expand Up @@ -3795,6 +3806,21 @@ static Function/WAVE SF_OperationDerivative(variable jsonId, string jsonPath, st
return SFH_GetOutputForExecutor(output, graph, SF_OP_DERIVATIVE, clear = input)
End

static Function/WAVE SF_OperationTable(variable jsonId, string jsonPath, string graph)

SFH_CheckArgumentCount(jsonId, jsonPath, SF_OP_TABLE, 1, maxArgs = 1)

WAVE/WAVE input = SF_ResolveDatasetFromJSON(jsonId, jsonPath, graph, 0)

WAVE/WAVE output = SFH_CreateSFRefWave(graph, SF_OP_DERIVATIVE, DimSize(input, ROWS))

output[] = input[p]

JWN_SetNumberInWaveNote(input, "Table", 1)

return SFH_GetOutputForExecutor(output, graph, SF_OP_TABLE)
End

static Function/WAVE SF_OperationDerivativeImpl(WAVE/Z input)

if(!WaveExists(input))
Expand Down
Loading