/// <summary> /// Button: Load /// </summary> private void _btnLoad_Click_1(object sender, EventArgs e) { ClusterEvaluationPointer res = this.PickResults(); if (res == null) { return; } ClusterEvaluationResults set = FrmWait.Show(this, "Loading results", null, z => this.LoadResults(res.FileName, z)); if (res.Configuration == null) { // The results didn't have known config, they do now! this._core.EvaluationResultFiles.Remove(res); this._core.EvaluationResultFiles.Add(new ClusterEvaluationPointer(res.FileName, set.Configuration)); FrmMsgBox.ShowInfo(this, "Imported results", "The details on this result set have been imported into the current session. You will have to save the session to view these details in future.", FrmMsgBox.EDontShowAgainId.ImportResultsDetailNotice); } if (set != null) { this.SelectResults(res.FileName, set); } }
private void findInexplorerToolStripMenuItem_Click(object sender, EventArgs e) { ClusterEvaluationPointer res = this.PickResults(); if (res == null) { return; } UiControls.ExploreTo(this, res.FileName); }
private ClusterEvaluationPointer PickResults() { if (this._core.EvaluationResultFiles.Count == 0) { MsgBoxButton[] buttons = { new MsgBoxButton("Create", Resources.MnuAccept, DialogResult.Yes), new MsgBoxButton("Import", Resources.MnuFile, DialogResult.No), new MsgBoxButton("Cancel", Resources.MnuAccept, DialogResult.Cancel), }; switch (FrmMsgBox.Show(this, "Select Test", null, "It appears you don't have any tests! Would you like to create a new one?", Resources.MsgHelp, buttons)) { case DialogResult.Yes: this._btnNew.PerformClick(); return(null); case DialogResult.No: this.importToolStripMenuItem.PerformClick(); return(null); default: case DialogResult.Cancel: return(null); } } ClusterEvaluationPointer res = DataSet.ForTests(this._core).ShowButtons(this, null); if (res == null) { return(null); } if (!res.HasResults) { FrmMsgBox.ShowError(this, "Load Data", "This test has not yet been run!"); return(null); } return(res); }
internal static ClusterEvaluationPointer Show(Form owner, Core core, ClusterEvaluationPointer options, bool readOnly) { ClusterEvaluationConfiguration config; if (options == null) { config = null; } else { config = options.Configuration; if (config == null) { if (!FrmMsgBox.ShowOkCancel(owner, "Open Configuration", "The selected configuration has been saved to disk and must be loaded before it is viewed or modified.")) { return(null); } config = FrmWait.Show <ClusterEvaluationResults>(owner, "Loading results", null, z => FrmActEvaluate.LoadResults(core, options.FileName, z))?.Configuration; if (config == null) { return(null); } } } using (FrmEvaluateClusteringOptions frm = new FrmEvaluateClusteringOptions(core, config, readOnly)) { if (UiControls.ShowWithDim(owner, frm) == DialogResult.OK) { return(frm.GetSelection()); } } return(null); }
/// <summary> /// Saves results to file /// /// Returns pointer (unless originalPointer is NULL, in which case the action is assumed to be an export and is ignored). /// </summary> private static ClusterEvaluationPointer SaveResults(Core core, string fileName, ClusterEvaluationPointer originalPointer, ClusterEvaluationResults results, ProgressReporter proggy) { LookupByGuidSerialiser guidS = core.GetLookups(); proggy.Enter("Saving results"); XmlSettings.Save <ClusterEvaluationResults>(fileName, results, guidS, proggy); if (core.SetLookups(guidS)) { // UIDs have changed SaveSession(core, proggy); } proggy.Leave(); if (originalPointer == null) { return(null); } return(new ClusterEvaluationPointer(fileName, originalPointer.Configuration)); }
/// <summary> /// Actual test running /// </summary> private static ClusterEvaluationPointer RunTest(Core core, ClusterEvaluationPointer origPointer, ClusterEvaluationConfiguration test, ProgressReporter proggy, bool paranoid, int index, int of) { UiControls.Assert(core.FileNames.Session != null, "Didn't expect the session filename to be null for cluster evaluation."); List <ClusterEvaluationParameterResult> results = new List <ClusterEvaluationParameterResult>(); // Iterate over parameters for (int valueIndex = 0; valueIndex < test.ParameterValues.Length; valueIndex++) { object value = test.ParameterValues[valueIndex]; List <ResultClusterer> repetitions = new List <ResultClusterer>(); // Iterate over repetitions for (int repetition = 0; repetition < test.NumberOfRepeats; repetition++) { proggy.Enter("Test " + index + "/" + of + ", parameter " + valueIndex + "/" + test.ParameterValues.Length + ", repetition " + repetition + "/" + test.NumberOfRepeats); // Create config string newName = AlgoParameterCollection.ParamToString(value) + " " + StringHelper.Circle(repetition + 1); object[] copyOfParameters = test.ClustererConfiguration.Parameters.ToArray(); copyOfParameters[test.ParameterIndex] = value; ArgsClusterer copyOfArgs = new ArgsClusterer( test.ClustererConfiguration.Id, test.ClustererConfiguration.SourceProvider, test.ClustererConfiguration.PeakFilter, test.ClustererConfiguration.Distance, test.ClustererConfiguration.ObsFilter, test.ClustererConfiguration.SplitGroups, test.ClustererConfiguration.Statistics, copyOfParameters, test.ClustererConfiguration.OverrideShortName) { OverrideDisplayName = newName, Comment = test.ClustererConfiguration.Comment }; var copyOfConfig = new ConfigurationClusterer() { Args = copyOfArgs }; // Try load previus result ResultClusterer result = null; if (paranoid) { result = TryLoadIntermediateResult(core, test.Guid, valueIndex, repetition, proggy); } if (result == null) { // DO CLUSTERING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! proggy.Enter("Clustering"); result = copyOfConfig.Cluster(core, 0, proggy); proggy.Leave(); if (paranoid) { SaveIntermediateResult(core, test.Guid, valueIndex, repetition, result, proggy); } } // Add result repetitions.Add(result); string name = AlgoParameterCollection.ParamToString(value); results.Add(new ClusterEvaluationParameterResult(name, test, valueIndex, repetitions)); proggy.Leave(); } } ClusterEvaluationResults final = new ClusterEvaluationResults(core, test, results); string folder = UiControls.GetOrCreateFixedFolder(UiControls.EInitialFolder.Evaluations); string sessionName = Path.GetFileNameWithoutExtension(core.FileNames.Session); string fileName = core.Options.ClusteringEvaluationResultsFileName; fileName = fileName.Replace("{SESSION}", sessionName); fileName = fileName.Replace("{RESULTS}", folder + "\\"); fileName = UiControls.GetNewFile(fileName); return(SaveResults(core, fileName, origPointer, final, proggy)); }