public void calibrateCircularMask() { this.setup(Layer.circular); String filename = FileUtil.getcwd() + "/" + "Circular Mask Calibration" + ".dat"; MeasurementPlotter mPlot = new MeasurementPlotter( "Circular Mask Calibration", numIDs, filename, new Range(0, 254), new Rectangle(10, 10, 400, 300)); // minimize, i.e. find max. extinction double[] targets = new double[] {0, 0}; double[] a = new double[numIDs]; double[] b = new double[numIDs]; for (int i = 0; i < a.length; i++) { a[i] = (double) SLMModel.HuntRangeMasksMin_a; b[i] = (double) SLMModel.HuntRangeMasksMin_b; } this.minimizeToTargets(a, b, slmModel.getTolCoarse(), targets, mPlot); slmCtrl.setCircularExtinctSettings(this.getSettings()); // Maximize, i.e. fine max. transmission targets = new double[] {254, 254}; for (int i = 0; i < a.length; i++) { a[i] = (double) SLMModel.HuntRangeMasksMax_a; b[i] = (double) SLMModel.HuntRangeMasksMax_b; } this.minimizeToTargets(a, b, slmModel.getTolCoarse(), targets, mPlot); slmCtrl.setCircularTransmitSettings(this.getSettings()); }
public void setNominalSwing(int n) { for (int sector = 0; sector < slmCtrl.settings.retardSetA[0].length; sector++) { // setElement(0, extinctA, extinctB); // setElement(1, extinctA + LC_Swing, extinctB); // setElement(2, extinctA, extinctB + LC_Swing); // setElement(3, extinctA, extinctB - LC_Swing); // setElement(4, extinctA - LC_Swing, extinctB); // swing of 0.01 = 0.0628 shift in retardance // ??? Does swingEquivalent vary with Sector? Yes. double swingeAngle = slmModel.getSwing() * slmModel.getWavelength() * 2 * Math.PI; switch (n) { case 0: // Extinction, nominal 0.25, 0.50 // ++ >>>>>>>> default extinction settings // slmCtrl.settings.retardSetA[0][sector] = 1559; // slmCtrl.settings.retardSetB[0][sector] = 1559; slmCtrl.setRetA(sector, slmCtrl.settings.retardSetA[0][sector]); slmCtrl.setRetB(sector, slmCtrl.settings.retardSetB[0][sector]); break; case 1: slmCtrl.settings.retardSetA[1][sector] = slmCtrl.settings.retardSetA[0][sector] + swingeAngle; slmCtrl.settings.retardSetB[1][sector] = slmCtrl.settings.retardSetB[0][sector]; slmCtrl.setRetA(sector, slmCtrl.settings.retardSetA[1][sector]); slmCtrl.setRetB(sector, slmCtrl.settings.retardSetB[1][sector]); break; case 2: slmCtrl.settings.retardSetA[2][sector] = slmCtrl.settings.retardSetA[0][sector]; slmCtrl.settings.retardSetB[2][sector] = slmCtrl.settings.retardSetB[0][sector] + swingeAngle; slmCtrl.setRetA(sector, slmCtrl.settings.retardSetA[2][sector]); slmCtrl.setRetB(sector, slmCtrl.settings.retardSetB[2][sector]); break; case 3: slmCtrl.settings.retardSetA[3][sector] = slmCtrl.settings.retardSetA[0][sector]; slmCtrl.settings.retardSetB[3][sector] = slmCtrl.settings.retardSetB[0][sector] - swingeAngle; slmCtrl.setRetA(sector, slmCtrl.settings.retardSetA[3][sector]); slmCtrl.setRetB(sector, slmCtrl.settings.retardSetB[3][sector]); break; case 4: slmCtrl.settings.retardSetA[4][sector] = slmCtrl.settings.retardSetA[0][sector] - swingeAngle; slmCtrl.settings.retardSetB[4][sector] = slmCtrl.settings.retardSetB[0][sector]; slmCtrl.setRetA(sector, slmCtrl.settings.retardSetA[4][sector]); slmCtrl.setRetB(sector, slmCtrl.settings.retardSetB[4][sector]); break; } } }
// 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 findExtinction(MeasurementPlotter mPlot) { slmCtrl.setAllRetarderATo(SLMModel.extA); slmCtrl.setAllRetarderBTo(SLMModel.extB); double[] a = new double[numIDs]; double[] b = new double[numIDs]; System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> findExtinction A coarse ..."); for (int i = 0; i < a.length; i++) { a[i] = (double) SLMModel.HuntRangeRetarderA_a; b[i] = (double) SLMModel.HuntRangeRetarderA_b; } findExtinctionA(mPlot, a, b, slmModel.getTolCoarse()); System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> findExtinction B coarse ..."); for (int i = 0; i < a.length; i++) { a[i] = (double) SLMModel.HuntRangeRetarderB_a; b[i] = (double) SLMModel.HuntRangeRetarderB_b; } findExtinctionB(mPlot, a, b, slmModel.getTolCoarse()); System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> findExtinction A fine ..."); for (int i = 0; i < a.length; i++) { a[i] = (double) slmCtrl.settings.retardSetA[0][i] - SLMModel.deltaExtinct; b[i] = (double) slmCtrl.settings.retardSetA[0][i] + SLMModel.deltaExtinct; } findExtinctionA(mPlot, a, b, slmModel.getTolFine()); System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> findExtinction B fine ..."); for (int i = 0; i < a.length; i++) { a[i] = (double) slmCtrl.settings.retardSetB[0][i] - SLMModel.deltaExtinct; b[i] = (double) slmCtrl.settings.retardSetB[0][i] + SLMModel.deltaExtinct; } findExtinctionB(mPlot, a, b, slmModel.getTolFine()); measuredIntensity0 = this.getMeasuredValues().clone(); }
public void measureROIs() { targets = new double[] {0, 0, 0, 0, 0, 0, 0, 0, 0}; // System.out.println("acquireImageAndMeasure"); byte[] data = acqCtrl.acquireSampleImage(); // measure intensity at ROIs ImageStatistics[] iStats = measureROIsIn(data, acqCtrl.getImageWidth(), acqCtrl.getImageHeight(), rois); for (int i = 0; i < numIDs; i++) { measurements[i] = Math.abs(iStats[i].meanInROI - slmModel.getZeroIntensity() - targets[i]); } IJ.log("\nMeasured ROIs:"); for (int i = 0; i < numIDs; i++) { IJ.log( " sector " + i + ": " // + settings[i] + " = " + measurements[i]); } }