コード例 #1
0
 private string GetName(Altaxo.Data.IReadableColumn col, int level)
 {
     if (col is Altaxo.Data.DataColumn)
     {
         Altaxo.Data.DataTable table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)col);
         string tablename            = table == null ? string.Empty : table.Name + "\\";
         string collectionname       = table == null ? string.Empty : (table.PropertyColumns.ContainsColumn((DataColumn)col) ? "PropCols\\" : "DataCols\\");
         if (level <= 0)
         {
             return(((DataColumn)col).Name);
         }
         else if (level == 1)
         {
             return(tablename + ((DataColumn)col).Name);
         }
         else
         {
             return(tablename + collectionname + ((DataColumn)col).Name);
         }
     }
     else if (col != null)
     {
         return(col.FullName);
     }
     else
     {
         return(string.Empty);
     }
 }
コード例 #2
0
        /// <summary>
        /// Pastes data from a table (usually deserialized table from the clipboard) into a worksheet, which has
        /// currently selected rows. The number of selected rows has to match the number of rows of the source table.
        /// </summary>
        /// <param name="dg">The worksheet to paste into.</param>
        /// <param name="sourcetable">The table which contains the data to paste into the worksheet.</param>
        /// <remarks>The operation is defined as follows: if the is no column selection, the data are inserted beginning at the first column of the destination table.
        /// If there is a column selection, the data are inserted in the selected columns, and then in the columns after the last selected columns.
        /// No exception is thrown if a column type does not match the corresponding source column type.
        /// The columns to paste into do not change their name, kind or group number. Property columns in the source table
        /// are pasted into the destination table.</remarks>
        protected static void PasteFromTableRowsToSelectedRows(GUI.WorksheetController dg, Altaxo.Data.DataTable sourcetable)
        {
            Altaxo.Data.DataTable desttable = dg.DataTable;

            Altaxo.Data.DataColumn[] propertycolumnmap = MapOrCreatePropertyColumns(desttable, sourcetable);
            Altaxo.Data.DataColumn[] destdatacolumnmap = MapOrCreateDataColumns(desttable, dg.SelectedDataColumns, sourcetable);

            for (int nCol = 0; nCol < sourcetable.DataColumns.ColumnCount; nCol++)
            {
                // now fill the data into that column

                try
                {
                    int nDestRow = -1;
                    for (int nSrcRow = 0; nSrcRow < sourcetable.DataColumns.RowCount; nSrcRow++)
                    {
                        nDestRow = nSrcRow < dg.SelectedDataRows.Count ? dg.SelectedDataRows[nSrcRow] : nDestRow + 1;
                        destdatacolumnmap[nCol][nDestRow] = sourcetable.DataColumns[nCol][nSrcRow];
                    }
                }
                catch (Exception)
                {
                }


                // also fill in the property values
                int nDestColumnIndex = desttable.DataColumns.GetColumnNumber(destdatacolumnmap[nCol]);
                FillRow(propertycolumnmap, nDestColumnIndex, sourcetable.PropCols, nCol);
            } // for all data columns
        }
コード例 #3
0
        /// <summary>
        /// Maps each data column of the source table to a corresponding data columns of the destination table.
        /// The matching is based on the index (order) and on the currently selected columns of the destination table.
        /// Attention: The match here does <b>not</b> mean that the two columns are data compatible to each other!
        /// </summary>
        /// <param name="desttable">The destination table.</param>
        /// <param name="selectedDestColumns">The currently selected columns of the destination table.</param>
        /// <param name="sourcetable">The source table.</param>
        /// <returns>An array of columns. Each column of the array is a data column in the destination table, which
        /// matches (by index) the data column in the source table.</returns>
        /// <remarks>
        /// 1.) Since the returned columns are part of the DataColumns collection of the destination table, you must not
        /// use these for inserting i.e. in other tables.
        /// 2.) The match is based on the index and the selected columns of the destination table. The rules are as follows: if there is
        /// no selection, the first column of the destination table matches the first column of the source table, and so forth.
        /// If there is a column selection, the first selected column of the destination table matches the first column of the source table,
        /// the second selected column of the destination table matches the second column of the source table. If more source columns than selected columns in the destination
        /// table exists, the match is done 1:1 after the last selected column of the destination table. If there is no further column in the destination
        /// table to match, new columns are created in the destination table.
        /// </remarks>
        static protected Altaxo.Data.DataColumn[] MapOrCreateDataColumns(Altaxo.Data.DataTable desttable, IAscendingIntegerCollection selectedDestColumns, Altaxo.Data.DataTable sourcetable)
        {
            Altaxo.Data.DataColumn[] columnmap = new Altaxo.Data.DataColumn[sourcetable.DataColumns.ColumnCount];
            int nDestCol = -1;

            for (int nCol = 0; nCol < sourcetable.DataColumns.ColumnCount; nCol++)
            {
                nDestCol = nCol < selectedDestColumns.Count ? selectedDestColumns[nCol] : nDestCol + 1;

                string name  = sourcetable.DataColumns.GetColumnName(nCol);
                int    group = sourcetable.DataColumns.GetColumnGroup(nCol);
                Altaxo.Data.ColumnKind kind = sourcetable.DataColumns.GetColumnKind(nCol);

                if (nDestCol < desttable.DataColumns.ColumnCount)
                {
                    columnmap[nCol] = desttable.DataColumns[nDestCol];
                }
                else
                {
                    columnmap[nCol] = (DataColumn)Activator.CreateInstance(sourcetable.DataColumns[nCol].GetType());
                    desttable.DataColumns.Add(columnmap[nCol], name, kind, group);
                }
            }
            return(columnmap);
        }
コード例 #4
0
        public static void CopyToClipboard(GUI.WorksheetController dg)
        {
            Altaxo.Data.DataTable           dt  = dg.DataTable;
            System.Windows.Forms.DataObject dao = new System.Windows.Forms.DataObject();

            if (dg.AreDataCellsSelected)
            {
                WriteAsciiToClipBoardIfDataCellsSelected(dg, dao);
            }
            else if (dg.ArePropertyCellsSelected && !(dg.AreDataCellsSelected))
            {
                WriteAsciiToClipBoardIfOnlyPropertyCellsSelected(dg, dao);
            }

            if (dg.AreColumnsOrRowsSelected)
            {
                // copy the data as table with the selected columns
                Altaxo.Data.DataTable.ClipboardMemento tablememento = new Altaxo.Data.DataTable.ClipboardMemento(
                    dg.DataTable, dg.SelectedDataColumns, dg.SelectedDataRows, dg.SelectedPropertyColumns, dg.SelectedPropertyRows);
                dao.SetData("Altaxo.Data.DataTable.ClipboardMemento", tablememento);

                // now copy the data object to the clipboard
                System.Windows.Forms.Clipboard.SetDataObject(dao, true);
            }
        }
コード例 #5
0
        /// <summary>
        /// Plots all preprocessed spectra into a newly created graph.
        /// </summary>
        /// <param name="table">The table of PLS output data.</param>
        public static void PlotPredictionScores(Altaxo.Data.DataTable table)
        {
            MultivariateContentMemento plsMemo = table.GetTableProperty("Content") as MultivariateContentMemento;

            if (plsMemo == null)
            {
                return;
            }
            if (plsMemo.PreferredNumberOfFactors <= 0)
            {
                QuestPreferredNumberOfFactors(plsMemo);
            }

            GetAnalysis(table).CalculateAndStorePredictionScores(table, plsMemo.PreferredNumberOfFactors);

            AscendingIntegerCollection sel = new AscendingIntegerCollection();

            for (int i = 0; i < plsMemo.NumberOfConcentrationData; i++)
            {
                string name = WorksheetAnalysis.GetPredictionScore_ColumnName(i, plsMemo.PreferredNumberOfFactors);
                if (null != table[name])
                {
                    sel.Add(table.DataColumns.GetColumnNumber(table[name]));
                }
            }

            Worksheet.Commands.PlotCommands.PlotLine(table, sel, true, false);
        }
コード例 #6
0
        public string GetYName(int level)
        {
            IReadableColumn col = this._yColumn.Document;

            if (col is Altaxo.Data.DataColumn)
            {
                Altaxo.Data.DataTable table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)col);
                string tablename            = table == null ? string.Empty : table.Name + "\\";
                string collectionname       = table == null ? string.Empty : (table.PropertyColumns.ContainsColumn((DataColumn)col) ? "PropCols\\" : "DataCols\\");
                if (level <= 0)
                {
                    return(((DataColumn)col).Name);
                }
                else if (level == 1)
                {
                    return(tablename + ((DataColumn)col).Name);
                }
                else
                {
                    return(tablename + collectionname + ((DataColumn)col).Name);
                }
            }
            else if (col != null)
            {
                return(col.FullName);
            }
            else
            {
                return(_yColumn.GetName(level) + " (broken)");
            }
        }
コード例 #7
0
 public WorksheetLayout(Altaxo.Data.DataTable table)
     : this()
 {
     if (null != table)
     {
         DataTable = table;
     }
 }
コード例 #8
0
ファイル: PlotCommands3D.cs プロジェクト: Altaxo/Altaxo
		public static List<IGPlotItem> CreatePlotItems(DataTable table, IAscendingIntegerCollection selectedColumns, G3DPlotStyleCollection templatePlotStyle)
		{
			var selColumns = new List<DataColumn>(selectedColumns.Count);
			foreach (int i in selectedColumns)
				selColumns.Add(table[i]);

			return CreatePlotItems(selColumns, templatePlotStyle, table.GetPropertyContext());
		}
