Commit 1a664c2b authored by Andrey Filippov's avatar Andrey Filippov

removed obsolete data output

parent 82208513
......@@ -829,6 +829,7 @@ if (MORE_BUTTONS) {
addButton("Test measurement", panelCurvature,color_debug);
addButton("Optimize qualB", panelCurvature,color_debug);
addButton("Focus/Tilt LMA", panelCurvature,color_process);
addButton("Post-UV Adjust", panelCurvature,color_process);
add(panelCurvature);
//panelGoniometer
......@@ -4372,11 +4373,12 @@ if (MORE_BUTTONS) {
// int [] mmm= MOTORS.focusingHistory.getPosition();
//System.out.println("@@"+MOTORS.historySize()+": "+MOTORS.curpos[0]+", "+MOTORS.curpos[1]+", "+MOTORS.curpos[2]+" --- "+mmm[0]+", "+mmm[1]+", "+mmm[2]);
if (FOCUS_MEASUREMENT_PARAMETERS.showLegacy){
MOTORS.focusingHistory.optimalMotorPosition( // recalculate calibration to estimate current distamnce from center PSF
FOCUS_MEASUREMENT_PARAMETERS,
MOTORS.getMicronsPerStep(), //double micronsPerStep,
DEBUG_LEVEL);
}
//System.out.println("@@@"+MOTORS.historySize()+": "+MOTORS.curpos[0]+", "+MOTORS.curpos[1]+", "+MOTORS.curpos[2]+" --- "+mmm[0]+", "+mmm[1]+", "+mmm[2]);
boolean autoMove= label.equals("Auto Focus/Tilt");
boolean fineFocus=label.equals("Fine Focus");
......@@ -4934,11 +4936,9 @@ if (MORE_BUTTONS) {
FOCUSING_FIELD.testQualB(true); // public double[] testQualB(boolean interactive)
return;
}
/* ======================================================================== */
if (label.equals("Focus/Tilt LMA")) {
if (label.equals("Focus/Tilt LMA") || label.equals("Post-UV Adjust")) {
int adjustMode=label.equals("Focus/Tilt LMA")?0:1;
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (FOCUSING_FIELD==null) {
if (DEBUG_LEVEL>0) System.out.println("FOCUSING_FIELD==null, trying to restore from the previously saved file");
......@@ -4959,12 +4959,13 @@ if (MORE_BUTTONS) {
}
}
// Just for old focal distance calculation
if (FOCUS_MEASUREMENT_PARAMETERS.showLegacy){
MOTORS.focusingHistory.optimalMotorPosition( // recalculate calibration to estimate current distance from center PSF
FOCUS_MEASUREMENT_PARAMETERS,
MOTORS.getMicronsPerStep(), //double micronsPerStep,
DEBUG_LEVEL);
while (adjustFocusTiltLMA());
}
while (adjustFocusTiltLMA(adjustMode));
return;
}
//
......@@ -5426,11 +5427,12 @@ if (MORE_BUTTONS) {
FOCUS_MEASUREMENT_PARAMETERS.result_PX0,
FOCUS_MEASUREMENT_PARAMETERS.result_PY0);
}
if (FOCUS_MEASUREMENT_PARAMETERS.showLegacy){
MOTORS.focusingHistory.optimalMotorPosition( // recalculate calibration to estimate current distance from center PSF
FOCUS_MEASUREMENT_PARAMETERS,
MOTORS.getMicronsPerStep(), //double micronsPerStep,
DEBUG_LEVEL);
}
moveAndMaybeProbe(
true, // just move, not probe
null, // no move, just measure
......@@ -5500,10 +5502,12 @@ if (MORE_BUTTONS) {
String [] zTxTyNames={"z", "tx","ty"};
// boolean useLMA=true;
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
if (FOCUS_MEASUREMENT_PARAMETERS.showLegacy){
MOTORS.focusingHistory.optimalMotorPosition( // recalculate calibration to estimate current distance from center PSF
FOCUS_MEASUREMENT_PARAMETERS,
MOTORS.getMicronsPerStep(), //double micronsPerStep,
DEBUG_LEVEL);
}
GenericDialog gd = new GenericDialog(modeAverage?"Averaging measurements":"Temperature Scan");
//replayMode
double scanMinutes=modeAverage?2.0:30.0;
......@@ -5938,7 +5942,7 @@ if (MORE_BUTTONS) {
"Average Tilt y: "+IJ.d2s(zcZ0TxTy[0][2],3)+"um/mm\n";
System.out.println(msg);
gd.addMessage(msg);
gd.addCheckbox("Store calculated tilts, defaultValue",FOCUSING_FIELD.updateAverageTilts);
gd.addCheckbox("Store calculated tilts",FOCUSING_FIELD.updateAverageTilts);
}
gd.showDialog();
if (!gd.wasCanceled()){
......@@ -9918,7 +9922,11 @@ if (MORE_BUTTONS) {
}
public boolean adjustFocusTiltLMA(){
/**
* @param adjustMode - 0 normal, using motors. 1 - post-UV manual adjustment
* @return
*/
public boolean adjustFocusTiltLMA(int adjustMode){
// just for reporting distance old way
/*
MOTORS.focusingHistory.optimalMotorPosition( // recalculate calibration to estimate current distance from center PSF
......@@ -9940,8 +9948,11 @@ if (MORE_BUTTONS) {
FOCUS_MEASUREMENT_PARAMETERS.result_PX0,
FOCUS_MEASUREMENT_PARAMETERS.result_PY0);
}
int [] adjustModeAllCommon={1,1,1};
// save zTxTyAdjustMode used in moveMeasureAndSave, and overwrite it with adjustModeAllCommon (so new tX,tY will be calculated each time)
int [] savedZTxTyAdjustMode=FOCUSING_FIELD.zTxTyAdjustMode.clone();
FOCUSING_FIELD.zTxTyAdjustMode=adjustModeAllCommon.clone();
// No-move measure, add to history
moveAndMaybeProbe(
true, // just move, not probe
null, // no move, just measure
......@@ -9961,16 +9972,17 @@ if (MORE_BUTTONS) {
UPDATE_STATUS,
MASTER_DEBUG_LEVEL,
DISTORTION.loop_debug_level);
// restore configured FOCUSING_FIELD.zTxTyAdjustMode
FOCUSING_FIELD.zTxTyAdjustMode=savedZTxTyAdjustMode.clone();
//get measurement
FocusingField.FocusingFieldMeasurement fFMeasurement=MOTORS.getThisFFMeasurement(FOCUSING_FIELD);
// calculate z, tx, ty, m1,m2,m3
int [] adjustModeAllCommon={1,1,1};
double [] zTxTyM1M2M3 = FOCUSING_FIELD.adjustLMA(
adjustModeAllCommon, // FOCUSING_FIELD.zTxTyAdjustMode,
false, // allow tilt scan
fFMeasurement,
false, // parallel move
true, // boolean noQualB, // do not re-claculate testQualB
true, // boolean noQualB, // do not re-calculate testQualB
false); // boolean noAdjust); // do not calculate correction
// show dialog: Apply, re-calculate, exit
int [] currentMotors=fFMeasurement.motors;
......@@ -10012,6 +10024,7 @@ if (MORE_BUTTONS) {
System.out.println("Relative to optimal focal shift "+IJ.d2s(zTxTy[0],3)+" um ("+IJ.d2s(FOCUSING_FIELD.targetRelFocalShift,3)+"um)");
System.out.println("Relative to optimal horizontal tilt "+IJ.d2s(zTxTy[1],3)+" um/mm ("+IJ.d2s(FOCUSING_FIELD.targetRelTiltX,3)+"um/mm)");
System.out.println("Relative to optimal vertical tilt "+IJ.d2s(zTxTy[2],3)+" um/mm ("+IJ.d2s(FOCUSING_FIELD.targetRelTiltY,3)+"um/mm)");
if (adjustMode==0) {
for (int i=0;i<newMotors.length;i++){
System.out.println("Suggested for motor "+(i+1)+" "+newMotors[i]+" ("+currentMotors[i]+")");
}
......@@ -10022,6 +10035,7 @@ if (MORE_BUTTONS) {
else System.out.println("Suggested rotation for screw # "+(i+1)+
" "+IJ.d2s(manualScrewsCW[i],3)+" ("+IJ.d2s(deg,0)+"\u00b0 CCW)");
}
} else if (adjustMode==1) {
if (postUVScrews!=null) {
System.out.println("----- Post-UV fixture screw adjustments -----");
for (int i=0;i<postUVScrews.length;i++){
......@@ -10032,6 +10046,7 @@ if (MORE_BUTTONS) {
" "+IJ.d2s(postUVScrews[i],3)+" ("+IJ.d2s(deg,0)+"\u00b0 CCW)");
}
}
}
System.out.println("----- end of Focus/tilt measurement results -----");
if (MASTER_DEBUG_LEVEL>0) System.out.println(FOCUSING_FIELD.showSamples());
......@@ -10053,7 +10068,7 @@ if (MORE_BUTTONS) {
gd.addCheckbox("Optimize tiltX", (FOCUSING_FIELD.qualBOptimizeMode & 2) != 0);
gd.addCheckbox("Optimize tiltY", (FOCUSING_FIELD.qualBOptimizeMode & 4) != 0);
if (adjustMode==0) {
gd.addNumericField("Motor 1",newMotors[0],0,5,"steps ("+currentMotors[0]+")");
gd.addNumericField("Motor 2",newMotors[1],0,5,"steps ("+currentMotors[1]+")");
gd.addNumericField("Motor 3",newMotors[2],0,5,"steps ("+currentMotors[2]+")");
......@@ -10063,6 +10078,8 @@ if (MORE_BUTTONS) {
if (manualScrewsCW[i]>=0) gd.addMessage("Screw # "+(i+1)+" "+IJ.d2s(manualScrewsCW[i],3)+" ("+IJ.d2s(deg,0)+"\u00b0 CW)");
else gd.addMessage("Screw # "+(i+1)+" "+IJ.d2s(manualScrewsCW[i],3)+" ("+IJ.d2s(deg,0)+"\u00b0 CCW)");
}
} else if (adjustMode==1) {
if (postUVScrews!=null) {
gd.addMessage("Suggested rotation of the post-UV fixture screws (far left, near left, right) ---");
for (int i=0;i<postUVScrews.length;i++){
......@@ -10075,6 +10092,7 @@ if (MORE_BUTTONS) {
gd.addNumericField("Screw "+i+" sensitivity", FOCUS_MEASUREMENT_PARAMETERS.postUVscrewSensitivity[i], 4,6,"um/turn CW");
}
}
}
gd.addNumericField("Scale movement",scaleMovement,3,5,"x");
gd.addCheckbox("Recalculate and apply parallel move only",parallelMove); // should be false after manual movement
......@@ -10089,11 +10107,13 @@ if (MORE_BUTTONS) {
gd.addNumericField("Tilt min",FOCUSING_FIELD.tMin,2,5,"um/mm");
gd.addNumericField("Tilt max",FOCUSING_FIELD.tMax,2,5,"um/mm");
gd.addNumericField("Tilt step",FOCUSING_FIELD.tStep,2,5,"um/mm");
gd.addCheckbox("Store calculated tilts",FOCUSING_FIELD.updateAverageTilts);
gd.addCheckbox("Show current PSF",showPSF);
if (adjustMode==0) {
gd.addNumericField("Motor anti-hysteresis travel (last measured was "+IJ.d2s(FOCUS_MEASUREMENT_PARAMETERS.measuredHysteresis,0)+")", FOCUS_MEASUREMENT_PARAMETERS.motorHysteresis, 0,7,"motors steps");
}
gd.addNumericField("Debug Level:", MASTER_DEBUG_LEVEL, 0);
gd.enableYesNoCancel("Apply movement","Re-measure"); // default OK (on enter) - "Apply"
if (adjustMode==0) gd.enableYesNoCancel("Apply movement","Re-measure"); // default OK (on enter) - "Apply"
WindowTools.addScrollBars(gd);
gd.showDialog();
if (gd.wasCanceled()) return false;
......@@ -10105,16 +10125,17 @@ if (MORE_BUTTONS) {
FOCUSING_FIELD.qualBOptimizeMode+= gd.getNextBoolean()?1:0;
FOCUSING_FIELD.qualBOptimizeMode+= gd.getNextBoolean()?2:0;
FOCUSING_FIELD.qualBOptimizeMode+= gd.getNextBoolean()?4:0;
if (adjustMode==0) {
newMotors[0]= (int) gd.getNextNumber();
newMotors[1]= (int) gd.getNextNumber();
newMotors[2]= (int) gd.getNextNumber();
} else if (adjustMode==1) {
if (postUVScrews!=null) {
for (int i=0;i<FOCUS_MEASUREMENT_PARAMETERS.postUVscrewSensitivity.length;i++){
FOCUS_MEASUREMENT_PARAMETERS.postUVscrewSensitivity[i]=gd.getNextNumber();
}
}
}
scaleMovement= gd.getNextNumber();
parallelMove= gd.getNextBoolean();
FOCUSING_FIELD.filterZ= gd.getNextBoolean();
......@@ -10128,11 +10149,27 @@ if (MORE_BUTTONS) {
FOCUSING_FIELD.tMin= gd.getNextNumber();
FOCUSING_FIELD.tMax= gd.getNextNumber();
FOCUSING_FIELD.tStep= gd.getNextNumber();
FOCUSING_FIELD.updateAverageTilts= gd.getNextBoolean();
showPSF= gd.getNextBoolean();
if (adjustMode==0) {
FOCUS_MEASUREMENT_PARAMETERS.motorHysteresis= (int) gd.getNextNumber();
}
MASTER_DEBUG_LEVEL=( int) gd.getNextNumber();
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
FOCUSING_FIELD.setDebugLevel(DEBUG_LEVEL);
if (FOCUSING_FIELD.updateAverageTilts){
double[][]zTxTyAbsRel=FOCUSING_FIELD.getZ0TxTyAbsRel(); // z - z0, not zc here !
if (zTxTyAbsRel!=null){
FOCUSING_FIELD.avgTx= zTxTyAbsRel[0][1]; // average absolute tilt X (optionally used when finding Z of the glued SFE)
FOCUSING_FIELD.avgTy= zTxTyAbsRel[0][2]; // average absolute tilt Y (optionally used when finding Z of the glued SFE)
FOCUS_MEASUREMENT_PARAMETERS.result_fDistance=zTxTy[0];
FOCUS_MEASUREMENT_PARAMETERS.result_tiltX= zTxTy[1];
FOCUS_MEASUREMENT_PARAMETERS.result_tiltY= zTxTy[2];
}
}
if (showPSF){
if (PSF_KERNEL_MAP==null){
IJ.showMessage("Warning","PSF_KERNEL_MAP is null, nothing to show" );
......@@ -10156,6 +10193,7 @@ if (MORE_BUTTONS) {
}
}
}
if (parallelMove){ // ignore/recalculate newMotors data
int [] adjustZOnly={1,0,0};
zTxTyM1M2M3 = FOCUSING_FIELD.adjustLMA(
......@@ -10182,7 +10220,7 @@ if (MORE_BUTTONS) {
newMotors[1]=currentMotors[1]+((int) Math.round((newMotors[1]-currentMotors[1])*scaleMovement));
newMotors[2]=currentMotors[2]+((int) Math.round((newMotors[2]-currentMotors[2])*scaleMovement));
if (gd.wasOKed()){
if ((adjustMode==0) && gd.wasOKed()){
// Move, no measure
MOTORS.moveElphel10364Motors(
true, //boolean wait,
......@@ -12046,14 +12084,16 @@ if (MORE_BUTTONS) {
if ((debugLevel>0) && (metrics!=null)){
// see if lens is calibrated
double [] resolutions={1.0/metrics[1][6],1.0/metrics[5][6],1.0/metrics[2][6]}; // R,G,B
double fDistanceOld=focusingMotors.focusingHistory.getLensDistance(
double fDistanceOld=Double.NaN;
if (FOCUS_MEASUREMENT_PARAMETERS.showLegacy) {
fDistanceOld=focusingMotors.focusingHistory.getLensDistance(
resolutions, // {R-sharpness,G-sharpness,B-sharpness}
true, // boolean absolute, // return absolutely calibrated data
focusMeasurementParameters.lensDistanceWeightK, // 0.0 - all 3 component errors are combined with the same weights. 1.0 - proportional to squared first derivatives
focusMeasurementParameters.lensDistanceWeightY, // R-frac, B-frac have the same scale regardless of the sharpness, but not Y. This is to balance Y contribution
debugLevel
);
}
// int ca=6;
String sZTxTy="";
if (zTxTy!=null){
......@@ -12063,8 +12103,7 @@ if (MORE_BUTTONS) {
System.out.println("##"+focusingMotors.historySize()+": "+actualPosition[0]+", "+actualPosition[1]+", "+actualPosition[2]+
": "+
sZTxTy+
" fDistanceOld="+IJ.d2s(fDistanceOld,3)+"um"+
" Far/Near="+IJ.d2s(oldFarNear,3)+
(FOCUS_MEASUREMENT_PARAMETERS.showLegacy?(" fDistanceOld="+IJ.d2s(fDistanceOld,3)+"um"+" Far/Near="+IJ.d2s(oldFarNear,3)):"")+
" Tilt X="+IJ.d2s(oldTx,3)+
" Tilt Y="+IJ.d2s(oldTy,3)+
" R50% average="+IJ.d2s(metrics[ca][3],3)+" sensor pixels,"+
......@@ -12096,8 +12135,6 @@ if (MORE_BUTTONS) {
}
}
public boolean moveAndMeasureSharpness(
int [] newMotorPos, // null OK
CalibrationHardwareInterface.FocusingMotors focusingMotors,
......@@ -233,7 +233,7 @@ public class LensAdjustment {
public String lensSerial=""; // Lens serial number
public boolean askLensSerial=true; // Ask lens serial on camera power cycle
public double reportTemperature=50; // temperature to report focal length
public boolean showLegacy=false; // Show old focusing parameters (most are not supported anyway)
public boolean includeLensSerial=true; // add lens serial to config filename
public double centerDeltaX=0.0; // required X-difference between lens center and sensor center
public double centerDeltaY=0.0; // required Y-difference between lens center and sensor center
......@@ -606,7 +606,8 @@ public class LensAdjustment {
boolean cameraIsConfigured,
int [] motorPos,
double [] ampsSeconds, // cumulative Amps*seconds (read only, but will be saved/restored)
double reportTemperature // temperature to report focal length
double reportTemperature, // temperature to report focal length
boolean showLegacy
){
this.gridGeometryFile=gridGeometryFile;
this.initialCalibrationFile=initialCalibrationFile;
......@@ -763,7 +764,7 @@ public class LensAdjustment {
this.motorPos=motorPos;
this.ampsSeconds=ampsSeconds; // cumulative Amps*seconds (read only, but will be saved/restored)
this.reportTemperature=reportTemperature;
this.showLegacy=showLegacy;
}
public FocusMeasurementParameters clone(){
return new FocusMeasurementParameters(
......@@ -921,7 +922,8 @@ public class LensAdjustment {
this.cameraIsConfigured,
this.motorPos,
this.ampsSeconds, // cumulative Amps*seconds (read only, but will be saved/restored)
this.reportTemperature
this.reportTemperature,
this.showLegacy
);
}
public void setProperties(String prefix,Properties properties){
......@@ -1092,6 +1094,7 @@ public class LensAdjustment {
for (int i=0;i<this.ampsSeconds.length;i++)
properties.setProperty(prefix+"ampsSeconds_"+i,this.ampsSeconds[i]+"");
properties.setProperty(prefix+"reportTemperature",this.reportTemperature+"");
properties.setProperty(prefix+"showLegacy",this.showLegacy+"");
}
public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"gridGeometryFile")!=null)
......@@ -1427,6 +1430,8 @@ public class LensAdjustment {
this.ampsSeconds[i]=Double.parseDouble(properties.getProperty(prefix+"ampsSeconds_"+i));
if (properties.getProperty(prefix+"reportTemperature")!=null)
this.reportTemperature=Double.parseDouble(properties.getProperty(prefix+"reportTemperature"));
if (properties.getProperty(prefix+"showLegacy")!=null)
this.showLegacy=Boolean.parseBoolean(properties.getProperty(prefix+"showLegacy"));
}
public boolean getLensSerial(){
while (true) { // loop until OK-ed
......@@ -1696,6 +1701,7 @@ public class LensAdjustment {
gd.addMessage("-----");
gd.addNumericField("Report focal length at this temperature", this.reportTemperature, 1,5,"C");
gd.addCheckbox ("Show legacy focusing parameters (most are already not supported anyway)", this.showLegacy);
if (!Double.isNaN(this.sensorTemperature)) gd.addMessage("Last measured sensor temperature is "+this.sensorTemperature+" C");
......@@ -1888,6 +1894,7 @@ public class LensAdjustment {
this.postUVscrewSensitivity[i]= gd.getNextNumber();
}
this.reportTemperature= gd.getNextNumber();
this.showLegacy= gd.getNextBoolean();
return true;
}
/* ======================================================================== */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment