diff --git a/uppsrc/ScatterCtrl/Properties.cpp b/uppsrc/ScatterCtrl/Properties.cpp index 7c22208cb..a116dd63b 100644 --- a/uppsrc/ScatterCtrl/Properties.cpp +++ b/uppsrc/ScatterCtrl/Properties.cpp @@ -483,7 +483,9 @@ ProcessingTab::ProcessingTab() tabFreq.butFFT.WhenAction = THISBACK(OnFFT); tabFreq.opXAxis = 0; tabFreq.opXAxis.WhenAction = THISBACK(OnFFT); - tabFreq.opPhase.WhenAction = THISBACK(OnFFT); + tabFreq.type.WhenAction = THISBACK(OnFFT); + tabFreq.type = 0; + tabFreq.setWindow.WhenAction = THISBACK(OnFFT); tabFit.opSeries = true; tabFit.opSeries.WhenAction = THISBACK(OnOp); @@ -496,6 +498,7 @@ ProcessingTab::ProcessingTab() tabFit.opMax.WhenAction = THISBACK(OnOp); tabFit.opMin.WhenAction = THISBACK(OnOp); tabFit.opMovAvg.WhenAction = THISBACK(OnOp); + tabFit.opSecAvg.WhenAction = THISBACK(OnOp); tabFit.width.WhenLostFocus = THISBACK(OnUpdateSensitivity); tabFit.width.WhenAction = THISBACK(OnUpdateSensitivity); @@ -575,6 +578,7 @@ void ProcessingTab::OnOp() tabFit.scatter.ScatterDraw::Show(7, tabFit.opMax); tabFit.scatter.ScatterDraw::Show(8, tabFit.opMin); tabFit.scatter.ScatterDraw::Show(9, tabFit.opMovAvg); + tabFit.scatter.ScatterDraw::Show(10, tabFit.opSecAvg); UpdateEquations(); OnShowEquation(); @@ -654,6 +658,7 @@ void ProcessingTab::UpdateField(const String _name, int _id) tabFit.scatter.AddSeries(lowerEnvelope).Legend(pscatter->GetLegend(id) + String("-") + t_("Min")) .NoMark().Dash(LINE_DASHED).SetSequentialX(true); tabFit.scatter.AddSeries(movAvg).SetDataThickness(1.5).Legend(pscatter->GetLegend(id) + String("-") + t_("MovAvg")).NoMark(); + tabFit.scatter.AddSeries(secAvg).SetDataThickness(1.5).Legend(pscatter->GetLegend(id) + String("-") + t_("SecAvg")).NoMark(); OnOp(); } else { @@ -667,6 +672,7 @@ void ProcessingTab::UpdateField(const String _name, int _id) tabFit.opMax.Enable(false); tabFit.opMin.Enable(false); tabFit.opMovAvg.Enable(false); + tabFit.opSecAvg.Enable(false); } Show(); @@ -701,7 +707,13 @@ void ProcessingTab::OnUpdateSensitivity() movAvg = data.MovingAverageY(tabFit.width); refresh = true; } - + if (tabFit.opSecAvg && newWidthMovAvg != tabFit.width) { + newWidthMovAvg = tabFit.width; + + secAvg = data.SectorAverageY(tabFit.width); + refresh = true; + } + if (refresh) tabFit.scatter.Refresh(); } @@ -839,7 +851,7 @@ void ProcessingTab::OnFFT() resampledSeries << orderedSeries[orderedSeries.GetCount() - 1].y; VectorY series(resampledSeries, 0, samplingTime); - fft = series.FFTY(samplingTime, tabFreq.opXAxis == 1, tabFreq.opPhase); + fft = series.FFTY(samplingTime, tabFreq.opXAxis == 1, tabFreq.type, tabFreq.setWindow); } if (fft.IsEmpty()) { tabFreq.comments.SetText(errText); @@ -847,7 +859,13 @@ void ProcessingTab::OnFFT() return; } - String legend = tabFit.scatter.GetLegend(0) + String("-") + (tabFreq.opPhase ? t_("FFT-phase [rad]") : t_("FFT")); + String strtype; + switch(tabFreq.type) { + case DataSource::T_FFT: strtype = t_("FFT"); break; + case DataSource::T_PHASE: strtype = t_("FFT-phase [rad]"); break; + case DataSource::T_PSD: strtype = t_("PSD"); break; + } + String legend = tabFit.scatter.GetLegend(0) + String("-") + strtype; tabFreq.scatter.AddSeries(fft).Legend(legend); tabFreq.scatter.SetMouseHandling(true, true).ShowInfo().ShowContextMenu().ShowProcessDlg().ShowPropertiesDlg(); tabFreq.scatter.SetLabelX(tabFreq.opXAxis == 1 ? t_("Frequency [Hz]") : t_("Period [sec]")); diff --git a/uppsrc/ScatterCtrl/Properties.h b/uppsrc/ScatterCtrl/Properties.h index c7087313f..b2c127998 100644 --- a/uppsrc/ScatterCtrl/Properties.h +++ b/uppsrc/ScatterCtrl/Properties.h @@ -136,7 +136,7 @@ private: SinEquation sinus; SplineEquation spline; Vector upperEnvelope, lowerEnvelope; - Vector movAvg; + Vector movAvg, secAvg; DataSetCond dataSetCond; bool exclamationOpened; double newWidthMax, newWidthMin, newWidthMovAvg; diff --git a/uppsrc/ScatterCtrl/ScatterCtrl.lay b/uppsrc/ScatterCtrl/ScatterCtrl.lay index f701db31d..61099c526 100644 --- a/uppsrc/ScatterCtrl/ScatterCtrl.lay +++ b/uppsrc/ScatterCtrl/ScatterCtrl.lay @@ -127,31 +127,32 @@ LAYOUT(ProcessingTabFit, 580, 368) ITEM(Option, opMin, SetLabel(t_("Min curve")).RightPosZ(72, 128).TopPosZ(188, 16)) ITEM(Option, opSpline, SetLabel(t_("Spline")).RightPosZ(72, 128).TopPosZ(124, 16)) ITEM(ScatterCtrl, scatter, SetPlotAreaLeftMargin(60).SetPlotAreaBottomMargin(50).HSizePosZ(0, 208).VSizePosZ(0, 0)) - ITEM(Label, dv___10, SetLabel(t_("Min:")).RightPosZ(160, 40).TopPosZ(292, 19)) + ITEM(Label, dv___10, SetLabel(t_("Min:")).RightPosZ(160, 40).TopPosZ(296, 19)) ITEM(Label, dv___11, SetLabel(t_("R2 coeff.")).RightPosZ(0, 48).TopPosZ(4, 19)) ITEM(Label, dv___12, SetLabel(t_("Num decimals:")).RightPosZ(120, 80).TopPosZ(144, 19)) ITEM(EditIntSpin, numDecimals, Max(20).Min(0).RightPosZ(84, 36).TopPosZ(144, 19)) ITEM(Option, showEquation, SetLabel(t_("Show Eq.")).RightPosZ(4, 72).TopPosZ(144, 16)) - ITEM(Label, dv___15, SetLabel(t_("Max:")).RightPosZ(160, 40).TopPosZ(268, 19)) - ITEM(Label, dv___16, SetLabel(t_("StdDev:")).RightPosZ(144, 56).TopPosZ(340, 19)) - ITEM(EditString, eMin, SetEditable(false).RightPosZ(4, 136).TopPosZ(292, 19)) - ITEM(EditDouble, eStdDev, SetEditable(false).RightPosZ(4, 136).TopPosZ(340, 19)) + ITEM(Label, dv___15, SetLabel(t_("Max:")).RightPosZ(160, 40).TopPosZ(272, 19)) + ITEM(Label, dv___16, SetLabel(t_("StdDev:")).RightPosZ(144, 56).TopPosZ(344, 19)) + ITEM(EditString, eMin, SetEditable(false).RightPosZ(4, 136).TopPosZ(296, 19)) + ITEM(EditDouble, eStdDev, SetEditable(false).RightPosZ(4, 136).TopPosZ(344, 19)) ITEM(EditString, eqSinus, SetEditable(false).RightPosZ(52, 72).TopPosZ(104, 19)) ITEM(EditDouble, r2Linear, SetEditable(false).RightPosZ(4, 44).TopPosZ(44, 19)) ITEM(EditDouble, r2Cuadratic, SetEditable(false).RightPosZ(4, 44).TopPosZ(64, 19)) ITEM(EditDouble, r2Sinus, SetEditable(false).RightPosZ(4, 44).TopPosZ(104, 19)) ITEM(EditString, eqCubic, SetEditable(false).RightPosZ(52, 72).TopPosZ(84, 19)) ITEM(EditDouble, r2Cubic, SetEditable(false).RightPosZ(4, 44).TopPosZ(84, 19)) - ITEM(EditString, eMax, SetEditable(false).RightPosZ(4, 136).TopPosZ(268, 19)) - ITEM(Label, dv___26, SetLabel(t_("Average:")).RightPosZ(144, 56).TopPosZ(316, 19)) - ITEM(EditDouble, eAverage, SetEditable(false).RightPosZ(4, 136).TopPosZ(316, 19)) + ITEM(EditString, eMax, SetEditable(false).RightPosZ(4, 136).TopPosZ(272, 19)) + ITEM(Label, dv___26, SetLabel(t_("Average:")).RightPosZ(144, 56).TopPosZ(320, 19)) + ITEM(EditDouble, eAverage, SetEditable(false).RightPosZ(4, 136).TopPosZ(320, 19)) ITEM(EditString, eqLinear, SetEditable(false).RightPosZ(52, 72).TopPosZ(44, 19)) ITEM(EditString, eqCuadratic, SetEditable(false).RightPosZ(52, 72).TopPosZ(64, 19)) ITEM(EditString, eqAverage, SetEditable(false).RightPosZ(52, 72).TopPosZ(24, 19)) ITEM(EditDoubleLostFocusSpin, width, RightPosZ(8, 60).TopPosZ(192, 19)) ITEM(Label, dv___32, SetLabel(t_("Sensitivity")).RightPosZ(8, 60).TopPosZ(176, 19)) + ITEM(Option, opSecAvg, SetLabel(t_("Sector Average")).RightPosZ(72, 128).TopPosZ(228, 16)) ITEM(Option, opMovAvg, SetLabel(t_("Moving Average")).RightPosZ(72, 128).TopPosZ(208, 16)) - ITEM(LabelBox, dv___34, SetLabel(t_("Statistical data")).RightPosZ(4, 200).TopPosZ(244, 24)) + ITEM(LabelBox, dv___35, SetLabel(t_("Statistical data")).RightPosZ(4, 200).TopPosZ(248, 24)) END_LAYOUT LAYOUT(ProcessingTabFrequency, 524, 276) @@ -163,7 +164,8 @@ LAYOUT(ProcessingTabFrequency, 524, 276) ITEM(Label, comments, HSizePosZ(0, 0).BottomPosZ(1, 19)) ITEM(Switch, opXAxis, SetLabel(t_("Time\nFrequency")).RightPosZ(12, 76).TopPosZ(92, 32)) ITEM(LabelBox, dv___7, SetLabel(t_("X Axis")).RightPosZ(4, 92).TopPosZ(76, 52)) - ITEM(Option, opPhase, SetLabel(t_("Show phase")).RightPosZ(4, 92).TopPosZ(132, 16)) + ITEM(Switch, type, SetLabel(t_("FFT\nPhase\nPSD")).RightPosZ(16, 72).TopPosZ(136, 52)) + ITEM(Option, setWindow, SetLabel(t_("Window")).RightPosZ(4, 84).TopPosZ(192, 16)) END_LAYOUT LAYOUT(ProcessingTabOp, 544, 328) diff --git a/uppsrc/ScatterCtrl/ScatterCtrl.t b/uppsrc/ScatterCtrl/ScatterCtrl.t index 794eefe92..0ab6b70ec 100644 --- a/uppsrc/ScatterCtrl/ScatterCtrl.t +++ b/uppsrc/ScatterCtrl/ScatterCtrl.t @@ -252,6 +252,12 @@ esES("MedMov") euES("") frFR("") +T_("SecAvg") +caES("") +esES("") +euES("") +frFR("") + T_("Impossible to calculate FFT from a not sampled series") caES("") esES("Imposible calcular FFT de una serie no muestreada") @@ -324,13 +330,19 @@ esES("Error obteniendo FFT") euES("") frFR("") +T_("FFT") +caES("") +esES("") +euES("") +frFR("") + T_("FFT-phase [rad]") caES("") esES("FFT-fase [rad]") euES("") frFR("") -T_("FFT") +T_("PSD") caES("") esES("") euES("") @@ -693,6 +705,12 @@ esES("Sensibilidad") euES("") frFR("") +T_("Sector Average") +caES("") +esES("") +euES("") +frFR("") + T_("Moving Average") caES("") esES("Media m\303\263vil") @@ -729,9 +747,15 @@ esES("Eje X") euES("") frFR("") -T_("Show phase") +T_("FFT\nPhase\nPSD") caES("") -esES("Mostrar fase") +esES("") +euES("") +frFR("") + +T_("Window") +caES("") +esES("") euES("") frFR("") @@ -752,3 +776,12 @@ caES("") esES("") euES("") frFR("") + + +// Obsolete + +T_("Show phase") +caES("") +esES("Mostrar fase") +euES("") +frFR("")