From 33c166be7a885856d11569876a151f58f2bdf9cf Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 24 Oct 2023 20:24:26 +0200 Subject: [PATCH] SF_FormulaPlotter: Change how vs is treated Since forever we have treated `vs` as x-formula for all y-formulas combined with `with` statments. This makes it impossible to use different x-formulas for different y-formulas in the same graph. We now, with a breaking change, treat `vs` as belonging to the single y-formula left to it. --- Packages/MIES/MIES_SweepFormula.ipf | 79 +++++++++--------- Packages/MIES/SweepFormulaHelp.ifn | Bin 318609 -> 311340 bytes .../doc/ScreenShots/sweepFormulaPlot2.png | Bin 4997 -> 0 bytes .../doc/ScreenShots/sweepFormulaPlot3.png | Bin 5096 -> 0 bytes Packages/doc/SweepFormula.rst | 51 +++-------- Packages/tests/Basic/UTF_SweepFormula.ipf | 10 +-- 6 files changed, 55 insertions(+), 85 deletions(-) delete mode 100644 Packages/doc/ScreenShots/sweepFormulaPlot2.png delete mode 100644 Packages/doc/ScreenShots/sweepFormulaPlot3.png diff --git a/Packages/MIES/MIES_SweepFormula.ipf b/Packages/MIES/MIES_SweepFormula.ipf index e5bdc60db3..03436c0f83 100644 --- a/Packages/MIES/MIES_SweepFormula.ipf +++ b/Packages/MIES/MIES_SweepFormula.ipf @@ -1567,7 +1567,7 @@ static Function SF_FormulaPlotter(string graph, string formula, [DFREF dfr, vari variable xMxN, yMxN, xPoints, yPoints, keepUserSelection, numAnnotations, formulasAreDifferent, postPlotPSX variable formulaCounter, gdIndex, markerCode, lineCode, lineStyle, traceToFront, isCategoryAxis string win, wList, winNameTemplate, exWList, wName, annotation, yAxisLabel, wvName, info, xAxis - string yFormula, yFormulasRemain + string formulasRemain, yAndXFormula, xFormula, yFormula STRUCT SF_PlotMetaData plotMetaData STRUCT RGBColor color @@ -1579,13 +1579,11 @@ static Function SF_FormulaPlotter(string graph, string formula, [DFREF dfr, vari endif WAVE/T graphCode = SF_SplitCodeToGraphs(formula) - WAVE/T/Z formulaPairs = SF_SplitGraphsToFormulas(graphCode) - SFH_ASSERT(WaveExists(formulaPairs), "Could not determine y [vs x] formula pair.") SVAR lastCode = $GetLastSweepFormulaCode(dfr) keepUserSelection = !cmpstr(lastCode, formula) - numGraphs = DimSize(formulaPairs, ROWS) + numGraphs = DimSize(graphCode, ROWS) wList = "" winNameTemplate = SF_GetFormulaWinNameTemplate(graph) @@ -1601,7 +1599,7 @@ static Function SF_FormulaPlotter(string graph, string formula, [DFREF dfr, vari WAVE/Z wvX = $"" WAVE/T/Z yUnits = $"" - yFormulasRemain = formulaPairs[j][%FORMULA_Y] + formulasRemain = graphCode[j] win = plotGraphs[j] wList = AddListItem(win, wList) @@ -1615,13 +1613,17 @@ static Function SF_FormulaPlotter(string graph, string formula, [DFREF dfr, vari gdIndex = 0 annotation = "" - SplitString/E=SF_SWEEPFORMULA_WITH_REGEXP yFormulasRemain, yFormula, yFormulasRemain + SplitString/E=SF_SWEEPFORMULA_WITH_REGEXP formulasRemain, yAndXFormula, formulasRemain if(!V_flag) break endif + + [xFormula, yFormula] = SF_SplitGraphsToFormula(yAndXFormula) + SFH_ASSERT(!IsEmpty(yFormula), "Could not determine y [vs x] formula pair.") + WAVE/WAVE/Z formulaResults = $"" try - [formulaResults, plotMetaData] = SF_GatherFormulaResults(formulaPairs[j][%FORMULA_X], yFormula, graph) + [formulaResults, plotMetaData] = SF_GatherFormulaResults(xFormula, yFormula, graph) catch SF_CleanUpPlotWindowsOnFail(plotGraphs) Abort @@ -2364,7 +2366,7 @@ End static Function SF_CheckInputCode(string code, string graph) variable i, numGraphs, jsonIDy, jsonIDx, subFormulaCnt - string jsonPath, xFormula, yFormula, yFormulasRemain, subPath + string jsonPath, xFormula, yFormula, formulasRemain, subPath, yAndXFormula NVAR jsonID = $GetSweepFormulaJSONid(SF_GetBrowserDF(graph)) JSON_Release(jsonID, ignoreErr = 1) @@ -2374,36 +2376,41 @@ static Function SF_CheckInputCode(string code, string graph) code = SF_CheckVariableAssignments(code, jsonID) WAVE/T graphCode = SF_SplitCodeToGraphs(SF_PreprocessInput(code)) - WAVE/T/Z formulaPairs = SF_SplitGraphsToFormulas(graphCode) - SFH_ASSERT(WaveExists(formulaPairs), "Could not determine y [vs x] formula pair.") - numGraphs = DimSize(formulaPairs, ROWS) + numGraphs = DimSize(graphCode, ROWS) for(i = 0; i < numGraphs; i += 1) subFormulaCnt = 0 - yFormulasRemain = formulaPairs[i][%FORMULA_Y] + formulasRemain = graphCode[i] sprintf jsonPath, "/graph_%d", i JSON_AddObjects(jsonID, jsonPath) do - SplitString/E=SF_SWEEPFORMULA_WITH_REGEXP yFormulasRemain, yFormula, yFormulasRemain + SplitString/E=SF_SWEEPFORMULA_WITH_REGEXP formulasRemain, yAndXFormula, formulasRemain if(!V_flag) break endif - sprintf subPath, "/formula_y_%d", subFormulaCnt - jsonIdy = SF_ParseFormulaToJSON(yFormula) - JSON_AddJSON(jsonID, jsonPath + subPath, jsonIDy) + [xFormula, yFormula] = SF_SplitGraphsToFormula(yAndXFormula) + SFH_ASSERT(!IsEmpty(yFormula), "Could not determine y [vs x] formula pair.") + + sprintf subPath, "%s/pair_%d", jsonPath, subFormulaCnt + JSON_AddTreeObject(jsonID, subPath) + + sprintf subPath, "%s/pair_%d/formula_y", jsonPath, subFormulaCnt + jsonIDy = SF_ParseFormulaToJSON(yFormula) + JSON_AddJSON(jsonID, subPath, jsonIDy) JSON_Release(jsonIDy) + if(!IsEmpty(xFormula)) + jsonIDx = SF_ParseFormulaToJSON(xFormula) + + sprintf subPath, "%s/pair_%d/formula_x", jsonPath, subFormulaCnt + JSON_AddJSON(jsonID, subPath, jsonIDx) + JSON_Release(jsonIDx) + endif + subFormulaCnt += 1 while(1) - - xFormula = formulaPairs[i][%FORMULA_X] - if(!IsEmpty(xFormula)) - jsonIdx = SF_ParseFormulaToJSON(xFormula) - JSON_AddJSON(jsonID, jsonPath + "/formula_x", jsonIDx) - JSON_Release(jsonIDx) - endif endfor End @@ -4833,26 +4840,20 @@ static Function/WAVE SF_SplitCodeToGraphs(string code) return graphCode End -static Function/WAVE SF_SplitGraphsToFormulas(WAVE/T graphCode) +static Function [string xFormula, string yFormula] SF_SplitGraphsToFormula(string graphCode) - variable i, numGraphs, numFormulae - string yFormula, xFormula + variable numFormulae - WAVE/T wFormulas = GetYandXFormulas() + SplitString/E=SF_SWEEPFORMULA_REGEXP graphCode, yFormula, xFormula + numFormulae = V_Flag - numGraphs = DimSize(graphCode, ROWS) - Redimension/N=(numGraphs, -1) wFormulas - for(i = 0; i < numGraphs; i += 1) - SplitString/E=SF_SWEEPFORMULA_REGEXP graphCode[i], yFormula, xFormula - numFormulae = V_Flag - if(numFormulae != 1 && numFormulae != 2) - return $"" - endif - wFormulas[i][%FORMULA_X] = SelectString(numFormulae == 2, "", xFormula) - wFormulas[i][%FORMULA_Y] = yFormula - endfor + if(numFormulae != 1 && numFormulae != 2) + return ["", ""] + endif + + xFormula = SelectString(numFormulae == 2, "", xFormula) - return wFormulas + return [xFormula, yFormula] End static Function/S SF_GetFormulaWinNameTemplate(string mainWindow) diff --git a/Packages/MIES/SweepFormulaHelp.ifn b/Packages/MIES/SweepFormulaHelp.ifn index 95de32c1c27d09dbd31b5d9d86f429361bcd2526..f46318676aecd7bd553b3153ec51ca3520f14da5 100644 GIT binary patch delta 2448 zcma)+d2AF_9LL|Aot^C>1BG&wmcrxeL6@?n5TJmRqX?xZSG6j1+D@Ue-7U;?TS{pQ zEr%3@ay?Xpf-w?8kPxJRM7bh{7z9I9kSLLc-~raeE76GGnYYv?{NpB{{e6Gudvm;L zITLZTA!2(!dZwlS>V#$|v48s|Lc*ZlgLT6`6>s^Vj1J^m4H~^Ojg~ICpHE49KSHkh zDXBqy0s6Kqq-17*5~VL8w^AHr*lC$WB0lM?OuVRB4r~4XhuxVh#i&-@dhD;`BbiL* z+BTZlSRl0(Nc8%wottmC+f2Gto5CDDyA%=_A>y z&Xi9tH8FsdnMrJswz5ns^67?$8M>~LYEj4=dK{{j5l5m4;qo^{v#Q z{#(kh*TSM^S%pt$hN+o)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(8 zHdWgycf-ku_RJ_X9tlh*8oJTKvToW~{j_sOlG+7ETQis()wnEmw5y`Ch4e`Ku8pE1 znHpa|azAPI!IZgjR98gj?l$G7ig7Vf&9~PgE#gFdmgS3Rwyz6%oXJ)fX*#=8B3;k? z;K6(2`;{U!I8kgT_z%Y>(6sU_gTT~ccVRSOkT?9hJ3?h{#(!Rp{FLi=Ny z?@_7U5p7^^JE{>7-`-{Sq_~AdQ8vwWqYmqqIMb&EnruyijB?MmC2x2?*zp^+a^`to zPS`phJpXPI*VHBvHxOP*?#uTrRaKm q^8*gqOw$J(H7G8h#bLHU9MK|MIME$R5}CnS9LDp&WH6sY_J05!b!mM7 diff --git a/Packages/doc/ScreenShots/sweepFormulaPlot2.png b/Packages/doc/ScreenShots/sweepFormulaPlot2.png deleted file mode 100644 index f591d212c5701e8405fcf9b5f72cd32735e49ab8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4997 zcmeHLc{r5&9)F1nNs?Wba?&DUh>DpMI(4S8N7f=smKg`x2BYMXz2lG))1`!A<{d(M5H``>-~>;1j&^V^>H_xXO7-#tsj1#wXY zQ2+qMFMe-o4FH0J03a~EQ*i6cVOs|HkPI<%2(dwVg@j!X@&qn=qk>c|gHVS|urmN4 zb>gC_iEa4f1!@n%DQvyY{FUa`=gyy1K))HruPA z>it;DCBfq1TRO?Q$?6C7TkZr39~KLgaj~tc)pJ?jl=*AsPq&ZUhzbt~SB{{akM35K zoR=62MmYZLDGvaH^tgEeAlB(pJOG@s-3erz|C0vESuGBUGsIC<7?MD2(gNMQ@W=Hb z3XX1Q7SC6C7}LmE?|$<(%iL}U0FVNrjU$`oc3WWI&sDtGmz!&+RN4U1<+3(=S?s++ zKoPmS`=QXi#E;r6R>2_dlaF0_{H})bNt}i!3ZIm>4aoA*`^20Jt})2{G0KQl7;VTh zHa9ip^RIYpOgt7klJu!y&^8>o6X3X|nA^=)KN6jRQLxRJpwTxu$<{PtzX*^~b_M57 z$a0o_hpB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vZUBH(? zF(WmTPl`^ml~&|N6NSB)ohvy}(%sq9dC#t6^7TY6-3(4#UarFu!tjkQH=8>^o2B@e zJu}#sb0dtaowaYY8UzGydf!CJMbpKzzO_rBi#%1mGn#dbGGtkJhyu4|zug!!1LOL- z`_!P=qU52f^xF+1$)8G#QGVjn@vN(XKFQFENo?f&G&xfFf>!|OYHA{!-~M1oacki2 zR#sUa)^PbZMFxH_+VWHH9`wCw| zT~9tASZ$<5(@ef75bA95UY+)K8#3M7>2nnwxMB&#X_{zY_7~86ky|_V(7zt$q5KZ@ zjb{n~vpYYN66K*l!p|zjMsiuUK4)&Po49!bfUS8j$ z4_}EF_-37qb!aj^?C1iz&2iI=^{8Lg1ahBEYJmJY;y7;kn=^fitg^(yIvgBt z8bY<}hn?0C2i*OfR6%>pk+L!nGl;U+`PF7;=cd{W*M)?7jH!4kX7TW~wQXjhi@|7o zvu+-&%k~52)&5Fq+` zx=?->y3YVjWM_Xh=9t|$8VppTTx3gpws31gdVl4kF}2{A5J-;HZrsWzV{GozgDI%X zhIKFKr03ujgj^Lk%hky3GqbbL#0=8X21E{77)};cVzs;vTz2h{PswRhWoE4jnqDF) zBj3U3U5KAroE@U*=S$=_^9NC1@Ek3Xn3oxc#ZNsnu>Q5foz0oI!5y)pcqGEPbYjU? z7gMV5D|@e$#x1%mI1AGrtrj_O{8dy3xU))cMRQwb-aqO39OFpx(5N>6+u6nq_>Ak(lX&IY z+4{{Q5@3IR83iP(*-p6~1Hw=LPi|Z~_aSLI-~YJ!oxpYQ>JG3nv%6endhNTv1D8o* A9RL6T diff --git a/Packages/doc/SweepFormula.rst b/Packages/doc/SweepFormula.rst index 85464a5684..0815e16ee2 100644 --- a/Packages/doc/SweepFormula.rst +++ b/Packages/doc/SweepFormula.rst @@ -1474,37 +1474,6 @@ Note that in this example there are 10 Y-values and only 9 X-values returned by respective formula part. The resulting graph shows 9 data points and thus does not show data points where either an X or Y value for the X, Y value pair is missing. -The plotter supports the same X-values for multiple traces: - -.. code-block:: bash - - [1, 3], [2, 4], [3, 5], [4, 6], [5, 7] vs 1...6 - -.. figure:: ScreenShots/sweepFormulaPlot2.png - :align: center - -This example plots two traces with five data points each against equidistant -X coordinates 1, 2, 3, 4, 5. The first trace is colored blue for demonstration. -This also works for a constant X value and multiple traces. -The same way separate X value series for traces can be set: - -.. code-block:: bash - - [1, 3], [2, 4], [3, 5], [4, 6], [5, 7] vs [1, 0], [2, 0.5], [3, 1], [4, 1.5], [5, 2] - -.. figure:: ScreenShots/sweepFormulaPlot3.png - :align: center - -The above example plots two traces with the first one Y series: 1, 2, 3, 4, 5; X series: 1, 2, 3, 4, 5 -and the second Y series: 3, 4, 5, 6, 7; X series: 0, 0.5, 1, 1.5, 2. -The first trace is colored blue for demonstration. - -There is one special case where given X-values are not applied for every trace. If the following conditions -apply then the n-th value of the given X-values is used for the n-th trace: - -- there is the same amount of Y-data-waves as points in the X-wave -- the Y-wave for a trace contains only one data point - .. code-block:: bash min(data(TP,select(channels(AD0), 4...11,all))) @@ -1537,24 +1506,24 @@ The above code creates a panel with three separate graphs arranged vertically ev Multiple Y-Formulas """"""""""""""""""" -Several y-formulas can be plotted with the keyword `with`. The `with` must be on an own line between the y-formulas. -If the y-data contains different data units the y-axis will show all data units separated by `/`. +Several y-formulas can be plotted with the keyword `with`. The `with` must be +on an own line between the y-formulas. If the y-data contains different data +units the y-axis will show all data units separated by `/`. The `vs` allows to +set a custom x-formula for the *single* y-formula left to it. Variables, see +next section, can be used to reuse x-formulas for multiple statements without +code duplication. .. code-block:: bash + xdata = range(10, 100, 10) + 0...10 with - 20...30 - vs range(10, 100, 10) + 20...30 vs $xdata and - 10...20 - with 30...40 with - 40...50 - vs range(10, 100, 10) - and - 20...30 + 40...50 vs $xdata Variables ^^^^^^^^^ diff --git a/Packages/tests/Basic/UTF_SweepFormula.ipf b/Packages/tests/Basic/UTF_SweepFormula.ipf index 5fa7cde213..ac9aa17141 100644 --- a/Packages/tests/Basic/UTF_SweepFormula.ipf +++ b/Packages/tests/Basic/UTF_SweepFormula.ipf @@ -1798,7 +1798,7 @@ static Function TestPlotting() String strArray0D = "1" String strCombined = "[1, 2] vs [3, 4]\rand\r[5, 6] vs [7, 8]\rand\r[9, 10]\rand\r" String strCombinedPartial = "[1, 2] vs [1, 2]\rand\r[1?=*, 2] vs [1, 2]" - string strWith = "[1, 2]\rwith\r[2, 3] vs [3, 4]\rand\r[5, 6]\rwith\r[2, 3]\rwith\r[4, 5] vs [7, 8]\rand\r[9, 10]\rwith\r\rand\r" + string strWith = "[1, 2] vs [3, 4] \rwith\r[2, 3] vs [3, 4]\rand\r[5, 6] vs [7, 8] \rwith\r[2, 3] vs [7, 8] \rwith\r[4, 5] vs [7, 8]\rand\r[9, 10]" // Reference data waves must be moved out of the working DF for the further tests as // calling the FormulaPlotter later kills the working DF @@ -3554,28 +3554,28 @@ static Function TestInputCodeCheck() NVAR jsonID = $GetSweepFormulaJSONid(dfr) formula = "1" - jsonRef = "{\n\"graph_0\": {\n\"formula_y_0\": 1\n}\n}" + jsonRef = "{\n\"graph_0\": {\n\"pair_0\": {\n\"formula_y\": 1\n}\n}\n}" MIES_SF#SF_CheckInputCode(formula, win) jsonTxt = JSON_Dump(jsonId) JSON_Release(jsonId) CHECK_EQUAL_STR(jsonRef, jsonTxt) formula = "1 vs 1" - jsonRef = "{\n\"graph_0\": {\n\"formula_x\": 1,\n\"formula_y_0\": 1\n}\n}" + jsonRef = "{\n\"graph_0\": {\n\"pair_0\": {\n\"formula_x\": 1,\n\"formula_y\": 1\n}\n}\n}" MIES_SF#SF_CheckInputCode(formula, win) jsonTxt = JSON_Dump(jsonId) JSON_Release(jsonId) CHECK_EQUAL_STR(jsonRef, jsonTxt) formula = "1\rwith\r1 vs 1" - jsonRef = "{\n\"graph_0\": {\n\"formula_x\": 1,\n\"formula_y_0\": 1,\n\"formula_y_1\": 1\n}\n}" + jsonRef = "{\n\"graph_0\": {\n\"pair_0\": {\n\"formula_y\": 1\n},\n\"pair_1\": {\n\"formula_x\": 1,\n\"formula_y\": 1\n}\n}\n}" MIES_SF#SF_CheckInputCode(formula, win) jsonTxt = JSON_Dump(jsonId) JSON_Release(jsonId) CHECK_EQUAL_STR(jsonRef, jsonTxt) formula = "v = 1\r1" - jsonRef = "{\n\"graph_0\": {\n\"formula_y_0\": 1\n},\n\"variable:v\": 1\n}" + jsonRef = "{\n\"graph_0\": {\n\"pair_0\": {\n\"formula_y\": 1\n}\n},\n\"variable:v\": 1\n}" MIES_SF#SF_CheckInputCode(formula, win) jsonTxt = JSON_Dump(jsonId) JSON_Release(jsonId)