コード例 #9
0
		public static void SetContentFromMatrix(DataTable destinationTable, IROMatrix matrix, string columnBaseName, IROVector rowHeaderColumn, string rowHeaderColumnName, IROVector colHeaderColumn, string colHeaderColumnName)
		{
			var c = new MatrixToDataTableConverter(matrix, destinationTable);
			c.ColumnBaseName = columnBaseName;
			c.AddMatrixColumnHeaderData(rowHeaderColumn, rowHeaderColumnName);
			c.AddMatrixColumnHeaderData(colHeaderColumn, colHeaderColumnName);
			c.Execute();
		}
コード例 #10
0
		public override IMultivariateCalibrationModel GetCalibrationModel(
			DataTable calibTable)
		{
			PLS2CalibrationModel model;
			Export(calibTable, out model);

			return model;
		}
コード例 #11
0
    public override void Import(
      IMultivariateCalibrationModel calibrationSet,
      DataTable table)
    {

      PCRCalibrationModel calib = (PCRCalibrationModel)calibrationSet;


      int numFactors = calib.NumberOfFactors;
      int numberOfY = calib.NumberOfY;
      int numberOfPoints = calib.XLoads.Rows;
     


      // store the x-loads - careful - they are horizontal
      for(int i=0;i<numFactors;i++)
      {
        Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();

        for(int j=0;j<calib.XLoads.Columns;j++)
          col[j] = calib.XLoads[i,j];
          
        table.DataColumns.Add(col,GetXLoad_ColumnName(i),Altaxo.Data.ColumnKind.V,0);
      }
     
      // now store the scores - careful - they are vertical in the matrix
      for(int i=0;i<numFactors;i++)
      {
        Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
      
        for(int j=0;j<calib.XScores.Rows;j++)
          col[j] = calib.XScores[j,i];
        
        table.DataColumns.Add(col,GetXScore_ColumnName(i),Altaxo.Data.ColumnKind.V,0);
      }

      // now store the y-loads (this are the preprocessed y in this case
      for(int cn=0;cn<numberOfY;cn++)
      {
        Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
      
        for(int i=0;i<numberOfPoints;i++)
          col[i] = calib.YLoads[i,cn];
        
        table.DataColumns.Add(col,GetYLoad_ColumnName(cn),Altaxo.Data.ColumnKind.V,0);
      }

      // now store the cross product vector - it is a horizontal vector
    {
      Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
      
      for(int j=0;j<numFactors;j++)
        col[j] = calib.CrossProduct[j];
      table.DataColumns.Add(col,GetCrossProduct_ColumnName(),Altaxo.Data.ColumnKind.V,3);
    }

    
    }
コード例 #12
0
ファイル: XYZColumnPlotData.cs プロジェクト: olesar/Altaxo
 public XYZColumnPlotData(Altaxo.Data.DataTable dataTable, int groupNumber, Altaxo.Data.IReadableColumn xColumn, Altaxo.Data.IReadableColumn yColumn, Altaxo.Data.IReadableColumn zColumn)
 {
     DataTable = dataTable;
     ChildSetMember(ref _dataRowSelection, new AllRows());
     _groupNumber = groupNumber;
     XColumn      = xColumn;
     YColumn      = yColumn;
     ZColumn      = zColumn;
 }
コード例 #13
0
			public TableNode(DataTable table)
				: base(true)
			{
				_collection = table.DataColumns;
				_firstColumn = 0;
				_columnCount = table.DataColumns.ColumnCount;
				Text = table.ShortName;
				Tag = table;
			}
コード例 #14
0
 static int GetNumberOfFactors(Altaxo.Data.DataTable table)
 {
     Altaxo.Data.DataColumn col = table.DataColumns[GetCrossProduct_ColumnName(0)];
     if (col == null)
     {
         NotFound(GetCrossProduct_ColumnName(0));
     }
     return(col.Count);
 }
コード例 #15
0
 static int GetNumberOfY(Altaxo.Data.DataTable table)
 {
     Altaxo.Data.DataColumn col = table.DataColumns[GetYLoad_ColumnName(0, 0)];
     if (col == null)
     {
         NotFound(GetYLoad_ColumnName(0, 0));
     }
     return(col.Count);
 }
コード例 #16
0
    public override void Import(
      IMultivariateCalibrationModel calibrationSet,
      DataTable table)
    {
      PLS1CalibrationModel calib = (PLS1CalibrationModel)calibrationSet;

      for(int yn=0;yn<calib.NumberOfY;yn++)
      {
        // store the x-loads - careful - they are horizontal in the matrix
        for(int i=0;i<calib.XLoads[yn].Rows;i++)
        {
          Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();

          for(int j=0;j<calib.XLoads[yn].Columns;j++)
            col[j] = calib.XLoads[yn][i,j];
          
          table.DataColumns.Add(col,GetXLoad_ColumnName(yn,i),Altaxo.Data.ColumnKind.V,0);
        }


        // now store the y-loads - careful - they are horizontal in the matrix
        for(int i=0;i<calib.YLoads[yn].Rows;i++)
        {
          Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
        
          for(int j=0;j<calib.YLoads[yn].Columns;j++)
            col[j] = calib.YLoads[yn][i,j];
        
          table.DataColumns.Add(col,GetYLoad_ColumnName(yn,i),Altaxo.Data.ColumnKind.V,1);
        }

        // now store the weights - careful - they are horizontal in the matrix
        for(int i=0;i<calib.XWeights[yn].Rows;i++)
        {
          Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
      
          for(int j=0;j<calib.XWeights[yn].Columns;j++)
            col[j] = calib.XWeights[yn][i,j];
        
          table.DataColumns.Add(col,GetXWeight_ColumnName(yn,i),Altaxo.Data.ColumnKind.V,0);
        }

        // now store the cross product vector - it is a horizontal vector
      {
        Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
      
        for(int j=0;j<calib.CrossProduct[yn].Columns;j++)
          col[j] = calib.CrossProduct[yn][0,j];
        table.DataColumns.Add(col,GetCrossProduct_ColumnName(yn),Altaxo.Data.ColumnKind.V,3);
      }

      
      } // for all y (constituents)


    }
コード例 #17
0
        /// <summary>
        /// Plots all preprocessed spectra into a newly created graph.
        /// </summary>
        /// <param name="table">The table of PLS output data.</param>
        public static void PlotPreprocessedSpectra(Altaxo.Data.DataTable table)
        {
            DataTable desttable = new DataTable();

            desttable.Name = table.Name + ".PS";
            GetAnalysis(table).CalculatePreprocessedSpectra(table, desttable);
            Current.Project.DataTableCollection.Add(desttable);

            Worksheet.Commands.PlotCommands.PlotLine(desttable, new IntegerRangeAsCollection(1, desttable.DataColumnCount - 1), true, false);
        }
コード例 #18
0
        private static int GetNumberOfFactors(Altaxo.Data.DataTable table)
        {
            var col = table.DataColumns.TryGetColumn(GetCrossProduct_ColumnName(0));

            if (col == null)
            {
                NotFound(GetCrossProduct_ColumnName(0));
            }
            return(col.Count);
        }
コード例 #19
0
        private static int GetNumberOfY(Altaxo.Data.DataTable table)
        {
            var col = table.DataColumns.TryGetColumn(GetYLoad_ColumnName(0, 0));

            if (col == null)
            {
                NotFound(GetYLoad_ColumnName(0, 0));
            }
            return(col.Count);
        }
コード例 #20
0
		public MatrixToDataTableConverter(IROMatrix sourceMatrix, DataTable destinationTable)
		{
			if (null == sourceMatrix)
				throw new ArgumentNullException("sourceMatrix");
			if (null == destinationTable)
				throw new ArgumentNullException("destinationTable");

			_sourceMatrix = sourceMatrix;
			_destinationTable = destinationTable;
		}
コード例 #21
0
        /// <summary>
        /// Asks the user for the preferred number of factors to use for calculation and plotting and stores that number in the
        /// PLS content tag of the table.
        /// </summary>
        /// <param name="table">The table which contains the PLS model.</param>
        public static void QuestPreferredNumberOfFactors(Altaxo.Data.DataTable table)
        {
            MultivariateContentMemento plsMemo = table.GetTableProperty("Content") as MultivariateContentMemento;

            if (plsMemo == null)
            {
                return;
            }

            QuestPreferredNumberOfFactors(plsMemo);
        }
