//    class TaskMeasureSetting1
  //            extends SwingWorker {
  //
  //        MeasurementPlotter mPlot;
  //
  //
  //        public TaskMeasureSetting1(MeasurementPlotter mPlot) {
  //            this.mPlot = mPlot;
  //        }
  //
  //
  //        final MultiSectorMeasurer acquireImageAndMeasure = new MultiSectorMeasurer();
  //
  //
  //        @Override
  //        public Object doInBackground() {
  //
  //            System.out.println("measure setting 1");
  //            int step = (int) ((SLMConstants.startMax - SLMConstants.startMin) /
  // SLMConstants.numPoints);
  //            for (int s = 0; s < SLMConstants.numPoints; s++) { // for each setting
  //                int setTo = (int) (SLMConstants.startMin + s * step);
  //                for (int i = 0; i < numIDs; i++) { //for each sector
  //                    settings[i] = setTo;
  //                }
  //                acquireImageAndMeasure.run();
  //                for (int i = 0; i < numIDs; i++) {
  //                    mPlot.recordData(i, s, measurements[i]);
  //                }
  //
  //            }
  //            return null;
  //        }
  //
  //
  //    }
  private void matchSettingN(int n, MeasurementPlotter mPlot) {

    double[] a = new double[numIDs];
    double[] b = new double[numIDs];

    this.setup(Layer.retarderA);
    for (int i = 0; i < a.length; i++) {
      a[i] = slmCtrl.settings.retardSetA[n][i] - SLMModel.deltaExtinct;
      b[i] = slmCtrl.settings.retardSetA[n][i] + SLMModel.deltaExtinct;
    }
    this.minimizeToTargets(a, b, slmModel.getTolCoarse(), measuredIntensity1, mPlot);
    slmCtrl.setCalibratedRetarderASettings(n, this.getSettings());

    this.setup(Layer.retarderB);
    for (int i = 0; i < a.length; i++) {
      a[i] = slmCtrl.settings.retardSetB[n][i] - SLMModel.deltaExtinct;
      b[i] = slmCtrl.settings.retardSetB[n][i] + SLMModel.deltaExtinct;
    }
    this.minimizeToTargets(a, b, slmModel.getTolCoarse(), measuredIntensity1, mPlot);
    slmCtrl.setCalibratedRetarderBSettings(n, this.getSettings());
    // @todo repeat with tolFine
  }
 public void findExtinctionB(MeasurementPlotter mPlot, double[] a, double[] b, double tol) {
   double[] targets = new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0};
   this.setup(Layer.retarderB);
   this.minimizeToTargets(a, b, tol, targets, mPlot);
   slmCtrl.setCalibratedRetarderBSettings(0, this.getSettings());
 }