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

Always use linestyle for sweep data #2284

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Packages/MIES/MIES_Constants.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,7 @@ StrConstant SF_META_CUSTOM_LEGEND = "/CustomLegend" // string with
StrConstant SF_META_ARGSETUPSTACK = "/ArgSetupStack" // string
StrConstant SF_META_TRACECOLOR = "/TraceColor" // numeric wave, applies to markers and lines
StrConstant SF_META_LINESTYLE = "/LineStyle" // number
StrConstant SF_META_TRACE_MODE = "/TraceMode" // number
StrConstant SF_META_TRACE_MODE = "/TraceMode" // number, one of @ref TraceDisplayTypes
StrConstant SF_META_TRACETOFRONT = "/TraceToFront" // number, boolean, defaults to false (0)
StrConstant SF_META_DONOTPLOT = "/DoNotPlot" // number, boolean, defaults to false (0)
StrConstant SF_META_WINDOW_HOOK = "/WindowHook" // string
Expand Down
2 changes: 2 additions & 0 deletions Packages/MIES/MIES_SweepFormula_Helpers.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ static Function/WAVE SFH_GetSweepsForFormulaImpl(string graph, WAVE/WAVE selectD
colorGroup = GetUniqueInteger()
JWN_SetNumberInWaveNote(rangedSweepData, SF_META_COLOR_GROUP, colorGroup)

JWN_SetNumberInWaveNote(rangedSweepData, SF_META_TRACE_MODE, TRACE_DISPLAY_MODE_LINES)

EnsureLargeEnoughWave(output, indexShouldExist = index)
output[index] = rangedSweepData
index += 1
Expand Down
20 changes: 18 additions & 2 deletions Packages/tests/Basic/UTF_SweepFormula_Operations.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1577,8 +1577,8 @@ End
static Function TestOperationData()

variable i, j, numChannels, sweepNo, sweepCnt, numResultsRef, clampMode
string str, strSelect, epochStr, name, trace, wvList
string win, device
string str, strSelect, epochStr, name, trace, wvList, traces, traceInfos
string win, device, winBase
variable mode = DATA_ACQUISITION_MODE
variable numSweeps = 2
variable dataSize = 10
Expand Down Expand Up @@ -1911,6 +1911,22 @@ static Function TestOperationData()
PASS()
endtry

// check that we use line style even for a couple of points
str = "data(select(selrange([2, 6]), selsweeps(0), selchannels(AD6)))"
winBase = ExecuteSweepFormulaCode(win, str)
win = winBase + "#Graph0"

traces = TraceNameList(win, ";", 1 + 2)
CHECK_EQUAL_VAR(ItemsInList(traces), 1)

trace = StringFromList(0, traces)
CHECK_PROPER_STR(trace)

traceInfos = TraceInfo(win, trace, 0)
CHECK_PROPER_STR(traceInfos)

CHECK(GrepString(traceInfos, "\bmode\(x\)=0\b"))

// workaround permanent waves being present
wvList = GetListOfObjects(GetDataFolderDFR(), "data*")
CallFunctionForEachListItem_TS(KillOrMoveToTrashPath, wvList)
Expand Down
61 changes: 16 additions & 45 deletions Packages/tests/Basic/UTF_SweepFormula_PSX.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1292,18 +1292,6 @@ static Function CheckEventDataHelper(WAVE/Z/WAVE dataWref, variable index)
CHECK_EQUAL_VAR(V_numInfs, 0)
End

static Function ExecuteSweepFormulaCode(string browser, string code)

string bsPanel

SF_SetFormula(browser, code)

bsPanel = BSP_GetPanel(browser)

PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_SF", val = 1)
PGC_SetAndActivateControl(bsPanel, "button_sweepFormula_display", val = NaN)
End

static Function CheckPSXEventField(WAVE/WAVE psxEventWaves, WAVE/T colLabels, WAVE indices, variable val)

variable idx
Expand Down Expand Up @@ -1361,9 +1349,8 @@ static Function MouseSelectionPSX()

// combo0 is the current one

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
psxPlot = MIES_PSX#PSX_GetPSXGraph(win)
REQUIRE(WindowExists(psxPlot))

Expand Down Expand Up @@ -1520,9 +1507,8 @@ static Function MouseSelectionPSXStats([STRUCT IUTF_mData &m])

// combo0 is the current one

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
psxStatsGraph = MIES_PSX#PSX_GetPSXStatsGraph(psxGraph)

Expand Down Expand Up @@ -1611,9 +1597,8 @@ static Function MouseSelectionStatsPostProcNonFinite()

code = GetTestCode("nonfinite", eventState = "all", prop = "tau")

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
psxStatsGraph = MIES_PSX#PSX_GetPSXStatsGraph(psxGraph)
Expand Down Expand Up @@ -1758,9 +1743,8 @@ static Function AllEventGraph([STRUCT IUTF_mData &m])

// combo0 is the current one

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
extAllGraph = MIES_PSX#PSX_GetAllEventGraph(win)
specialEventPanel = MIES_PSX#PSX_GetSpecialPanel(win)
Expand Down Expand Up @@ -1961,9 +1945,8 @@ static Function JumpToUndet()

// combo0 is the current one

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)

