0.98
0.005
0.005
0.02

Es werden nur die ersten vier Zeilen gelesen. Die Parameter sind:

minreflectance
maxpeak
minpeak
max./min. Verkippung in % R pro 1000 nm

Der Algorithmus:

			spectrum.LimitBandwidth = true;
			DataSet reflectance = spectrum.Intensity / spectrum.Background.Intensity;

			List<int> indices = reflectance.Find('x', '<', 1050.0);
			reflectance.RemoveAt(indices);
			indices = reflectance.Find('x', '>', 1850.0);
			reflectance.RemoveAt(indices);


			DataSet ds = reflectance.LinearRegressionCurve();
			Console.WriteLine("Spectrum evaluation: Max(R) = {0}, Min(R) = {1}, LinReg_Max(R) = {2}, LinReg_Min(R) = {3}", 
			                  reflectance.YMax(), reflectance.YMin(), ds.YMax(), ds.YMin());

			string dirname = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

			CultureInfo culture = new CultureInfo("en-US");
			double minreflectance, maxpeak, minpeak;
			double slope_limit;

			using (TextReader reader = new StreamReader(Path.Combine(dirname, "parameter.txt")))
			{
				minreflectance = double.Parse(reader.ReadLine(), culture);
				maxpeak = double.Parse(reader.ReadLine(), culture);
				minpeak = double.Parse(reader.ReadLine(), culture);
				slope_limit = double.Parse(reader.ReadLine(), culture);
			}

			if (reflectance.YMin() < minreflectance)
				return SpectrumEvaluation.Red;

			if ((reflectance - ds).YMax() > maxpeak || (reflectance - ds).YMin() < -minpeak)
				return SpectrumEvaluation.Red;

			double actual_slope = ds.LinearRegression().Slope * 1000.0;

			if (actual_slope > slope_limit || actual_slope < -slope_limit)
				return SpectrumEvaluation.Red;



			return SpectrumEvaluation.Green;
