Beispiel #1
0
        protected LorentzianFit FitUsingDataForBestGuess(double[] rampData, double[] scanData)
        {
            double        background   = scanData.Min();
            double        maximum      = scanData.Max();
            double        amplitude    = maximum - background;
            double        centre       = rampData[Array.IndexOf(scanData, maximum)];
            double        width        = (rampData.Max() - rampData.Min()) / 20;
            LorentzianFit bestGuessFit = new LorentzianFit(background, amplitude, centre, width);

            return(CavityScanFitHelper.FitLorentzianToData(rampData, scanData, bestGuessFit));
        }
Beispiel #2
0
 private void updateGUIForMasterLaser(MasterLaser laser, double[] rampData)
 {
     double[] laserScanData = laser.LatestScanData;
     if (laser.Fit != null)
     {
         double[] fitPoints = CavityScanFitHelper.CreatePointsFromFit(rampData, laser.Fit);
         ui.DisplayMasterData(laser.ParentCavity.Name, rampData, laserScanData, fitPoints);
         if (laser.IsLocked)
         {
             double summedVoltage = laser.CurrentVoltage;
             ui.SetSummedVoltageTextBox(laser.ParentCavity.Name, summedVoltage);
             ui.SetVoltageIntoCavityTextBox(laser.ParentCavity.Name, summedVoltage + laser.Fit.Centre);
         }
     }
     else
     {
         ui.DisplayMasterData(laser.ParentCavity.Name, rampData, laserScanData);
     }
 }
Beispiel #3
0
 private void updateGUIForSlaveLaser(SlaveLaser laser, double[] rampData)
 {
     double[] laserScanData = laser.LatestScanData;
     if (laser.Fit != null)
     {
         double[] fitPoints = CavityScanFitHelper.CreatePointsFromFit(rampData, laser.Fit);
         ui.DisplaySlaveData(laser.ParentCavity.Name, laser.Name, rampData, laserScanData, fitPoints);
         if (laser.LockCount > 0)
         {
             ui.SetLaserVoltageTextBox(laser.ParentCavity.Name, laser.Name, laser.CurrentVoltage);
             bool laserInNormalOperatingRange = laser.CurrentVoltage <laser.UpperVoltageLimit && laser.CurrentVoltage> laser.LowerVoltageLimit;
             bool laserIsLocked = laser.lState == Laser.LaserState.LOCKED;
             ui.SetLaserOperatingLED(laser.ParentCavity.Name, laser.Name, laserIsLocked, laserInNormalOperatingRange);
             List <double> errorList   = laser.OldFrequencyErrors;
             double        standardDev = Math.Sqrt(errorList.Average(x => x * x));
             ui.SetLaserSDTextBox(laser.ParentCavity.Name, laser.Name, standardDev);
             ui.AppendToErrorGraph(laser.ParentCavity.Name, laser.Name, laser.LockCount, laser.FrequencyError);
         }
     }
     else
     {
         ui.DisplaySlaveData(laser.ParentCavity.Name, laser.Name, rampData, laserScanData);
     }
 }
Beispiel #4
0
 private void plotSlave(string name, CavityScanData data, double[] slaveFit)
 {
     double[] cavity = data.GetCavityData();
     double[] slave  = data.GetSlaveData(name);
     ui.DisplaySlaveData(name, cavity, slave, CavityScanFitHelper.CreatePointsFromFit(cavity, slaveFit));
 }
Beispiel #5
0
 private double[] fitSlave(string name, CavityScanData data)
 {
     return(CavityScanFitHelper.FitLorenzianToData(data.GetCavityData(), data.GetSlaveData(name)));
 }
Beispiel #6
0
 private void plotMaster(CavityScanData data, double[] MasterFit)
 {
     double[] cavity = data.GetCavityData();
     double[] master = data.GetMasterData();
     ui.DisplayMasterData(cavity, master, CavityScanFitHelper.CreatePointsFromFit(cavity, MasterFit));
 }
Beispiel #7
0
 private double[] fitMaster(CavityScanData data)
 {
     return(CavityScanFitHelper.FitLorenzianToData(data.GetCavityData(), data.GetMasterData()));
 }
Beispiel #8
0
 protected LorentzianFit FitWithPreviousAsBestGuess(double[] rampData, double[] scanData)
 {
     return(CavityScanFitHelper.FitLorentzianToData(rampData, scanData, Fit));
 }
Beispiel #9
0
 private double[] fastfitSlave(string name, CavityScanData data, double[] SlaveFitParams)
 {
     return(CavityScanFitHelper.FitLorenzianToData(data.GetCavityData(), data.GetSlaveData(name), SlaveFitParams, config.PointsToConsiderEitherSideOfPeakInFWHMs, config.MaximumNLMFSteps));
 }
Beispiel #10
0
 private double[] fastfitMaster(CavityScanData data, double[] masterFitParams)
 {
     return(CavityScanFitHelper.FitLorenzianToData(data.GetCavityData(), data.GetMasterData(), masterFitParams, config.PointsToConsiderEitherSideOfPeakInFWHMs, config.MaximumNLMFSteps));
 }