コード例 #22
0
        /// <summary>
        /// This predicts the selected columns/rows against a user choosen calibration model.
        /// The orientation of spectra is given by the parameter <c>spectrumIsRow</c>.
        /// </summary>
        /// <param name="ctrl">The worksheet controller containing the selected data.</param>
        /// <param name="spectrumIsRow">If true, the spectra is horizontally oriented, else it is vertically oriented.</param>
        public static void PredictValues(WorksheetController ctrl, bool spectrumIsRow)
        {
            string modelName, destName;

            if (false == QuestCalibrationModelAndDestinationTable(out modelName, out destName) || null == modelName)
            {
                return; // Cancelled by user
            }
            Altaxo.Data.DataTable modelTable = Current.Project.DataTableCollection[modelName];
            Altaxo.Data.DataTable destTable  = (null == destName ? new Altaxo.Data.DataTable() : Current.Project.DataTableCollection[destName]);

            if (modelTable == null || destTable == null)
            {
                throw new ApplicationException("Unexpected: modelTable or destTable is null");
            }

            int numberOfFactors = 0;

            MultivariateContentMemento memento = modelTable.GetTableProperty("Content") as MultivariateContentMemento;

            if (memento != null)
            {
                numberOfFactors = memento.PreferredNumberOfFactors;
            }

            if (numberOfFactors == 0)
            {
                QuestPreferredNumberOfFactors(modelTable);
                memento = modelTable.GetTableProperty("Content") as MultivariateContentMemento;
                if (memento != null)
                {
                    numberOfFactors = memento.PreferredNumberOfFactors;
                }
            }

            memento.Analysis.PredictValues(
                ctrl.DataTable,
                ctrl.SelectedDataColumns,
                ctrl.SelectedDataRows,
                spectrumIsRow,
                numberOfFactors,
                modelTable,
                destTable);



            // if destTable is new, show it
            if (destTable.ParentObject == null)
            {
                Current.Project.DataTableCollection.Add(destTable);
                Current.ProjectService.OpenOrCreateWorksheetForTable(destTable);
            }
        }
コード例 #23
0
        /// <summary>
        /// Executes the script. If no instance of the script object exists, a error message will be stored and the return value is false.
        /// If the script object exists, the Execute function of this script object is called.
        /// </summary>
        /// <param name="myTable">The data table this script is working on.</param>
        /// <returns>True if executed without exceptions, otherwise false.</returns>
        /// <remarks>If exceptions were thrown during execution, the exception messages are stored
        /// inside the column script and can be recalled by the Errors property.</remarks>
        public bool Execute(Altaxo.Data.DataTable myTable)
        {
            if (null == m_ScriptObject)
            {
                m_Errors = new string[1] {
                    "Script Object is null"
                };
                return(false);
            }


            DataTable clonedTable = (DataTable)myTable.Clone();

            clonedTable.DataColumns.RemoveRowsAll();


            Altaxo.Collections.AscendingIntegerCollection rowsToCopy = new Altaxo.Collections.AscendingIntegerCollection();

            int len = myTable.DataRowCount;



            try
            {
                Altaxo.Calc.ExtractTableValuesExeBase scriptObject = (Altaxo.Calc.ExtractTableValuesExeBase)m_ScriptObject;
                for (int i = 0; i < len; i++)
                {
                    if (scriptObject.IsRowIncluded(myTable, i))
                    {
                        rowsToCopy.Add(i);
                    }
                }
            }
            catch (Exception ex)
            {
                m_Errors    = new string[1];
                m_Errors[0] = ex.ToString();
                return(false);
            }

            for (int i = myTable.DataColumns.ColumnCount - 1; i >= 0; i--)
            {
                for (int j = rowsToCopy.Count - 1; j >= 0; j--)
                {
                    clonedTable.DataColumns[i][j] = myTable.DataColumns[i][rowsToCopy[j]];
                }
            }

            Current.Project.DataTableCollection.Add(clonedTable);
            Current.ProjectService.OpenOrCreateWorksheetForTable(clonedTable);

            return(true);
        }
コード例 #24
0
ファイル: FourierCommands.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Shows the dialog in which the user can select options for the 2D Fourier transformation, and then executes the Fourier transformation
		/// The result is stored in a newly created data table in the same folder as the source data table.
		/// </summary>
		/// <param name="table">The table containing the data to transform.</param>
		/// <param name="selectedDataRows">The selected data rows of the table. (A value of <c>null</c> can be provided here).</param>
		/// <param name="selectedDataColumns">The selected data columns of the table. (A value of <c>null</c> can be provided here).</param>
		/// <param name="selectedPropertyColumns">The selected property columns of the table. (A value of <c>null</c> can be provided here).</param>
		public static void ShowRealFourierTransformation2DDialog(DataTable table, IAscendingIntegerCollection selectedDataRows, IAscendingIntegerCollection selectedDataColumns, IAscendingIntegerCollection selectedPropertyColumns)
		{
			DataTableMatrixProxy proxy = null;
			RealFourierTransformation2DOptions options = null;

			try
			{
				proxy = new DataTableMatrixProxy(table, selectedDataRows, selectedDataColumns, selectedPropertyColumns);

				options = null != _lastUsedOptions ? (RealFourierTransformation2DOptions)_lastUsedOptions.Clone() : new RealFourierTransformation2DOptions();

				double rowIncrementValue; string rowIncrementMessage;
				proxy.TryGetRowHeaderIncrement(out rowIncrementValue, out rowIncrementMessage);
				double columnIncrementValue; string columnIncrementMessage;
				proxy.TryGetColumnHeaderIncrement(out columnIncrementValue, out columnIncrementMessage);

				options.IsUserDefinedRowIncrementValue = false;
				options.RowIncrementValue = rowIncrementValue;
				options.RowIncrementMessage = rowIncrementMessage;

				options.IsUserDefinedColumnIncrementValue = false;
				options.ColumnIncrementValue = columnIncrementValue;
				options.ColumnIncrementMessage = columnIncrementMessage;
			}
			catch (Exception ex)
			{
				Current.Gui.ErrorMessageBox(string.Format("{0}\r\nDetails:\r\n{1}", ex.Message, ex.ToString()), "Error in preparation of Fourier transformation");
				return;
			}

			if (!Current.Gui.ShowDialog(ref options, "Choose fourier transform options", false))
				return;

			_lastUsedOptions = options;

			try
			{
				var resultTable = new DataTable { Name = string.Format("{0}Fourier{1} of {2}", table.Folder, options.OutputKind, table.ShortName) };
				ExecuteFouriertransformation2D(proxy, options, resultTable);

				// Create a DataSource
				Altaxo.Worksheet.Commands.Analysis.FourierTransformation2DDataSource dataSource = new FourierTransformation2DDataSource(proxy, options, new Altaxo.Data.DataSourceImportOptions());
				resultTable.DataSource = dataSource;

				Current.ProjectService.OpenOrCreateWorksheetForTable(resultTable);
			}
			catch (Exception ex)
			{
				Current.Gui.ErrorMessageBox(string.Format("{0}\r\nDetails:\r\n{1}", ex.Message, ex.ToString()), "Error in execution of Fourier transformation");
				return;
			}
		}
コード例 #25
0
        /// <summary>
        /// Plots the cross PRESS value into a provided layer.
        /// </summary>
        /// <param name="table">The table of PLS output data.</param>
        /// <param name="layer">The layer to plot into.</param>
        public static void PlotCrossPRESSValue(Altaxo.Data.DataTable table, XYPlotLayer layer)
        {
            Altaxo.Data.DataColumn ycol = table[WorksheetAnalysis.GetCrossPRESSValue_ColumnName()];
            Altaxo.Data.DataColumn xcol = table[WorksheetAnalysis.GetNumberOfFactors_ColumnName()];

            XYColumnPlotData       pa = new XYColumnPlotData(xcol, ycol);
            G2DPlotStyleCollection ps = new G2DPlotStyleCollection(LineScatterPlotStyleKind.LineAndScatter);

            layer.PlotItems.Add(new XYColumnPlotItem(pa, ps));

            layer.DefaultXAxisTitleString = "Number of factors";
            layer.DefaultYAxisTitleString = "Cross PRESS value";
        }
コード例 #26
0
        protected override void Dispose(bool isDisposing)
        {
            if (null != _parent)
            {
                if (null != _dataTable)
                {
                    _dataTable.TunneledEvent -= EhDataTableTunneledEvent;
                }

                base.Dispose(isDisposing);
                _dataTable = null;
            }
        }
コード例 #27
0
 static int GetNumberOfY(Altaxo.Data.DataTable table)
 {
     if (table.DataColumns[GetYLoad_ColumnName(0)] == null)
     {
         NotFound(GetYLoad_ColumnName(0));
     }
     for (int i = 0;; i++)
     {
         if (null == table.DataColumns[GetYLoad_ColumnName(i)])
         {
             return(i);
         }
     }
 }
コード例 #28
0
ファイル: ImportJcampFiles.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Imports a Jcamp file into an DataTable. The file must not be a multi spectrum file (an exception is thrown in this case).
		/// </summary>
		/// <param name="table">On return, contains the newly created data table with the spectral data.</param>
		/// <param name="stream">The stream where to import from.</param>
		/// <returns>Null if successful, otherwise an error description.</returns>
		public static string ToDataTable(System.IO.Stream stream, out DataTable table)
		{
			table = null;
			TextReader tr;
			try
			{
				tr = new StreamReader(stream);
				return ToDataTable(tr, out table);
			}
			catch (Exception ex)
			{
				return ex.Message;
			}
		}
コード例 #29
0
 private static int GetNumberOfY(Altaxo.Data.DataTable table)
 {
     if (!table.DataColumns.Contains(GetYLoad_ColumnName(0)))
     {
         NotFound(GetYLoad_ColumnName(0));
     }
     for (int i = 0; ; i++)
     {
         if (!table.DataColumns.Contains(GetYLoad_ColumnName(i)))
         {
             return(i);
         }
     }
 }
コード例 #30
0
        /// <summary>
        /// Plots the x (spectral) residuals into a provided layer.
        /// </summary>
        /// <param name="table">The table of PLS output data.</param>
        /// <param name="layer">The layer to plot into.</param>
        /// <param name="whichY">The number of the component (y, concentration etc.) for which to plot the residuals.</param>
        /// <param name="numberOfFactors">The number of factors used for calculation of the residuals.</param>
        public static void PlotXResiduals(Altaxo.Data.DataTable table, XYPlotLayer layer, int whichY, int numberOfFactors)
        {
            string xresidualcolname = WorksheetAnalysis.GetXResidual_ColumnName(whichY, numberOfFactors);
            string yactcolname      = WorksheetAnalysis.GetYOriginal_ColumnName(whichY);

            if (table[xresidualcolname] == null)
            {
                GetAnalysis(table).CalculateXResidual(table, whichY, numberOfFactors);
            }

            PlotOnlyLabel(layer, table[yactcolname], table[xresidualcolname], table[WorksheetAnalysis.GetMeasurementLabel_ColumnName()]);

            layer.DefaultXAxisTitleString = string.Format("Y original{0}", whichY);
            layer.DefaultYAxisTitleString = string.Format("X residual{0} (#factors:{1})", whichY, numberOfFactors);
        }
コード例 #31
0
        /// <summary>
        /// Plots the cross predicted versus actual Y (concentration) into a provided layer.
        /// </summary>
        /// <param name="table">The table of PLS output data.</param>
        /// <param name="layer">The layer to plot into.</param>
        /// <param name="whichY">The number of the component (y, concentration etc.) for which to plot the residuals.</param>
        /// <param name="numberOfFactors">The number of factors used for calculation of the residuals.</param>
        public static void PlotCrossPredictedVersusActualY(Altaxo.Data.DataTable table, XYPlotLayer layer, int whichY, int numberOfFactors)
        {
            string ypredcolname = WorksheetAnalysis.GetYCrossPredicted_ColumnName(whichY, numberOfFactors);
            string yactcolname  = WorksheetAnalysis.GetYOriginal_ColumnName(whichY);

            if (table[ypredcolname] == null)
            {
                GetAnalysis(table).CalculateCrossPredictedAndResidual(table, whichY, numberOfFactors, true, false, false);
            }

            PlotOnlyLabel(layer, table[yactcolname], table[ypredcolname], table[WorksheetAnalysis.GetMeasurementLabel_ColumnName()]);

            layer.DefaultXAxisTitleString = string.Format("Y original{0}", whichY);
            layer.DefaultYAxisTitleString = string.Format("Y cross predicted{0} (#factors:{1})", whichY, numberOfFactors);
        }
コード例 #32
0
        /// <summary>
        /// Plots the x (spectral) leverage into a provided layer.
        /// </summary>
        /// <param name="table">The table of PLS output data.</param>
        /// <param name="layer">The layer to plot into.</param>
        /// <param name="preferredNumberOfFactors">The number of factors used for leverage calculation.</param>
        public static void PlotXLeverage(Altaxo.Data.DataTable table, XYPlotLayer layer, int preferredNumberOfFactors)
        {
            string xcolname = WorksheetAnalysis.GetMeasurementLabel_ColumnName();
            string ycolname = WorksheetAnalysis.GetXLeverage_ColumnName(preferredNumberOfFactors);

            if (table[ycolname] == null)
            {
                GetAnalysis(table).CalculateXLeverage(table, preferredNumberOfFactors);
            }

            PlotOnlyLabel(layer, table[xcolname], table[ycolname], table[WorksheetAnalysis.GetMeasurementLabel_ColumnName()]);

            layer.DefaultXAxisTitleString = string.Format("Measurement");
            layer.DefaultYAxisTitleString = string.Format("Score leverage (#factors:{0})", preferredNumberOfFactors);
        }
コード例 #33
0
        public SDTableScriptController(Altaxo.Data.DataTable dataTable, TableScript tableScript)
        {
            this.m_DataTable = dataTable;

            if (null != tableScript)
            {
                this.m_TableScript = (IScriptText)tableScript.Clone();
            }
            else
            {
                this.m_TableScript = new TableScript();
            }

            SetElements(true);
        }
コード例 #34
0
ファイル: WorksheetCommands.cs プロジェクト: olesar/Altaxo
        public override void Run(Altaxo.Gui.Worksheet.Viewing.WorksheetController ctrl)
        {
            _table = ctrl.DataTable;

            var script = _table.GetPropertyValue <FileImportScript>("Temp\\FileImportScript") ?? new FileImportScript();

            object[] args = new object[] { script, new Altaxo.Gui.Scripting.ScriptExecutionHandler(EhScriptExecution) };

            if (Current.Gui.ShowDialog(args, "File import script of " + _table.Name))
            {
                _table.PropertyBag.SetValue <FileImportScript>("Temp\\FileImportScript", (FileImportScript)args[0]);
            }

            _table = null;
        }
コード例 #35
0
ファイル: WorksheetCommands.cs プロジェクト: olesar/Altaxo
        public override void Run(Altaxo.Gui.Worksheet.Viewing.WorksheetController ctrl)
        {
            _table = ctrl.DataTable;

            var script = _table.TableScript ?? new TableScript();

            object[] args = new object[] { script, new Altaxo.Gui.Scripting.ScriptExecutionHandler(EhScriptExecution) };

            if (Current.Gui.ShowDialog(args, "WorksheetScript of " + _table.Name))
            {
                _table.TableScript = (TableScript)args[0];
            }

            _table = null;
        }
コード例 #36
0
        /// <summary>
        /// Pastes data from a table (usually deserialized table from the clipboard) into a worksheet, which has
        /// currently selected columns. The number of selected columns has to match the number of columns of the source table.
        /// </summary>
        /// <param name="dg">The worksheet to paste into.</param>
        /// <param name="sourcetable">The table which contains the data to paste into the worksheet.</param>
        /// <remarks>The operation is defined as follows: if the is no ro selection, the data are inserted beginning at row[0] of the destination table.
        /// If there is a row selection, the data are inserted in the selected rows, and then in the rows after the last selected rows.
        /// No exception is thrown if a column type does not match the corresponding source column type.
        /// The columns to paste into do not change their name, kind or group number. But property columns in the source table
        /// are pasted into the destination table.</remarks>
        protected static void PasteFromTableColumnsToSelectedColumns(GUI.WorksheetController dg, Altaxo.Data.DataTable sourcetable)
        {
            Altaxo.Data.DataTable desttable = dg.DataTable;

            Altaxo.Data.DataColumn[] propertycolumnmap = MapOrCreatePropertyColumns(desttable, sourcetable);

            // use the selected columns, then use the following columns, then add columns
            int nDestCol = -1;

            for (int nSrcCol = 0; nSrcCol < sourcetable.DataColumns.ColumnCount; nSrcCol++)
            {
                nDestCol = nSrcCol < dg.SelectedDataColumns.Count ? dg.SelectedDataColumns[nSrcCol] : nDestCol + 1;
                Altaxo.Data.DataColumn destcolumn;
                if (nDestCol < desttable.DataColumns.ColumnCount)
                {
                    destcolumn = desttable.DataColumns[nDestCol];
                }
                else
                {
                    string name  = sourcetable.DataColumns.GetColumnName(nSrcCol);
                    int    group = sourcetable.DataColumns.GetColumnGroup(nSrcCol);
                    Altaxo.Data.ColumnKind kind = sourcetable.DataColumns.GetColumnKind(nSrcCol);
                    destcolumn = (Altaxo.Data.DataColumn)Activator.CreateInstance(sourcetable.DataColumns[nSrcCol].GetType());
                    desttable.DataColumns.Add(destcolumn, name, kind, group);
                }

                // now fill the data into that column
                Altaxo.Data.DataColumn sourcecolumn = sourcetable.DataColumns[nSrcCol];

                try
                {
                    int nDestRow = -1;
                    for (int nSrcRow = 0; nSrcRow < sourcetable.DataColumns.RowCount; nSrcRow++)
                    {
                        nDestRow             = nSrcRow < dg.SelectedDataRows.Count ? dg.SelectedDataRows[nSrcRow] : nDestRow + 1;
                        destcolumn[nDestRow] = sourcecolumn[nSrcRow];
                    }
                }
                catch (Exception)
                {
                }


                // also fill in the property values
                int nDestColumnIndex = desttable.DataColumns.GetColumnNumber(destcolumn);
                FillRow(propertycolumnmap, nDestColumnIndex, sourcetable.PropCols, nSrcCol);
            } // for all data columns
        }
コード例 #37
0
        /// <summary>
        /// Plots the x (spectral) leverage into a graph.
        /// </summary>
        /// <param name="table">The table with the PLS model data.</param>
        public static void PlotXLeverage(Altaxo.Data.DataTable table)
        {
            MultivariateContentMemento plsMemo = table.GetTableProperty("Content") as MultivariateContentMemento;

            if (plsMemo == null)
            {
                return;
            }
            if (plsMemo.PreferredNumberOfFactors <= 0)
            {
                QuestPreferredNumberOfFactors(plsMemo);
            }

            Altaxo.Graph.GUI.IGraphController graphctrl = Current.ProjectService.CreateNewGraph();
            PlotXLeverage(table, graphctrl.Doc.Layers[0], plsMemo.PreferredNumberOfFactors);
        }
