-
Notifications
You must be signed in to change notification settings - Fork 9
Add table operation in SweepFormula #2171
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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" | ||||||
|
@@ -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 | ||||||
|
@@ -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 | ||||||
|
@@ -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) | ||||||
|
@@ -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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The table flag is being set on the input wave instead of the output wave. This means the flag will be applied to the original data rather than the processed output, which could affect other operations that use the same input data. This should be applied to the output wave elements instead.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
|
||||||
return SFH_GetOutputForExecutor(output, graph, SF_OP_TABLE) | ||||||
End | ||||||
|
||||||
static Function/WAVE SF_OperationDerivativeImpl(WAVE/Z input) | ||||||
|
||||||
if(!WaveExists(input)) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is creating a reference wave using SF_OP_DERIVATIVE constant instead of SF_OP_TABLE. This should be SF_OP_TABLE to maintain consistency with the operation being performed.
Copilot uses AI. Check for mistakes.