Exemple #1
0
        void button_Click(object sender, EventArgs e)
        {
            int     index   = (int)((Button)sender).Tag;
            TextBox textBox = this._textBoxes[index];
            var     param   = this._parameters[index];

            object value = param.Type.FromString(new FromStringArgs(this._core, textBox.Text));   // error ignored

            value = param.Type.Browse(this, this._core, value);

            if (value == null)
            {
                return;
            }

            textBox.Text = AlgoParameterCollection.ParamToString(value);
        }
Exemple #2
0
        /// <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));
        }