コード例 #38
0
    public SDTableScriptController(Altaxo.Data.DataTable dataTable, TableScript tableScript)
    {
      this.m_DataTable = dataTable;

      if(null!=tableScript)
      {
        this.m_TableScript = (IScriptText)tableScript.Clone();
      }
      else
      {
        this.m_TableScript = new TableScript();
      }

      SetElements(true);

    }
コード例 #39
0
ファイル: EditCommands.cs プロジェクト: olesar/Altaxo
        /// <summary>
        /// Pastes data from a table (usually deserialized table from the clipboard) into a worksheet.
        /// The paste operation depends on the current selection of columns, rows, or property columns.
        /// </summary>
        /// <param name="ctrl">The worksheet to paste into.</param>
        /// <param name="sourcetable">The table which contains the data to paste into the worksheet.</param>
        /// <remarks>The paste operation is defined in the following way:
        /// If nothing is currently selected, the columns are appended to the end of the worksheet and the property data
        /// are set for that columns.
        /// If only columns are currently selected, the data is pasted in that columns (column by column). If number of
        /// selected columns not match the number of columns in the paste table, but match the number of rows in the paste table,
        /// the paste is done column by row.
        ///
        /// </remarks>
        public static void PasteFromTable(IWorksheetController ctrl, Altaxo.Data.DataTable sourcetable)
        {
            using (var suspendToken = ctrl.DataTable.SuspendGetToken())
            {
                if (!ctrl.AreColumnsOrRowsSelected)
                {
                    PasteFromTableToUnselected(ctrl, sourcetable);
                }
                else if (ctrl.SelectedDataColumns.Count > 0 && ctrl.SelectedDataColumns.Count == sourcetable.DataColumns.ColumnCount)
                {
                    PasteFromTableColumnsToSelectedColumns(ctrl, sourcetable);
                }
                else if (ctrl.SelectedDataColumns.Count > 0 && ctrl.SelectedDataColumns.Count == sourcetable.DataColumns.RowCount)
                {
                    PasteFromTableRowsToSelectedColumns(ctrl, sourcetable);
                }
                else if (ctrl.SelectedDataRows.Count > 0 && ctrl.SelectedDataRows.Count == sourcetable.DataColumns.RowCount)
                {
                    PasteFromTableRowsToSelectedRows(ctrl, sourcetable);
                }
                else if (ctrl.SelectedDataRows.Count > 0 && ctrl.SelectedDataRows.Count == sourcetable.DataColumns.ColumnCount)
                {
                    PasteFromTableColumnsToSelectedRows(ctrl, sourcetable);
                }
                else if (ctrl.SelectedPropertyColumns.Count > 0 && ctrl.SelectedPropertyColumns.Count == sourcetable.DataColumns.ColumnCount)
                {
                    PasteFromTableColumnsToSelectedPropertyColumns(ctrl, sourcetable);
                }
                // now look if the data are transposed
                else if (ctrl.SelectedPropertyColumns.Count > 0 && ctrl.SelectedPropertyColumns.Count == sourcetable.DataColumns.RowCount)
                {
                    PasteFromTableColumnsTransposedToSelectedPropertyColumns(ctrl, sourcetable);
                }

                // now the not exact matches
                else if (ctrl.SelectedDataColumns.Count > 0)
                {
                    PasteFromTableColumnsToSelectedColumns(ctrl, sourcetable);
                }
                else if (ctrl.SelectedDataRows.Count > 0)
                {
                    PasteFromTableRowsToSelectedRows(ctrl, sourcetable);
                }

                suspendToken.Dispose();
            }
        }
コード例 #40
0
        /// <summary>
        /// Executes the script. If no instance of the script object exists, a error message will be stored and the return value is false.
        /// If the script object exists, the Execute function of this script object is called.
        /// </summary>
        /// <param name="myTable">The data table this script is working on.</param>
        /// <returns>True if executed without exceptions, otherwise false.</returns>
        /// <remarks>If exceptions were thrown during execution, the exception messages are stored
        /// inside the column script and can be recalled by the Errors property.</remarks>
        public bool Execute(Altaxo.Data.DataTable myTable)
        {
            if (null == _scriptObject)
            {
                _errors = ImmutableArray.Create(new CompilerDiagnostic(null, null, DiagnosticSeverity.Error, "Script Object is null"));
                return(false);
            }

            var clonedTable = (DataTable)myTable.Clone();

            clonedTable.DataColumns.RemoveRowsAll();

            var rowsToCopy = new Altaxo.Collections.AscendingIntegerCollection();

            int len = myTable.DataRowCount;

            try
            {
                var scriptObject = (Altaxo.Calc.ExtractTableValuesExeBase)_scriptObject;
                for (int i = 0; i < len; i++)
                {
                    if (scriptObject.IsRowIncluded(myTable, i))
                    {
                        rowsToCopy.Add(i);
                    }
                }
            }
            catch (Exception ex)
            {
                _errors = ImmutableArray.Create(new CompilerDiagnostic(null, null, DiagnosticSeverity.Error, ex.ToString()));
                return(false);
            }

            for (int i = myTable.DataColumns.ColumnCount - 1; i >= 0; i--)
            {
                for (int j = rowsToCopy.Count - 1; j >= 0; j--)
                {
                    clonedTable.DataColumns[i][j] = myTable.DataColumns[i][rowsToCopy[j]];
                }
            }

            Current.Project.DataTableCollection.Add(clonedTable);
            Current.ProjectService.OpenOrCreateWorksheetForTable(clonedTable);

            return(true);
        }
コード例 #41
0
ファイル: MergeTables.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Merges two tables by fractional index.
		/// </summary>
		/// <param name="destinationTable">Table to merge into.</param>
		/// <param name="fractionalIndex">Array of fractional indices. Each item points into the slaveTable to the value that should be included in the master column at the item's index.</param>
		/// <param name="slaveTable">The table providing the data for merging into the master table.</param>
		/// <param name="slaveColumnsToMerge">Indices of that columns of the slave table that should be merged into the master table.</param>
		public static void MergeTable(
			this DataTable destinationTable,
			DoubleColumn fractionalIndex,
			DataTable slaveTable,
			IAscendingIntegerCollection slaveColumnsToMerge)
		{
			int destinationTableStartIdx = destinationTable.DataColumnCount;
			destinationTable.AddDataColumnsWithPropertiesFrom(slaveTable, slaveColumnsToMerge);

			for (int i = 0; i < slaveColumnsToMerge.Count; i++)
			{
				int slaveColIdx = slaveColumnsToMerge[i];
				DataColumn newCol = destinationTable[destinationTableStartIdx + i];

				SetColumnFromFractionalIndex(newCol, fractionalIndex, slaveTable[slaveColIdx]);
			}
		}
コード例 #42
0
ファイル: MergeTables.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Merges two tables by corresponding x-columns.
		/// </summary>
		/// <param name="masterTable">Master table. Values from the slave table will be recalculated to fit the x-values of the master table.</param>
		/// <param name="masterXColumn">The master x-column of the master table.</param>
		/// <param name="slaveTable">The table providing the data for merging into the master table.</param>
		/// <param name="slaveXColumn">The x column of the slave table.</param>
		/// <param name="columnsToMerge">Indices of that columns of the slave table that should be merged into the master table.</param>
		/// <param name="createNewTable">If true, a new table is created as a clone of the master table. The data from the slave table are then merged into that clone. If false,
		/// the data are directly merged into the master table.</param>
		/// <returns>If <c>createNewTable</c> is true, then the newly created table. If false, then the provided master table where the data are merge to.</returns>
		public static DataTable MergeTable(
			this DataTable masterTable, DataColumn masterXColumn,
			DataTable slaveTable, DataColumn slaveXColumn,
			Altaxo.Collections.IAscendingIntegerCollection columnsToMerge,
			bool createNewTable)
		{
			DataTable destinationTable;
			if (createNewTable)
				destinationTable = (DataTable)masterTable.Clone();
			else
				destinationTable = masterTable;

			// create a fractional index column with the same length than the master table
			// that points into the slave table

			DoubleColumn fractIndex = GetFractionalIndex(masterXColumn, slaveXColumn);

			MergeTable(masterTable, fractIndex, slaveTable, columnsToMerge);

			return destinationTable;
		}