Expand Down Expand Up @@ -2023,9 +2006,8 @@ static Function JumpToSelectedEvents([STRUCT IUTF_mData &m])

// combo0 is the current one

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
psxStatsGraph = MIES_PSX#PSX_GetPSXStatsGraph(psxGraph)
Expand Down Expand Up @@ -2082,9 +2064,8 @@ static Function CursorMovement()

// combo0 is the current one

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)

Expand Down Expand Up @@ -2116,9 +2097,8 @@ static Function CursorMovementStats()

// combo0 is the current one

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
psxStatsGraph = MIES_PSX#PSX_GetPSXStatsGraph(psxGraph)
Expand Down Expand Up @@ -2177,11 +2157,10 @@ static Function KeyboardInteractions()

code = GetTestCode("nothing")

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

DoUpdate

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
psxStatsGraph = MIES_PSX#PSX_GetPSXStatsGraph(psxGraph)
Expand Down Expand Up @@ -2397,9 +2376,8 @@ static Function KeyboardInteractionsStats()

code = GetTestCode("nothing")

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
psxStatsGraph = MIES_PSX#PSX_GetPSXStatsGraph(psxGraph)
Expand Down Expand Up @@ -2628,9 +2606,8 @@ static Function KeyboardInteractionsStatsSpecial()

code = GetTestCode("nothing", eventState = "accept")

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
psxStatsGraph = MIES_PSX#PSX_GetPSXStatsGraph(psxGraph)
Expand Down Expand Up @@ -2703,9 +2680,8 @@ static Function KeyboardInteractionsStatsPostProcNonFinite()

code = GetTestCode("nonfinite", eventState = "all", prop = "tau")

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
psxStatsGraph = MIES_PSX#PSX_GetPSXStatsGraph(psxGraph)
Expand Down Expand Up @@ -2751,9 +2727,7 @@ static Function NoEventsAtAll()

code = "psx(psxKernel([50, 150], select(channels(AD6), [0, 2], all)), 100, 100, 0)"

ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
win = ExecuteSweepFormulaCode(browser, code)

try
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
Expand All @@ -2771,9 +2745,8 @@ static Function CheckResultsWavesForAverageFitResult()

code = GetTestCode("nothing")

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
specialEventPanel = MIES_PSX#PSX_GetSpecialPanel(win)
Expand Down Expand Up @@ -2808,9 +2781,8 @@ static Function TestBlockIndexLogic()

code = GetTestCode("nothing")

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
specialEventPanel = MIES_PSX#PSX_GetSpecialPanel(win)
Expand Down Expand Up @@ -3075,9 +3047,8 @@ static Function TestStoreAndLoad()

code = GetTestCode("nothing")

ExecuteSweepFormulaCode(browser, code)
win = ExecuteSweepFormulaCode(browser, code)

win = SFH_GetFormulaGraphForBrowser(browser)
mainWindow = GetMainWindow(win)
psxGraph = MIES_PSX#PSX_GetPSXGraph(win)
bsPanel = BSP_GetPanel(browser)
Expand Down
15 changes: 15 additions & 0 deletions Packages/tests/UTF_HelperFunctions.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1617,3 +1617,18 @@ Function LoadMIESFolderFromPXP(string fName)
// PLEASE CHECK THIS, IF THIS TEST FAILS IN FUTURE HISTORIC DATA TESTS
CA_FlushCache()
End

/// @brief Execute the given SweepFormula code in the browser and return the formula graph
Function/S ExecuteSweepFormulaCode(string browser, string code)

string bsPanel

SF_SetFormula(browser, code)

bsPanel = BSP_GetPanel(browser)

PGC_SetAndActivateControl(bsPanel, "check_BrowserSettings_SF", val = 1)
PGC_SetAndActivateControl(bsPanel, "button_sweepFormula_display", val = NaN)

return SFH_GetFormulaGraphForBrowser(browser)
End