GetTofFitDataSelection() public method

public GetTofFitDataSelection ( ) : int
return int
Esempio n. 1
0
        private void FitAverageTOF()
        {
            Scan averageScan = Controller.GetController().DataStore.AverageScan;
            TOF  tof;

            if (window.GetTofFitDataSelection() == 0)
            {
                tof = (TOF)((ArrayList)averageScan.GetGatedAverageOnShot(
                                startSpectrumGate,
                                endSpectrumGate).TOFs)[0];
            }
            else
            {
                if (((ScanPoint)(averageScan.Points[0])).OffShots.Count == 0)
                {
                    return;                                                           //make sure there are some offshots
                }
                tof = (TOF)((ArrayList)averageScan.GetGatedAverageOffShot(
                                startSpectrumGate,
                                endSpectrumGate).TOFs)[0];
            }
            double[] doubleTimes = new double[tof.Times.Length];
            for (int i = 0; i < tof.Times.Length; i++)
            {
                doubleTimes[i] = (double)tof.Times[i];
            }
            tofFitter.Fit(
                doubleTimes,
                tof.Data,
                tofFitter.SuggestParameters(
                    doubleTimes,
                    tof.Data,
                    tof.Times[0],
                    tof.Times[tof.Times.Length - 1])
                );
            window.ClearTOFFit();
            window.PlotTOFFit(tof.GateStartTime, tof.ClockPeriod, tofFitter.FittedValues);
            // update the parameter report
            window.SetLabel(window.tofFitResultsLabel, tofFitter.ParameterReport);
        }