コード例 #43
0
		/// <summary>
		/// Try to get a common data table and a group number from all columns (here we don't rely on <see cref="DataTable"/> and GroupNumber of this document).
		/// </summary>
		/// <param name="columns">The columns to consider. <see cref="ITransformedReadableColumn"/> will be stripped to get the underlying data column.</param>
		/// <param name="dataTableIsNotUniform">If the columns gives different result for their underlying data table, the result here will be true.</param>
		/// <param name="commonDataTable">If the previous parameter results in false, this is the common data table of all columns. If the previous parameter is true, this is the first underlying data table that could be deduced from the columns. The result is null if no underlying table could be deduced from the columns.</param>
		/// <param name="groupNumberIsNotUniform">If the columns gives different result for their group number, the result here will be true.</param>
		/// <param name="commonGroupNumber">If the previous parameter results in false, this is the common group number of all columns. If the previous parameter results in true, this is the first group number that could be deduced from the columns. The result is null if no group number could be deduced from the columns.</param>
		public static void GetCommonDataTableAndGroupNumberFromColumns(this IEnumerable<IReadableColumn> columns, out bool dataTableIsNotUniform, out DataTable commonDataTable, out bool groupNumberIsNotUniform, out int? commonGroupNumber)
		{
			dataTableIsNotUniform = false;
			groupNumberIsNotUniform = false;
			commonDataTable = null;
			commonGroupNumber = null;

				foreach(var col in columns)
				{
					IReadableColumn underlyingColumn = col;

					while (underlyingColumn is ITransformedReadableColumn)
					{
						underlyingColumn = (underlyingColumn as ITransformedReadableColumn).UnderlyingReadableColumn;
					}

					if (underlyingColumn is DataColumn)
					{
						var colColl = DataColumnCollection.GetParentDataColumnCollectionOf((DataColumn)underlyingColumn);
						var dataTable = DataTable.GetParentDataTableOf(colColl);
						int? groupNumber = colColl?.GetColumnGroup((DataColumn)underlyingColumn);

						if (null != dataTable)
						{
							if (null == commonDataTable)
								commonDataTable = dataTable;
							else if (!object.ReferenceEquals(commonDataTable, dataTable))
								dataTableIsNotUniform = true;
						}

						if (null != groupNumber)
						{
							if (null == commonGroupNumber)
								commonGroupNumber = groupNumber;
							else if (!(commonGroupNumber == groupNumber))
								groupNumberIsNotUniform = true;
						}
					}
				}
		}
コード例 #44
0
ファイル: Import.cs プロジェクト: xuchuansheng/GenXSource
    /// <summary>
    /// Imports a Origin OPJ file (tables only) into corresponding new tables in Altaxo.
    /// </summary>
    /// <param name="filename">The file name of the origin OPJ file.</param>
    /// <returns>Null if the import was successfull, or a error message.</returns>
    public static string Import(string filename)
    {
      OpjFile opj = new OpjFile(filename);
      opj.Parse();

      // now create corresponding tables in Altaxo

      for (int nspread = 0; nspread < opj.numSpreads(); nspread++)
      {
        // Create a new table
        string tablename = Current.Project.DataTableCollection.FindNewTableName(opj.spreadName(nspread));
        DataTable table = new DataTable(tablename);

        int numberOfColumns = opj.numCols(nspread);
        for (int ncol = 0; ncol < numberOfColumns; ncol++)
        {
          string colname = opj.colName(nspread, ncol);
          string coltype = opj.colType(nspread, ncol);
          int numberOfRows = opj.numRows(nspread, ncol);
          ColumnKind kind = coltype == "X" ? ColumnKind.X : ColumnKind.V;

          DoubleColumn column = new DoubleColumn(numberOfRows);
          column.CopyDataFrom(opj.Data(nspread, ncol), numberOfRows);


          colname = table.DataColumns.FindUniqueColumnName(colname);
          table.DataColumns.Add(column, colname, kind, 0);
        }


        table.Name = tablename;
        Current.Project.DataTableCollection.Add(table);
        Current.ProjectService.CreateNewWorksheet(table);
      }
      return null;
    }
コード例 #45
0
ファイル: StatisticCommands.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Create a statistical table for statistics on columns. Property columns are not included in the statistical table.
		/// </summary>
		/// <param name="srcTable"></param>
		/// <param name="selectedColumns"></param>
		/// <returns></returns>
		private static DataTable CreateStatisticalTable(DataColumnCollection srcTable, IAscendingIntegerCollection selectedColumns)
		{
			DataTable result = new DataTable();

			result.DataColumns.Add(new TextColumn(), DefaultColumnNameColumnName, ColumnKind.X, 0);
			AddStatisticColumns(result);
			return result;
		}
コード例 #46
0
		public static void RealFourierTransform(RealFourierTransformOptions options)
		{
			var yCol = options.ColumnToTransform;
			int fftLen = yCol.Count;

			double[] resultCol = new double[fftLen];
			for (int i = 0; i < resultCol.Length; ++i)
				resultCol[i] = yCol[i];

			var transform = new Calc.Fourier.RealFourierTransform(fftLen);
			transform.Transform(resultCol, Calc.Fourier.FourierDirection.Forward);

			var wrapper = new Calc.Fourier.RealFFTResultWrapper(resultCol);

			DataTable outputTable = null;
			switch (options.OutputPlacement)
			{
				case RealFourierTransformOutputPlacement.CreateInNewWorksheet:
					outputTable = new DataTable();
					outputTable.Name = "Real FFT results";
					Current.Project.DataTableCollection.Add(outputTable);
					Current.ProjectService.OpenOrCreateWorksheetForTable(outputTable);
					break;

				case RealFourierTransformOutputPlacement.CreateInSameWorksheet:
					outputTable = DataTable.GetParentDataTableOf(yCol);
					if (null == outputTable)
						throw new ArgumentException("Provided y-column does not belong to a data table.");
					break;

				default:
					throw new ArgumentOutOfRangeException("Unkown  enum value: " + options.OutputPlacement.ToString());
			}

			// create the x-Column first
			var freqCol = new DoubleColumn();
			freqCol.AssignVector = wrapper.FrequenciesFromXIncrement(options.XIncrementValue);
			int outputGroup = outputTable.DataColumns.GetUnusedColumnGroupNumber();
			outputTable.DataColumns.Add(freqCol, "Frequency", ColumnKind.X, outputGroup);

			// now create the other output cols
			if (options.Output.HasFlag(RealFourierTransformOutput.Re))
			{
				var col = new DoubleColumn();
				col.AssignVector = wrapper.RealPart;
				outputTable.DataColumns.Add(col, "Re", ColumnKind.V, outputGroup);
			}

			if (options.Output.HasFlag(RealFourierTransformOutput.Im))
			{
				var col = new DoubleColumn();
				col.AssignVector = wrapper.ImaginaryPart;
				outputTable.DataColumns.Add(col, "Im", ColumnKind.V, outputGroup);
			}

			if (options.Output.HasFlag(RealFourierTransformOutput.Abs))
			{
				var col = new DoubleColumn();
				col.AssignVector = wrapper.Amplitude;
				outputTable.DataColumns.Add(col, "Abs", ColumnKind.V, outputGroup);
			}

			if (options.Output.HasFlag(RealFourierTransformOutput.Phase))
			{
				var col = new DoubleColumn();
				col.AssignVector = wrapper.Phase;
				outputTable.DataColumns.Add(col, "Phase", ColumnKind.V, outputGroup);
			}

			if (options.Output.HasFlag(RealFourierTransformOutput.Power))
			{
				var col = new DoubleColumn();
				col.AssignVector = wrapper.Amplitude;
				col.Data = col * col;
				outputTable.DataColumns.Add(col, "Power", ColumnKind.V, outputGroup);
			}
		}
コード例 #47
0
ファイル: WorksheetAnalysis.cs プロジェクト: Altaxo/Altaxo
		public static MultivariateContentMemento GetContentAsMultivariateContentMemento(DataTable table)
		{
			var result = table.GetTableProperty("Content") as MultivariateContentMemento;
			return result;
		}
コード例 #48
0
ファイル: WorksheetAnalysis.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Returns an instance of the calibration model specific for the multivariate analysis.
		/// </summary>
		/// <param name="calibTable">The table where the calibration model is stored.</param>
		/// <returns>Instance of the calibration model (in more handy format).</returns>
		public abstract IMultivariateCalibrationModel GetCalibrationModel(DataTable calibTable);
コード例 #49
0
ファイル: WorksheetAnalysis.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Calculate the cross PRESS values and stores the results in the provided table.
		/// </summary>
		/// <param name="xOfX">Vector of spectral wavelengths. Necessary to divide the spectras in different regions.</param>
		/// <param name="matrixX">Matrix of spectra (horizontal oriented).</param>
		/// <param name="matrixY">Matrix of concentrations.</param>
		/// <param name="plsOptions">Analysis options.</param>
		/// <param name="plsContent">Information about this analysis.</param>
		/// <param name="table">Table to store the results.</param>
		public virtual void CalculateCrossPRESS(
			IROVector xOfX,
			IMatrix matrixX,
			IMatrix matrixY,
			MultivariateAnalysisOptions plsOptions,
			MultivariateContentMemento plsContent,
			DataTable table
			)
		{
			IROVector crossPRESSMatrix;

			Altaxo.Data.DoubleColumn crosspresscol = new Altaxo.Data.DoubleColumn();

			double meanNumberOfExcludedSpectra = 0;
			if (plsOptions.CrossPRESSCalculation != CrossPRESSCalculationType.None)
			{
				// now a cross validation - this can take a long time for bigger matrices

				MultivariateRegression.GetCrossPRESS(
					xOfX, matrixX, matrixY, plsOptions.MaxNumberOfFactors, GetGroupingStrategy(plsOptions),
					plsContent.SpectralPreprocessing,
					this.CreateNewRegressionObject(),
					out crossPRESSMatrix);

				VectorMath.Copy(crossPRESSMatrix, DataColumnWrapper.ToVector(crosspresscol, crossPRESSMatrix.Length));

				table.DataColumns.Add(crosspresscol, GetCrossPRESSValue_ColumnName(), Altaxo.Data.ColumnKind.V, 4);

				plsContent.MeanNumberOfMeasurementsInCrossPRESSCalculation = plsContent.NumberOfMeasurements - meanNumberOfExcludedSpectra;
			}
			else
			{
				table.DataColumns.Add(crosspresscol, GetCrossPRESSValue_ColumnName(), Altaxo.Data.ColumnKind.V, 4);
			}
		}
