private void CalculateStandardDeviations() { int meanTypes = new MeanTypesStrings().Count(); double stdDeviation; IList <double> averagesValues; IList <double> idealValues; for (int i = 0; i < Data.Count; i++) { for (int j = 0; j < Noises.Count; j++) { Data[i][j].GenerateIdealCurve(Settings.Pcd.Scaffold, Settings.Pcd.Parameters, Settings.Ui.StartX, Settings.Ui.EndX, Settings.Ui.PointsNo); Data[i][j].PropagateIdealCurve(Settings.Ui.CurvesNo); Data[i][j].MakeNoiseOfGaussian(Settings.Ui.CurvesNo, Noises[j]); MakeMalformation((Phenomenon)i, Data[i][j], Settings.Ui.CurvesNo / 2); for (int k = 0; k < meanTypes; k++) { Data[i][j].TryMakeAverageCurve((MeanType)k, Settings.Ui.CurvesNo); SeriesAssist.CopyPoints(Data[i][j].AverageCurve, Averages[i][j][k]); averagesValues = SeriesAssist.GetValues(Averages[i][j][k]); idealValues = SeriesAssist.GetValues(Data[i][j].IdealCurve); stdDeviation = Mathematics.GetRelativeStandardDeviation(averagesValues, idealValues); StdDeviations[i][j][k] = stdDeviation; } } } }
private void OnApplyClick(object sender, EventArgs e) { if (DataChart.IdealCurve.Points.Count == 0) { log.Info(MethodBase.GetCurrentMethod().Name + '(' + nameof(DataChart.IdealCurve) + ')'); AppMessages.MainWindow.ExclamationOfSeriesSelection(); return; } MeanType meanType = (MeanType)UiControls.TryGetSelectedIndex(uiPnlAvg_MeanT_ComBx); int curvesNo = UiControls.TryGetValue <int>(uiPnlAvg_Crvs2No_Num); bool? result = DataChart.TryMakeAverageCurve(meanType, curvesNo); log.Info(MethodBase.GetCurrentMethod().Name + '(' + meanType + ',' + curvesNo + ',' + result.HasValue + ')'); if (!result.Value) { DataChart.RemoveInvalidPoints(DataSetCurveType.Average); AppMessages.MainWindow.ExclamationOfPointsNotValidToChart(); } UiControls.TrySetSelectedIndex(uiPnlMod_CrvT_ComBx, (int)DataSetCurveType.Average); UpdateUiByShowingCurveOnChart(DataSetCurveType.Average); double standardDeviation = Mathematics.GetRelativeStandardDeviation(SeriesAssist.GetValues(DataChart.AverageCurve), SeriesAssist.GetValues(DataChart.IdealCurve)); uiPnlAvg_StdDev2_TxtBx.Text = Strings.TryFormatAsNumeric(8, standardDeviation); }
public GridPreviewer(Series series) { InitializeComponent(); Curve = series; Originals = SeriesAssist.GetValues(series); LocalizeWindow(); UpdateUiBySettings(); }
private void UpdateUiByPopulatingGrid() { GridAssist.AlterColumnHeader(Index, new GridPreviewerStrings().Ui.DatasetIndex.GetString()); GridAssist.AlterColumnHeader(x, "x"); GridAssist.AlterColumnHeader(y, "y", false); GridAssist.AddRows(uiGrid_db_grid, Curve.Points.Count); GridAssist.PopulateColumn(uiGrid_db_grid, Index.Name, Lists.GetOrdinalValues(0, Convert.ToUInt64(Curve.Points.Count))); GridAssist.PopulateColumn(uiGrid_db_grid, x.Name, SeriesAssist.GetArguments(Curve), 4); GridAssist.PopulateColumn(uiGrid_db_grid, y.Name, SeriesAssist.GetValues(Curve), VALUES_DECIMAL_PLACES); }
private void OnResetClick(object sender, EventArgs e) { Series copy = SeriesAssist.GetCopy(Curve); Curve.Points.Clear(); SeriesAssist.CopyPoints(Curve, copy, Originals); GridAssist.PopulateColumn(uiGrid_db_grid, y.Name, SeriesAssist.GetValues(Curve), VALUES_DECIMAL_PLACES); UpdateUiByRefreshingChart(); UpdateUiByPanelStateInfo(PanelStateInformation.ValuesRestored); log.Info(MethodBase.GetCurrentMethod().Name + "()"); }
private void OnPerformClick(object sender, EventArgs e) { Operation @operator = (Operation)UiControls.TryGetSelectedIndex(uiPnl_OperT_ComBx); double? userValue = (@operator == Operation.Positive || @operator == Operation.Negative) ? default(double) : Strings.TryGetValue(uiPnl_Val2_TxtBx.Text); if (userValue == null || Curve == null) { log.Info(MethodBase.GetCurrentMethod().Name + '(' + userValue + ',' + Curve + ')'); UpdateUiByPanelStateInfo(PanelStateInformation.InvalidUserValue); AppMessages.GridPreviewer.ExclamationOfImproperUserValue(); return; } int startIndex = UiControls.TryGetValue <int>(uiPnl_StartIdx_Num); int endIndex = UiControls.TryGetValue <int>(uiPnl_EndIdx_Num); Series seriesCopy = SeriesAssist.GetCopy(Curve); Operation operation = (Operation)uiPnl_OperT_ComBx.SelectedIndex; string signature = string.Empty; try { signature = MethodBase.GetCurrentMethod().Name + '(' + startIndex + ',' + endIndex + ',' + operation + ',' + userValue.Value + ')'; SeriesAssist.Alter(operation, userValue.Value, seriesCopy, startIndex, endIndex); } catch (NotFiniteNumberException ex) { log.Error(signature, ex); UpdateUiByPanelStateInfo(PanelStateInformation.OperationRevoked); AppMessages.GridPreviewer.ErrorOfInvalidCurvePoints(); return; } catch (Exception ex) { log.Fatal(signature, ex); UpdateUiByPanelStateInfo(PanelStateInformation.OperationRejected); AppMessages.GridPreviewer.ErrorOfPerformOperation(); return; } Curve.Points.Clear(); SeriesAssist.CopyPoints(seriesCopy, Curve); GridAssist.PopulateColumn(uiGrid_db_grid, y.Name, SeriesAssist.GetValues(Curve), VALUES_DECIMAL_PLACES); UpdateUiByRefreshingChart(); UpdateUiByPanelStateInfo(PanelStateInformation.PerformedAndRefreshed); log.Info(signature); }