public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Data.DataTable dataTable = ctrl.DataTable; if (ctrl.SelectedPropertyColumns.Count == 0) { return; } m_Column = dataTable.PropertyColumns[ctrl.SelectedPropertyColumns[0]]; IScriptText script = (IScriptText)dataTable.PropertyColumns.ColumnScripts[m_Column]; if (script == null) { script = new PropertyColumnScript(); } object[] args = new object[] { script, new ScriptExecutionHandler(this.EhScriptExecution) }; if (Current.Gui.ShowDialog(args, "PropertyColumnScript of " + m_Column.Name)) { if (null != dataTable.PropertyColumns.ColumnScripts[m_Column]) { dataTable.PropertyColumns.ColumnScripts[m_Column] = (IColumnScriptText)args[0]; } else { dataTable.PropertyColumns.ColumnScripts.Add(m_Column, args[0]); } } this.m_Column = null; }
public static void ImportAsciiToMultipleWorksheets(WorksheetController ctrl, string[] filenames) { int startrest=0; Array.Sort(filenames); // Windows seems to store the filenames reverse to the clicking order or in arbitrary order if(ctrl!=null) { using(System.IO.Stream myStream = new System.IO.FileStream(filenames[0],System.IO.FileMode.Open,System.IO.FileAccess.Read)) { ImportAscii(ctrl, myStream); myStream.Close(); startrest=1; } } // import also the other files, but this time we create new tables for(int i=startrest;i<filenames.Length;i++) { using(System.IO.Stream myStream = new System.IO.FileStream(filenames[i],System.IO.FileMode.Open,System.IO.FileAccess.Read)) { Altaxo.Worksheet.GUI.IWorksheetController newwkscontroller = Current.ProjectService.CreateNewWorksheet(); ImportAscii(newwkscontroller,myStream); myStream.Close(); } } // for all files }
public static void Rename(WorksheetController ctrl) { TextValueInputController tvctrl = new TextValueInputController(ctrl.Doc.Name,"Enter a name for the worksheet:"); tvctrl.Validator = new WorksheetRenameValidator(ctrl.Doc,ctrl); if(Current.Gui.ShowDialog(tvctrl,"Rename worksheet",false)) ctrl.Doc.Name = tvctrl.InputText.Trim(); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { string msg = Altaxo.Worksheet.Commands.EditCommands.XYVToMatrix(ctrl); if (msg != null) { Current.Gui.ErrorMessageBox(msg); } }
public static void Duplicate(WorksheetController ctrl) { Altaxo.Data.DataTable clonedTable = (Altaxo.Data.DataTable)ctrl.DataTable.Clone(); // find a new name for the cloned table and add it to the DataTableCollection clonedTable.Name = Data.DataTableCollection.GetParentDataTableCollectionOf(ctrl.DataTable).FindNewTableName(); Data.DataTableCollection.GetParentDataTableCollectionOf(ctrl.DataTable).Add(clonedTable); Current.ProjectService.CreateNewWorksheet(clonedTable); }
protected SDWorksheetViewContent(WorksheetController ctrl) { _controller = ctrl; _controller.DataColumnHeaderRightClicked += EhDataColumnHeaderRightClicked; _controller.DataRowHeaderRightClicked += EhDataRowHeaderRightClicked; _controller.PropertyColumnHeaderRightClicked += EhPropertyColumnHeaderRightClicked; _controller.TableHeaderRightClicked += EhTableHeaderRightClicked; _controller.OutsideAllRightClicked += EhOutsideAllRightClicked; _controller.TitleNameChanged += EhTitleNameChanged; }
/// <summary> /// Moves the selected rows to a new position <code>nPosition</code>. /// </summary> /// <param name="ctrl">The worksheet controller.</param> /// <param name="nPosition">The new position for the selected rows.</param> public static void SetSelectedRowPosition(WorksheetController ctrl, int nPosition) { if(ctrl.SelectedDataRows.Count>0) { ctrl.DataTable.DataColumns.ChangeRowPosition(ctrl.SelectedDataRows, nPosition); } ctrl.ClearAllSelections(); ctrl.UpdateTableView(); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { if (ctrl.SelectedDataColumns.Count > 0) { new OpenDataColumnScriptDialog().Run(ctrl); // Altaxo.Worksheet.Commands.ColumnCommands.SetColumnValues(ctrl); } else { new OpenPropertyColumnScriptDialog().Run(ctrl); } }
public static void SavitzkyGolayFiltering(WorksheetController ctrl) { if(ctrl.SelectedDataColumns.Count==0) return; object paramobject = new SavitzkyGolayParameters(); if(!Current.Gui.ShowDialog(ref paramobject,"Savitzky-Golay parameters")) return; SavitzkyGolayParameters parameters = (SavitzkyGolayParameters)paramobject; Altaxo.Data.DataColumn yCol = ctrl.Doc.DataColumns[ctrl.SelectedDataColumns[0]]; Altaxo.Data.DataColumn xCol = ctrl.Doc.DataColumns.FindXColumnOf(yCol); double spacing = 1; if(xCol is Data.INumericColumn) { Calc.LinearAlgebra.VectorSpacingEvaluator calcspace = new Calc.LinearAlgebra.VectorSpacingEvaluator(Calc.LinearAlgebra.DataColumnWrapper.ToROVector(xCol)); if(!calcspace.HasValidSpaces || calcspace.HasInvalidSpaces) { Current.Gui.ErrorMessageBox(string.Format("The x-column {0} contains invalid spaces (is not equally spaced)",xCol.Name)); return; } if(calcspace.RelativeSpaceDeviation>1E-2) { System.Windows.Forms.DialogResult dlgresult = System.Windows.Forms.MessageBox.Show(Current.MainWindow, string.Format("The x-column {0} is not equally spaced, the deviation is {1}, the mean spacing is {2}. Continue anyway?", xCol.Name, calcspace.RelativeSpaceDeviation, calcspace.SpaceMeanValue), "Continue?",System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question, System.Windows.Forms.MessageBoxDefaultButton.Button1); if(dlgresult==System.Windows.Forms.DialogResult.No) return; } spacing = calcspace.SpaceMeanValue; } Calc.Regression.SavitzkyGolay filter = new SavitzkyGolay(parameters); yCol.Suspend(); filter.Apply(DataColumnWrapper.ToROVectorCopy(yCol),DataColumnWrapper.ToVector(yCol)); if(parameters.DerivativeOrder>0) { double factor = Math.Pow(1/spacing,parameters.DerivativeOrder)*Calc.GammaRelated.Fac(parameters.DerivativeOrder); yCol.Data = yCol*factor; } yCol.Resume(); }
public static void SaveAs(WorksheetController ctrl, bool saveAsTemplate) { System.IO.Stream myStream ; SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "Altaxo worksheet files (*.axowks)|*.axowks|All files (*.*)|*.*" ; saveFileDialog1.FilterIndex = 1 ; saveFileDialog1.RestoreDirectory = true ; if(saveFileDialog1.ShowDialog() == DialogResult.OK) { if((myStream = saveFileDialog1.OpenFile()) != null) { Save(ctrl,myStream, saveAsTemplate); myStream.Close(); } } }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { m_Table = ctrl.DataTable; ExtractTableDataScript script = ctrl.DataTable.GetTableProperty(ExtractTableDataScriptPropertyName) as ExtractTableDataScript; if (script == null) { script = new ExtractTableDataScript(); } object[] args = new object[] { script, new ScriptExecutionHandler(this.EhScriptExecution) }; if (Current.Gui.ShowDialog(args, "WorksheetScript of " + m_Table.Name)) { m_Table.SetTableProperty(ExtractTableDataScriptPropertyName, args[0]); } this.m_Table = null; }
/// <summary> /// Renames the selected data column or property column. /// </summary> /// <param name="ctrl">The worksheet controller for the table.</param> public static void RenameSelectedColumn(WorksheetController ctrl) { if(ctrl.SelectedDataColumns.Count==1 && ctrl.SelectedPropertyColumns.Count==0) { Altaxo.Data.DataColumn col = ctrl.Doc.DataColumns[ctrl.SelectedDataColumns[0]]; TextValueInputController tvctrl = new TextValueInputController(col.Name,"new column name:"); tvctrl.Validator = new DataColumnRenameValidator(col,ctrl); if(Current.Gui.ShowDialog(tvctrl,"Rename column",false)) ctrl.Doc.DataColumns.SetColumnName(col,tvctrl.InputText); } if(ctrl.SelectedDataColumns.Count==0 && ctrl.SelectedPropertyColumns.Count==1) { Altaxo.Data.DataColumn col = ctrl.Doc.PropCols[ctrl.SelectedPropertyColumns[0]]; TextValueInputController tvctrl = new TextValueInputController(col.Name,"new property column name:"); tvctrl.Validator = new PropertyColumnRenameValidator(col,ctrl); if(Current.Gui.ShowDialog(tvctrl,"Rename property column",false)) ctrl.Doc.PropCols.SetColumnName(col,tvctrl.InputText); } }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { m_Table = ctrl.DataTable; IScriptText script = m_Table.TableScript; if (script == null) { script = new TableScript(); } object[] args = new object[] { script, new Altaxo.Gui.Scripting.ScriptExecutionHandler(this.EhScriptExecution) }; if (Current.Gui.ShowDialog(args, "WorksheetScript of " + m_Table.Name)) { m_Table.TableScript = (TableScript)args[0]; } this.m_Table = null; }
public static void Save(WorksheetController ctrl, System.IO.Stream myStream, bool saveAsTemplate) { Altaxo.Serialization.Xml.XmlStreamSerializationInfo info = new Altaxo.Serialization.Xml.XmlStreamSerializationInfo(); if(saveAsTemplate) { info.SetProperty("Altaxo.Data.DataColumn.SaveAsTemplate","true"); } info.BeginWriting(myStream); // TODO there is an issue with TableLayout that prevents a nice deserialization // this is because TableLayout stores the name of its table during serialization // onto deserialization this works well if the entire document is restored, but // doesn't work if only a table and its layout is to be restored. In this case, the layout // references the already present table with the same name in the document instead of the table // deserialized. Also, the GUID isn't unique if the template is deserialized more than one time. Altaxo.Worksheet.TablePlusLayout tableAndLayout = new Altaxo.Worksheet.TablePlusLayout(ctrl.DataTable, ctrl.WorksheetLayout); info.AddValue("TablePlusLayout",tableAndLayout); info.EndWriting(); }
public static void FFT(WorksheetController dg) { int len = dg.SelectedDataColumns.Count; if(len==0) return; // nothing selected if(!(dg.DataTable[dg.SelectedDataColumns[0]] is Altaxo.Data.DoubleColumn)) return; // preliminary // we simply create a new column, copy the values Altaxo.Data.DoubleColumn col = (Altaxo.Data.DoubleColumn)dg.DataTable[dg.SelectedDataColumns[0]]; double[] arr=col.Array; FastHartleyTransform.RealFFT(arr,arr.Length); col.Array = arr; }
/// <summary> /// Moves the selected row(s) to a new position. The new position must be entered by the user. /// </summary> /// <param name="ctrl">The worksheet controller for the table.</param> public static string SetSelectedRowPosition(WorksheetController ctrl) { if(ctrl.SelectedDataRows.Count==0) return null; // nothing to do int newposition = int.MinValue; IntegerValueInputController ivictrl = new IntegerValueInputController(0,"Please enter the new position (>=0):"); ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator(); if(Current.Gui.ShowDialog(ivictrl,"New row position",false)) { newposition = ivictrl.EnteredContents; } else return null; SetSelectedRowPosition(ctrl,newposition); return null; }
public static void ExportGalacticSPC(WorksheetController ctrl) { Altaxo.Serialization.Galactic.ExportGalacticSpcFileDialog dlg = new Altaxo.Serialization.Galactic.ExportGalacticSpcFileDialog(); dlg.Initialize(ctrl.DataTable,ctrl.SelectedDataRows,ctrl.SelectedDataColumns); dlg.ShowDialog(ctrl.View.TableViewWindow); }
public static void ExportAscii(WorksheetController ctrl) { System.IO.Stream myStream ; SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "Text files (*.csv;*.dat;*.txt)|*.csv;*.dat;*.txt|All files (*.*)|*.*"; saveFileDialog1.FilterIndex = 1 ; saveFileDialog1.RestoreDirectory = true ; if(saveFileDialog1.ShowDialog() == DialogResult.OK) { if((myStream = saveFileDialog1.OpenFile()) != null) { try { Altaxo.Serialization.Ascii.AsciiExporter.ExportAscii(myStream, ctrl.DataTable,'\t'); } catch(Exception ex) { System.Windows.Forms.MessageBox.Show(ctrl.View.TableViewWindow,"There was an error during ascii export, details follow:\n" + ex.ToString()); } finally { myStream.Close(); } } } }
public static void ImportAscii(WorksheetController ctrl) { ImportAscii(ctrl,true); }
/// <summary> /// Insert a number of data rows into the controlled table. /// </summary> /// <param name="ctrl">The worksheet controller.</param> /// <param name="rowBeforeToInsert">Number of the row before which to insert the additional rows.</param> /// <param name="numberOfRows">Number of rows to insert.</param> public static void InsertDataRows(WorksheetController ctrl, int rowBeforeToInsert, int numberOfRows) { if (numberOfRows <= 0 || rowBeforeToInsert<0) return; ctrl.Doc.DataColumns.InsertRows(rowBeforeToInsert, numberOfRows); ctrl.ClearAllSelections(); ctrl.UpdateTableView(); }
/// <summary> /// Ask the user for the number of data rows to insert in a data table. /// </summary> /// <param name="ctrl">The worksheet controller.</param> /// <param name="rowBeforeToInsert">Number of the row before which to insert the rows.</param> public static void InsertDataRows(WorksheetController ctrl,int rowBeforeToInsert) { // ask for the number of rows to insert Altaxo.Gui.Common.IntegerValueInputController ictrl = new IntegerValueInputController(1, "Enter the number of rows to insert:"); if (Current.Gui.ShowDialog(ictrl, "Insert rows", false)) InsertDataRows(ctrl, rowBeforeToInsert, ictrl.EnteredContents); }
public static void PLSOnColumns(WorksheetController ctrl) { MultivariateAnalysisOptions options; SpectralPreprocessingOptions preprocessOptions; if(!QuestPLSAnalysisOptions(out options, out preprocessOptions)) return; WorksheetAnalysis analysis = (WorksheetAnalysis)System.Activator.CreateInstance(options.AnalysisMethod); string err= analysis.ExecuteAnalysis(Current.Project,ctrl.Doc,ctrl.SelectedDataColumns,ctrl.SelectedDataRows,ctrl.SelectedPropertyColumns,false,options,preprocessOptions); if(null!=err) System.Windows.Forms.MessageBox.Show(ctrl.View.TableViewForm,err,"An error occured"); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.ColumnCommands.ExtractPropertyValues(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.FourierCommands.FFT(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.FourierCommands.TwoDimensionalCenteredFFT(ctrl); }
/// <summary> /// Override this function for adding own worksheet commands. You will get /// the worksheet controller in the parameter. /// </summary> /// <param name="ctrl">The worksheet controller this command is applied to.</param> public abstract void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl);
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.RowCommands.InsertDataRows(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.RowCommands.SetSelectedRowPosition(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.ColumnCommands.RenameSelectedColumn(ctrl); }
public static void MultiplyColumnsToMatrix(WorksheetController ctrl) { string err = MultiplyColumnsToMatrix(Current.Project,ctrl.Doc,ctrl.SelectedDataColumns); if(null!=err) System.Windows.Forms.MessageBox.Show(ctrl.View.TableViewForm,err,"An error occured"); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.StatisticCommands.StatisticsOnRows(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.ColumnCommands.SetSelectedColumnGroupNumber(ctrl); }
/// <summary> /// This predicts the selected columns/rows against a user choosen calibration model. /// The spectra are presumed to be vertically oriented, i.e. each spectrum is in one column. /// </summary> /// <param name="ctrl">The worksheet controller containing the selected data.</param> public static void PredictOnColumns(WorksheetController ctrl) { PredictValues(ctrl,false); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.ChemometricCommands.MultiplyColumnsToMatrix(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.ColumnCommands.SetSelectedColumnAsKind(ctrl, Altaxo.Data.ColumnKind.mErr); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.ChemometricCommands.PLSOnRows(ctrl); }
/// <summary> /// Inserts a user choosen number of rows just before the first selected row. /// If no row is selected, the row is inserted before the first row. /// </summary> /// <param name="ctrl">The worksheet controller.</param> public static void InsertDataRows(WorksheetController ctrl) { if (ctrl.SelectedDataRows.Count > 0) InsertDataRows(ctrl, ctrl.SelectedDataRows[0]); else InsertDataRows(ctrl, 0); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.ChemometricCommands.PredictOnColumns(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.PlotCommands.PlotDensityImage(ctrl, true, true); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.ChemometricCommands.ExportPLSCalibration(ctrl.DataTable); }
public static void ImportAsciiToSingleWorksheet(WorksheetController ctrl, string[] filenames) { Array.Sort(filenames); // Windows seems to store the filenames reverse to the clicking order or in arbitrary order AsciiImporter.ImportMultipleAscii(filenames, ctrl.Doc); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.CalculusCommands.SavitzkyGolayFiltering(ctrl); }
public static void ImportAscii(WorksheetController ctrl, bool toMultipleWorksheets) { using(OpenFileDialog openFileDialog1 = new OpenFileDialog()) { openFileDialog1.Filter = "Text files (*.csv;*.dat;*.txt)|*.csv;*.dat;*.txt|All files (*.*)|*.*" ; openFileDialog1.FilterIndex = 1 ; openFileDialog1.RestoreDirectory = true ; openFileDialog1.Multiselect = true; if(openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileNames.Length>0) { if (toMultipleWorksheets) ImportAsciiToMultipleWorksheets(ctrl, openFileDialog1.FileNames); else ImportAsciiToSingleWorksheet(ctrl, openFileDialog1.FileNames); } } }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.CalculusCommands.Interpolation(ctrl); }
public static void ImportGalacticSPC(WorksheetController ctrl) { Altaxo.Serialization.Galactic.Import.ShowDialog(ctrl.View.TableViewForm, ctrl.DataTable); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.Analysis.CalculusCommands.MultivariateLinearFit(ctrl); }
public static void ImportImage(WorksheetController ctrl) { ImportImage(ctrl.DataTable); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.WorksheetCommands.Transpose(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.WorksheetCommands.CreatePropertyColumnOfColumnNames(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.FileCommands.ImportAscii(ctrl, false); }
public static void PCAOnColumns(WorksheetController ctrl) { int maxFactors = 3; IntegerValueInputController ivictrl = new IntegerValueInputController(maxFactors,"Please enter the maximum number of factors to calculate:"); ivictrl.Validator = new IntegerValueInputController.ZeroOrPositiveIntegerValidator(); if(Current.Gui.ShowDialog(ivictrl,"Set maximum number of factors",false)) { string err= PrincipalComponentAnalysis(Current.Project,ctrl.Doc,ctrl.SelectedDataColumns,ctrl.SelectedDataRows,false,ivictrl.EnteredContents); if(null!=err) Current.Gui.ErrorMessageBox(err); } }
/// <summary> /// Extracts the property values of the selected property columns. /// </summary> /// <param name="ctrl">The controller that controls the table.</param> public static void ExtractPropertyValues(WorksheetController ctrl) { for(int i=0;i<ctrl.SelectedPropertyColumns.Count;i++) { Altaxo.Data.DataColumn col = ctrl.DataTable.PropCols[ctrl.SelectedPropertyColumns[i]]; ExtractPropertiesFromColumn(col,ctrl.DataTable.PropCols); } ctrl.ClearAllSelections(); }
/// <summary> /// This predicts the selected columns/rows against a user choosen calibration model. /// The spectra are presumed to be horizontally oriented, i.e. each spectrum is in one row. /// </summary> /// <param name="ctrl">The worksheet controller containing the selected data.</param> public static void PredictOnRows(WorksheetController ctrl) { PredictValues(ctrl,true); }
public static LinearFitBySvd MultivariateLinearFit(WorksheetController ctrl) { return Calc.Regression.Multivariate.MultivariateLinearRegression.ShowDialogAndRegress(ctrl.Doc.DataColumns,ctrl.SelectedDataColumns); }
/// <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); } }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.WorksheetCommands.Duplicate(ctrl); }
public static void Interpolation(WorksheetController ctrl) { if(ctrl.SelectedDataColumns.Count==0) return; object paramobject = new InterpolationParameters(); if(!Current.Gui.ShowDialog(ref paramobject,"Interpolation")) return; InterpolationParameters parameters = (InterpolationParameters)paramobject; Altaxo.Data.DataColumn yCol = ctrl.Doc.DataColumns[ctrl.SelectedDataColumns[0]]; Altaxo.Data.DataColumn xCol = ctrl.Doc.DataColumns.FindXColumnOf(yCol); if(!(yCol is INumericColumn)) { Current.Gui.ErrorMessageBox("The selected column is not numeric!"); return; } if(!(xCol is INumericColumn)) { Current.Gui.ErrorMessageBox("The x-column of the selected column is not numeric!"); return; } int rows = Math.Min(xCol.Count,yCol.Count); IROVector yVec = DataColumnWrapper.ToROVector((INumericColumn)yCol,rows); IROVector xVec = DataColumnWrapper.ToROVector((INumericColumn)xCol,rows); parameters.InterpolationInstance.Interpolate(xVec,yVec); DoubleColumn xRes = new DoubleColumn(); DoubleColumn yRes = new DoubleColumn(); for(int i=0; i<parameters.NumberOfPoints;i++) { double r = i/(double)(parameters.NumberOfPoints-1); double x = parameters.XOrg*(1-r) + parameters.XEnd*(r); double y = ((IInterpolationFunction)parameters.InterpolationInstance).GetYOfX(x); xRes[i]=x; yRes[i]=y; } int newgroup = ctrl.DataTable.DataColumns.GetUnusedColumnGroupNumber(); ctrl.DataTable.DataColumns.Add(xRes,xCol.Name+".I",ColumnKind.X,newgroup); ctrl.DataTable.DataColumns.Add(yRes,yCol.Name+".I",ColumnKind.V,newgroup); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.WorksheetCommands.AddPropertyColumns(ctrl); }
public override void Run(Altaxo.Worksheet.GUI.WorksheetController ctrl) { Altaxo.Worksheet.Commands.FileCommands.SaveAs(ctrl, true); }
public DataColumnRenameValidator(Altaxo.Data.DataColumn col, WorksheetController ctrl) : base("The column name must not be empty! Please enter a valid name.") { m_Col = col; m_Ctrl = ctrl; }