コード例 #50
0
    /// <summary>
    /// Plots all preprocessed spectra into a newly created graph.
    /// </summary>
    /// <param name="table">The table of PLS output data.</param>
    public static void PlotPreprocessedSpectra(Altaxo.Data.DataTable table)
    {
      DataTable desttable = new DataTable();
      desttable.Name = table.Name+".PS";
      GetAnalysis(table).CalculatePreprocessedSpectra(table, desttable);
      Current.Project.DataTableCollection.Add(desttable);

      Worksheet.Commands.PlotCommands.PlotLine(desttable,new IntegerRangeAsCollection(1,desttable.DataColumnCount-1),true,false);
    }
コード例 #51
0
		private NGTreeNode FindTableNode(NGTreeNode tableCollectionNode, DataTable table)
		{
			NGTreeNode result = null;

			foreach (NGTreeNode node in tableCollectionNode.Nodes)
				if (object.ReferenceEquals(node.Tag, table))
				{
					result = node;
					return result;
				}

			foreach (NGTreeNode node in tableCollectionNode.Nodes)
			{
				result = FindTableNode(node, table);
				if (null != result)
					return result;
			}

			return result;
		}
コード例 #52
0
    /// <summary>
    /// Multiplies selected columns to form a matrix.
    /// </summary>
    /// <param name="mainDocument"></param>
    /// <param name="srctable"></param>
    /// <param name="selectedColumns"></param>
    /// <returns>Null if successful, else the description of the error.</returns>
    /// <remarks>The user must select an even number of columns. All columns of the first half of the selection 
    /// must have the same number of rows, and all columns of the second half of selection must also have the same
    /// number of rows. The first half of selected columns form a matrix of dimensions(firstrowcount,halfselected), and the second half
    /// of selected columns form a matrix of dimension(halfselected, secondrowcount). The resulting matrix has dimensions (firstrowcount,secondrowcount) and is
    /// stored in a separate worksheet.</remarks>
    public static string MultiplyColumnsToMatrix(
      Altaxo.AltaxoDocument mainDocument,
      Altaxo.Data.DataTable srctable,
      IAscendingIntegerCollection selectedColumns
      )
    {
      // check that there are columns selected
      if(0==selectedColumns.Count)
        return "You must select at least two columns to multiply!";
      // selected columns must contain an even number of columns
      if(0!=selectedColumns.Count%2)
        return "You selected an odd number of columns. Please select an even number of columns to multiply!";
      // all selected columns must be numeric columns
      for(int i=0;i<selectedColumns.Count;i++)
      {
        if(!(srctable[selectedColumns[i]] is Altaxo.Data.INumericColumn))
          return string.Format("The column[{0}] (name:{1}) is not a numeric column!",selectedColumns[i],srctable[selectedColumns[i]].Name);
      }


      int halfselect = selectedColumns.Count/2;
    
      // check that all columns from the first half of selected colums contain the same
      // number of rows

      int rowsfirsthalf=int.MinValue;
      for(int i=0;i<halfselect;i++)
      {
        int idx = selectedColumns[i];
        if(rowsfirsthalf<0)
          rowsfirsthalf = srctable[idx].Count;
        else if(rowsfirsthalf != srctable[idx].Count)
          return "The first half of selected columns have not all the same length!";
      }

      int rowssecondhalf=int.MinValue;
      for(int i=halfselect;i<selectedColumns.Count;i++)
      {
        int idx = selectedColumns[i];
        if(rowssecondhalf<0)
          rowssecondhalf = srctable[idx].Count;
        else if(rowssecondhalf != srctable[idx].Count)
          return "The second half of selected columns have not all the same length!";
      }


      // now create the matrices to multiply from the 

      MatrixMath.REMatrix firstMat = new MatrixMath.REMatrix(rowsfirsthalf,halfselect);
      for(int i=0;i<halfselect;i++)
      {
        Altaxo.Data.INumericColumn col = (Altaxo.Data.INumericColumn)srctable[selectedColumns[i]];
        for(int j=0;j<rowsfirsthalf;j++)
          firstMat[j,i] = col[j];
      }
      
      MatrixMath.BEMatrix secondMat = new MatrixMath.BEMatrix(halfselect,rowssecondhalf);
      for(int i=0;i<halfselect;i++)
      {
        Altaxo.Data.INumericColumn col = (Altaxo.Data.INumericColumn)srctable[selectedColumns[i+halfselect]];
        for(int j=0;j<rowssecondhalf;j++)
          secondMat[i,j] = col[j];
      }

      // now multiply the two matrices
      MatrixMath.BEMatrix resultMat = new MatrixMath.BEMatrix(rowsfirsthalf,rowssecondhalf);
      MatrixMath.Multiply(firstMat,secondMat,resultMat);


      // and store the result in a new worksheet 
      Altaxo.Data.DataTable table = new Altaxo.Data.DataTable("ResultMatrix of " + srctable.Name);
      table.Suspend();

      // first store the factors
      for(int i=0;i<resultMat.Columns;i++)
      {
        Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
        for(int j=0;j<resultMat.Rows;j++)
          col[j] = resultMat[j,i];
        
        table.DataColumns.Add(col,i.ToString());
      }

      table.Resume();
      mainDocument.DataTableCollection.Add(table);
      // create a new worksheet without any columns
      Current.ProjectService.CreateNewWorksheet(table);

      return null;
    }
コード例 #53
0
ファイル: WorksheetAnalysis.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Calculates the leverage of the spectral data.
		/// </summary>
		/// <param name="table">Table where the calibration model is stored.</param>
		/// <param name="numberOfFactors">Number of factors used to calculate leverage.</param>
		public virtual void CalculateXLeverage(
			DataTable table, int numberOfFactors)
		{
			var plsMemo = GetContentAsMultivariateContentMemento(table);

			if (plsMemo == null)
				throw new ArgumentException("Table does not contain a PLSContentMemento");

			IMultivariateCalibrationModel calib = this.GetCalibrationModel(table);
			IMatrix matrixX = GetRawSpectra(plsMemo);

			MultivariateRegression.PreprocessSpectraForPrediction(calib, plsMemo.SpectralPreprocessing, matrixX);

			MultivariateRegression regress = this.CreateNewRegressionObject();
			regress.SetCalibrationModel(calib);

			IROMatrix xLeverage = regress.GetXLeverageFromRaw(matrixX, numberOfFactors);

			for (int i = 0; i < xLeverage.Columns; i++)
			{
				Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
				MatrixMath.SetColumn(xLeverage, i, DataColumnWrapper.ToVertMatrix(col, xLeverage.Rows), 0);
				table.DataColumns.Add(
					col,
					xLeverage.Columns == 1 ? GetXLeverage_ColumnName(numberOfFactors) : GetXLeverage_ColumnName(i, numberOfFactors),
					Altaxo.Data.ColumnKind.V, GetXLeverage_ColumnGroup());
			}
		}
コード例 #54
0
ファイル: StatisticCommands.cs プロジェクト: Altaxo/Altaxo
		private static void AddStatisticColumns(DataTable result)
		{
			result.DataColumns.Add(new DoubleColumn(), DefaultMeanColumnName, ColumnKind.V, 0);
			result.DataColumns.Add(new DoubleColumn(), DefaultStandardErrorColumnName, ColumnKind.Err, 0);
			result.DataColumns.Add(new DoubleColumn(), DefaultStandardDeviationColumnName, ColumnKind.V, 0);
			result.DataColumns.Add(new DoubleColumn(), DefaultSumColumnName, ColumnKind.V, 0);
			result.DataColumns.Add(new DoubleColumn(), DefaultSumSqrColumnName, ColumnKind.V, 0);
			result.DataColumns.Add(new DoubleColumn(), DefaultNumberOfItemsColumnName, ColumnKind.V, 0);
			result.DataColumns.Add(new DoubleColumn(), DefaultFractionInOneSigmaColumnName, ColumnKind.V, 0);
			result.DataColumns.Add(new DoubleColumn(), DefaultFractionInTwoSigmaColumnName, ColumnKind.V, 0);
			result.DataColumns.Add(new DoubleColumn(), DefaultFractionInThreeSigmaColumnName, ColumnKind.V, 0);
		}
コード例 #55
0
ファイル: StatisticCommands.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Creates a table for statistics on columns. Property columns are included in the statistical table.
		/// </summary>
		/// <param name="srcTable"></param>
		/// <param name="selectedColumns"></param>
		/// <returns></returns>
		private static DataTable CreateStatisticalTable(DataTable srcTable, IAscendingIntegerCollection selectedColumns)
		{
			DataTable result = new DataTable();
			result.Name = Altaxo.Main.ProjectFolder.PrependToName(srcTable.Name, "Statistics of ");

			result.DataColumns.Add(new TextColumn(), DefaultColumnNameColumnName, ColumnKind.X, 0);
			AddSourcePropertyColumns(srcTable, selectedColumns, result);
			AddStatisticColumns(result);
			return result;
		}
