Esempio n. 1
0
		/// <summary>
		/// Plots the PRESS value into a provided layer.
		/// </summary>
		/// <param name="table">The table of PLS output data.</param>
		public static void PlotPRESSValue(Altaxo.Data.DataTable table)
		{
			string newName = string.Format("GPRESS");
			var graphctrl = CreateNewGraphWithXYLayer(table.GetPropertyContext(), Main.ProjectFolder.CreateFullName(table.Name, newName), table.Name);
			PlotPRESSValue(table, graphctrl.Doc.GetFirstXYPlotLayer());
		}
Esempio n. 2
0
		/// <summary>
		/// Plots the cross prediction values of all y components invidually in a  graph.
		/// </summary>
		/// <param name="table">The table with the PLS model data.</param>
		/// <param name="allowGuiForMessages">If <see langword="true"/> and an error occurs, an error message box is presented to the user.</param>
		public static void PlotCrossPredictedVersusActualY(Altaxo.Data.DataTable table, bool allowGuiForMessages)
		{
			MultivariateContentMemento plsMemo = table.GetTableProperty("Content") as MultivariateContentMemento;
			if (plsMemo == null)
			{
				string msg = string.Format("The table <<{0}>> does not seem to contain multivariate analysis data (content memento is missing)", table.Name);
				if (allowGuiForMessages)
					Current.Gui.ErrorMessageBox(msg);
				else
					throw new ApplicationException(msg);
				return;
			}
			while (!Current.Project.DataTableCollection.Contains(plsMemo.OriginalDataTableName))
			{
				string msg = string.Format("The table of the original spectral data <<{0}>> does not exist (renamed?)", plsMemo.OriginalDataTableName);
				if (allowGuiForMessages)
				{
					Current.Gui.ErrorMessageBox(msg);
					string newName = plsMemo.OriginalDataTableName;
					// TODO replace by a TableChoiceDialogBox
					if (Current.Gui.ShowDialog(ref newName, "Please enter the table name of original spectral data", false))
						plsMemo.OriginalDataTableName = newName;
				}
				else
					throw new WorksheetAnalysis.OriginalDataTableNotFoundException(msg);
			}

			if (plsMemo.PreferredNumberOfFactors <= 0)
				QuestPreferredNumberOfFactors(plsMemo);

			for (int nComponent = 0; nComponent < plsMemo.NumberOfConcentrationData; nComponent++)
			{
				string newName = string.Format("GCrossPredVsActC{0}#{1}F", nComponent, plsMemo.PreferredNumberOfFactors);
				var graphctrl = CreateNewGraphWithXYLayer(table.GetPropertyContext(), Main.ProjectFolder.CreateFullName(table.Name, newName), table.Name);
				PlotCrossPredictedVersusActualY(table, graphctrl.Doc.GetFirstXYPlotLayer(), nComponent, plsMemo.PreferredNumberOfFactors);
			}
		}
Esempio n. 3
0
		/// <summary>
		/// Plots the x (spectral) residuals (of cross prediction) of all spectra invidually in a graph.
		/// </summary>
		/// <param name="table">The table with the PLS model data.</param>
		public static void PlotXCrossResiduals(Altaxo.Data.DataTable table)
		{
			MultivariateContentMemento plsMemo = table.GetTableProperty("Content") as MultivariateContentMemento;
			if (plsMemo == null)
				return;
			if (plsMemo.PreferredNumberOfFactors <= 0)
				QuestPreferredNumberOfFactors(plsMemo);

			for (int nComponent = 0; nComponent < plsMemo.NumberOfConcentrationData; nComponent++)
			{
				string newName = string.Format("GXCrossResidualsC{0}#{1}F", nComponent, plsMemo.PreferredNumberOfFactors);
				var graphctrl = CreateNewGraphWithXYLayer(table.GetPropertyContext(), Main.ProjectFolder.CreateFullName(table.Name, newName), table.Name);
				PlotXResiduals(table, graphctrl.Doc.GetFirstXYPlotLayer(), nComponent, plsMemo.PreferredNumberOfFactors);
			}
		}
Esempio n. 4
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);

			string newName = string.Format("GXLeverage#{0}F", plsMemo.PreferredNumberOfFactors);
			newName = Main.ProjectFolder.CreateFullName(table.Name, newName);

			var graphctrl = CreateNewGraphWithXYLayer(table.GetPropertyContext(), Main.ProjectFolder.CreateFullName(table.Name, newName), table.Name);
			PlotXLeverage(table, graphctrl.Doc.GetFirstXYPlotLayer(), plsMemo.PreferredNumberOfFactors);
		}