Пример #1
0
        /// <summary>
        /// Average the columns to average for each repetition period.
        /// </summary>
        /// <param name="srcTable">Source table of the ExpandCyclingVariableColumn action</param>
        /// <param name="columnsToAverageOverRepeatPeriod">The columns for which the data should be averaged over one repeat period.</param>
        /// <param name="options">Options containing the column numbers of the columns to average.</param>
        /// <param name="repeatRanges">Designates the start and the end of each repetition period.</param>
        /// <returns>Array of data columns which contain the averaged columns. Inside a column the row index designates the index of the range.</returns>
        private static DataColumn[] AverageColumns(DataTable srcTable, IEnumerable <DataColumn> columnsToAverageOverRepeatPeriod, ExpandCyclingVariableColumnOptions options, IList <ContiguousIntegerRange> repeatRanges)
        {
            // make the averaged property columns
            var propColsTemp = new DataColumn[columnsToAverageOverRepeatPeriod.Count()];
            int nDestCol     = -1;

            foreach (var srcCol in columnsToAverageOverRepeatPeriod)
            {
                nDestCol++;
                var destCol = (DataColumn)srcCol.Clone();
                destCol.Clear();

                var statistic = new Altaxo.Calc.Regression.QuickStatistics();
                int nDestRow  = -1;
                foreach (var range in repeatRanges)
                {
                    ++nDestRow;
                    foreach (var idx in range)
                    {
                        statistic.Add(srcCol[idx] - srcCol[range.Start]);
                    }
                    destCol[nDestRow] = statistic.Mean + srcCol[range.Start]; // Trick: we store the averaged values temporarily in index 0 of the property column
                }
                propColsTemp[nDestCol] = destCol;
            }
            return(propColsTemp);
        }
Пример #2
0
		/// <summary>
		/// Average the columns to average for each repetition period.
		/// </summary>
		/// <param name="srcTable">Source table of the ExpandCyclingVariableColumn action</param>
		/// <param name="columnsToAverageOverRepeatPeriod">The columns for which the data should be averaged over one repeat period.</param>
		/// <param name="options">Options containing the column numbers of the columns to average.</param>
		/// <param name="repeatRanges">Designates the start and the end of each repetition period.</param>
		/// <returns>Array of data columns which contain the averaged columns. Inside a column the row index designates the index of the range.</returns>
		private static DataColumn[] AverageColumns(DataTable srcTable, IEnumerable<DataColumn> columnsToAverageOverRepeatPeriod, ExpandCyclingVariableColumnOptions options, IList<ContiguousIntegerRange> repeatRanges)
		{
			// make the averaged property columns
			var propColsTemp = new DataColumn[columnsToAverageOverRepeatPeriod.Count()];
			int nDestCol = -1;
			foreach (var srcCol in columnsToAverageOverRepeatPeriod)
			{
				nDestCol++;
				var destCol = (DataColumn)srcCol.Clone();
				destCol.Clear();

				var statistic = new Altaxo.Calc.Regression.QuickStatistics();
				int nDestRow = -1;
				foreach (var range in repeatRanges)
				{
					++nDestRow;
					foreach (var idx in range)
						statistic.Add(srcCol[idx] - srcCol[range.Start]);
					destCol[nDestRow] = statistic.Mean + srcCol[range.Start]; // Trick: we store the averaged values temporarily in index 0 of the property column
				}
				propColsTemp[nDestCol] = destCol;
			}
			return propColsTemp;
		}