コード例 #56
0
ファイル: WorksheetAnalysis.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Calculates the prediction scores. In case of a single y-variable, the prediction score is a vector of the same length than a spectrum.
		/// Multiplying the prediction score (dot product) with a spectrum, it yields the predicted y-value (of cause mean-centered).
		/// </summary>
		/// <param name="table">The table where the calibration model is stored.</param>
		/// <param name="preferredNumberOfFactors">Number of factors used to calculate the prediction scores.</param>
		/// <returns>A matrix with the prediction scores. Each score (for one y-value) is a row in the matrix.</returns>
		public virtual IROMatrix CalculatePredictionScores(DataTable table, int preferredNumberOfFactors)
		{
			MultivariateRegression regress = this.CreateNewRegressionObject();
			IMultivariateCalibrationModel model = this.GetCalibrationModel(table);
			regress.SetCalibrationModel(model);
			return regress.GetPredictionScores(preferredNumberOfFactors);
		}
コード例 #57
0
ファイル: StatisticCommands.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Creates a statistical table for Statistics on Rows.
		/// </summary>
		/// <returns></returns>
		private static DataTable CreateStatisticalTable()
		{
			DataTable result = new DataTable();

			result.DataColumns.Add(new DoubleColumn(), DefaultRowNumberColumnName, ColumnKind.X, 0);
			AddStatisticColumns(result);
			return result;
		}
コード例 #58
0
    /// <summary>
    /// Makes a PCA (a principal component analysis) of the table or the selected columns / rows and stores the results in a newly created table.
    /// </summary>
    /// <param name="mainDocument">The main document of the application.</param>
    /// <param name="srctable">The table where the data come from.</param>
    /// <param name="selectedColumns">The selected columns.</param>
    /// <param name="selectedRows">The selected rows.</param>
    /// <param name="bHorizontalOrientedSpectrum">True if a spectrum is a single row, False if a spectrum is a single column.</param>
    /// <param name="maxNumberOfFactors">The maximum number of factors to calculate.</param>
    /// <returns></returns>
    public static string PrincipalComponentAnalysis(
      Altaxo.AltaxoDocument mainDocument,
      Altaxo.Data.DataTable srctable,
      IAscendingIntegerCollection selectedColumns,
      IAscendingIntegerCollection selectedRows,
      bool bHorizontalOrientedSpectrum,
      int maxNumberOfFactors
      )
    {
      bool bUseSelectedColumns = (null!=selectedColumns && 0!=selectedColumns.Count);
      int prenumcols = bUseSelectedColumns ? selectedColumns.Count : srctable.DataColumns.ColumnCount;
      
      // check for the number of numeric columns
      int numcols = 0;
      for(int i=0;i<prenumcols;i++)
      {
        int idx = bUseSelectedColumns ? selectedColumns[i] : i;
        if(srctable[i] is Altaxo.Data.INumericColumn)
          numcols++;
      }

      // check the number of rows
      bool bUseSelectedRows = (null!=selectedRows && 0!=selectedRows.Count);

      int numrows;
      if(bUseSelectedRows)
        numrows = selectedRows.Count;
      else
      {
        numrows = 0;
        for(int i=0;i<numcols;i++)
        {
          int idx = bUseSelectedColumns ? selectedColumns[i] : i;
          numrows = Math.Max(numrows,srctable[idx].Count);
        }     
      }

      // check that both dimensions are at least 2 - otherwise PCA is not possible
      if(numrows<2)
        return "At least two rows are neccessary to do Principal Component Analysis!";
      if(numcols<2)
        return "At least two numeric columns are neccessary to do Principal Component Analysis!";

      // Create a matrix of appropriate dimensions and fill it

      MatrixMath.BEMatrix matrixX;
      if(bHorizontalOrientedSpectrum)
      {
        matrixX = new MatrixMath.BEMatrix(numrows,numcols);
        int ccol = 0; // current column in the matrix
        for(int i=0;i<prenumcols;i++)
        {
          int colidx = bUseSelectedColumns ? selectedColumns[i] : i;
          Altaxo.Data.INumericColumn col = srctable[colidx] as Altaxo.Data.INumericColumn;
          if(null!=col)
          {
            for(int j=0;j<numrows;j++)
            {
              int rowidx = bUseSelectedRows ? selectedRows[j] : j;
              matrixX[j,ccol] = col[rowidx];
            }
            ++ccol;
          }
        }
      } // end if it was a horizontal oriented spectrum
      else // if it is a vertical oriented spectrum
      {
        matrixX = new MatrixMath.BEMatrix(numcols,numrows);
        int ccol = 0; // current column in the matrix
        for(int i=0;i<prenumcols;i++)
        {
          int colidx = bUseSelectedColumns ? selectedColumns[i] : i;
          Altaxo.Data.INumericColumn col = srctable[colidx] as Altaxo.Data.INumericColumn;
          if(null!=col)
          {
            for(int j=0;j<numrows;j++)
            {
              int rowidx = bUseSelectedRows ? selectedRows[j] : j;
              matrixX[ccol,j] = col[rowidx];
            }
            ++ccol;
          }
        }
      } // if it was a vertical oriented spectrum

      // now do PCA with the matrix
      MatrixMath.REMatrix factors = new MatrixMath.REMatrix(0,0);
      MatrixMath.BEMatrix loads = new MatrixMath.BEMatrix(0,0);
      MatrixMath.BEMatrix residualVariances = new MatrixMath.BEMatrix(0,0);
      MatrixMath.HorizontalVector meanX = new MatrixMath.HorizontalVector(matrixX.Columns);
      // first, center the matrix
      MatrixMath.ColumnsToZeroMean(matrixX,meanX);
      MatrixMath.NIPALS_HO(matrixX,maxNumberOfFactors,1E-9,factors,loads,residualVariances);

      // now we have to create a new table where to place the calculated factors and loads
      // we will do that in a vertical oriented manner, i.e. even if the loads are
      // here in horizontal vectors: in our table they are stored in (vertical) columns
      Altaxo.Data.DataTable table = new Altaxo.Data.DataTable("PCA of " + srctable.Name);

      // Fill the Table
      table.Suspend();

      // first of all store the meanscore
    {
      double meanScore = MatrixMath.LengthOf(meanX);
      MatrixMath.NormalizeRows(meanX);
    
      Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
      for(int i=0;i<factors.Rows;i++)
        col[i] = meanScore;
      table.DataColumns.Add(col,"MeanFactor",Altaxo.Data.ColumnKind.V,0);
    }

      // first store the factors
      for(int i=0;i<factors.Columns;i++)
      {
        Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
        for(int j=0;j<factors.Rows;j++)
          col[j] = factors[j,i];
        
        table.DataColumns.Add(col,"Factor"+i.ToString(),Altaxo.Data.ColumnKind.V,1);
      }

      // now store the mean of the matrix
    {
      Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
      
      for(int j=0;j<meanX.Columns;j++)
        col[j] = meanX[0,j];
      table.DataColumns.Add(col,"MeanLoad",Altaxo.Data.ColumnKind.V,2);
    }

      // now store the loads - careful - they are horizontal in the matrix
      for(int i=0;i<loads.Rows;i++)
      {
        Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
        
        for(int j=0;j<loads.Columns;j++)
          col[j] = loads[i,j];
        
        table.DataColumns.Add(col,"Load"+i.ToString(),Altaxo.Data.ColumnKind.V,3);
      }

      // now store the residual variances, they are vertical in the vector
    {
      Altaxo.Data.DoubleColumn col = new Altaxo.Data.DoubleColumn();
      
      for(int i=0;i<residualVariances.Rows;i++)
        col[i] = residualVariances[i,0];
      table.DataColumns.Add(col,"ResidualVariance",Altaxo.Data.ColumnKind.V,4);
    }

      table.Resume();
      mainDocument.DataTableCollection.Add(table);
      // create a new worksheet without any columns
      Current.ProjectService.CreateNewWorksheet(table);

      return null;
    }
コード例 #59
0
ファイル: StatisticCommands.cs プロジェクト: Altaxo/Altaxo
		private static void AddSourcePropertyColumns(DataTable srctable, IAscendingIntegerCollection selectedColumns, DataTable destinationTable)
		{
			bool bUseSelectedColumns = (null != selectedColumns && 0 != selectedColumns.Count);
			int numcols = bUseSelectedColumns ? selectedColumns.Count : srctable.DataColumnCount;

			// new : add a copy of all property columns; can be usefull
			for (int i = 0; i < srctable.PropertyColumnCount; i++)
			{
				DataColumn originalColumn = srctable.PropertyColumns[i];
				DataColumn clonedColumn = (DataColumn)originalColumn.Clone();
				clonedColumn.Clear();
				for (int si = 0; si < numcols; si++)
				{
					int idx = bUseSelectedColumns ? selectedColumns[si] : si;
					clonedColumn[si] = originalColumn[idx];
				}
				destinationTable.DataColumns.Add(clonedColumn, srctable.PropertyColumns.GetColumnName(i), srctable.PropertyColumns.GetColumnKind(i), srctable.PropertyColumns.GetColumnGroup(i));
			}
		}
コード例 #60
0
    public  static WorksheetAnalysis GetAnalysis(DataTable table)
    {
      MultivariateContentMemento plsMemo = table.GetTableProperty("Content") as MultivariateContentMemento;

      if(plsMemo==null)
        throw new ArgumentException("Table does not contain a PLSContentMemento");
  
      return plsMemo.Analysis;
    }