Skip to content

Commit bbb48e1

Browse files
authored
Merge pull request #2582 from AllenInstitute/bugfix/2582-sf_remove_scale_from_minmax
SF: Remove scale copy for Min and Max
2 parents 77dc412 + f645d7b commit bbb48e1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Packages/MIES/MIES_SweepFormula_Operations.ipf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,8 +1469,6 @@ static Function/WAVE SFO_OperationMaxImpl(WAVE/Z input)
14691469
SFH_ASSERT(WaveDims(input) <= 2, "max accepts only upto 2d data")
14701470
SFH_ASSERT(DimSize(input, ROWS) > 0, "max requires at least one data point")
14711471
MatrixOP/FREE out = maxCols(input)^t
1472-
CopyScales input, out
1473-
SetScale/P x, DimOffset(out, ROWS), DimDelta(out, ROWS), "", out
14741472
SF_FormulaWaveScaleTransfer(input, out, COLS, ROWS)
14751473

14761474
return out
@@ -1539,8 +1537,6 @@ static Function/WAVE SFO_OperationMinImpl(WAVE/Z input)
15391537
SFH_ASSERT(WaveDims(input) <= 2, "min accepts only upto 2d data")
15401538
SFH_ASSERT(DimSize(input, ROWS) > 0, "min requires at least one data point")
15411539
MatrixOP/FREE out = minCols(input)^t
1542-
CopyScales input, out
1543-
SetScale/P x, DimOffset(out, ROWS), DimDelta(out, ROWS), "", out
15441540

15451541
SF_FormulaWaveScaleTransfer(input, out, COLS, ROWS)
15461542

Packages/tests/Basic/UTF_SweepFormula_Operations.ipf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,18 @@ static Function TestOperationMinMax()
487487
// note: TestOperationMinMaxHelper calls GetSingleResult that verifies that [1,2] is evaluated as single argument
488488
TestOperationMinMaxHelper(win, "{\"min\":[[1,2]]}", "min([1,2])", 1)
489489

490+
// Check DimOffset/unit removal
491+
Make/O/D/N=(1) input = p
492+
SetScale/P x, 10, 10, "unit", input
493+
wavePath = GetWavesDataFolder(input, 2)
494+
str = "min(wave(" + wavePath + "))"
495+
WAVE data = SFE_ExecuteFormula(str, win, singleResult = 1, useVariables = 0)
496+
CHECK_EQUAL_VAR(DimOffset(data, ROWS), 0)
497+
str = WaveUnits(data, ROWS)
498+
CHECK_EMPTY_STR(str)
499+
490500
// check limit to 2d waves for min, max, avg
491-
Make/D/N=(2, 2, 2) input = p + 2 * q + 4 * r
501+
Make/O/D/N=(2, 2, 2) input = p + 2 * q + 4 * r
492502
wavePath = GetWavesDataFolder(input, 2)
493503
str = "min(wave(" + wavePath + "))"
494504
try

0 commit comments

Comments
 (0)