Commit 40645fb8 authored by Andrey Filippov's avatar Andrey Filippov

Adding garbage collection before each goniometer scan step

parent cf2efd71
...@@ -251,7 +251,7 @@ horizontal axis: ...@@ -251,7 +251,7 @@ horizontal axis:
} }
startAxial=startStep-this.lastScanStep; startAxial=startStep-this.lastScanStep;
this.lastScanStep=startStep-1; this.lastScanStep=startStep-1;
Runtime runtime = Runtime.getRuntime();
for (int nTilt=startTilt;nTilt<numTiltSteps;nTilt++){ for (int nTilt=startTilt;nTilt<numTiltSteps;nTilt++){
double tilt=tilts[nTilt]; double tilt=tilts[nTilt];
tilt=0.1*Math.round(10*tilt); // is that needed? tilt=0.1*Math.round(10*tilt); // is that needed?
...@@ -262,7 +262,7 @@ horizontal axis: ...@@ -262,7 +262,7 @@ horizontal axis:
if (this.debugLevel>0) System.out.println(status); if (this.debugLevel>0) System.out.println(status);
if (updateStatus) IJ.showStatus(status); if (updateStatus) IJ.showStatus(status);
this.goniometerParameters.motorsSimultaneous=false; // not yet implemented this.goniometerParameters.motorsSimultaneous=false; // not yet implemented
// if (!this.goniometerParameters.motorsSimultaneous){ // if (!this.goniometerParameters.motorsSimultaneous){
OK= this.goniometerParameters.goniometerMotors.moveMotorSetETA(tiltMotor, tiltMotorPosition); OK= this.goniometerParameters.goniometerMotors.moveMotorSetETA(tiltMotor, tiltMotorPosition);
if (!OK) { if (!OK) {
String msg="Could not set motor "+(tiltMotor+1)+" to move to "+tiltMotorPosition+" - may be out of limit"; String msg="Could not set motor "+(tiltMotor+1)+" to move to "+tiltMotorPosition+" - may be out of limit";
...@@ -277,7 +277,7 @@ horizontal axis: ...@@ -277,7 +277,7 @@ horizontal axis:
IJ.showMessage("Error",msg); IJ.showMessage("Error",msg);
return false; return false;
} }
// } // }
for (int nAxial=((nTilt==startTilt)?startAxial:0);nAxial<rots[nTilt].length;nAxial++){ for (int nAxial=((nTilt==startTilt)?startAxial:0);nAxial<rots[nTilt].length;nAxial++){
double axial=rots[nTilt][nAxial]; double axial=rots[nTilt][nAxial];
axial=0.1*Math.round(10*axial); axial=0.1*Math.round(10*axial);
...@@ -285,7 +285,9 @@ horizontal axis: ...@@ -285,7 +285,9 @@ horizontal axis:
status=(this.lastScanStep+1)+"( last="+(numStops-1)+") "+IJ.d2s(1E-9*(System.nanoTime()-startTime),3)+" sec. tilt:"+(nTilt+1)+"/"+numTiltSteps+" , "+ status=(this.lastScanStep+1)+"( last="+(numStops-1)+") "+IJ.d2s(1E-9*(System.nanoTime()-startTime),3)+" sec. tilt:"+(nTilt+1)+"/"+numTiltSteps+" , "+
IJ.d2s(tilt,2)+" deg., axial:"+ IJ.d2s(tilt,2)+" deg., axial:"+
(nAxial+1)+"/"+rots[nTilt].length+" , "+IJ.d2s(axial,2)+" deg."; (nAxial+1)+"/"+rots[nTilt].length+" , "+IJ.d2s(axial,2)+" deg.";
if (this.debugLevel>0) System.out.println(status+", axial motor steps: "+axialMotorPosition); runtime.gc();
String memoryStatus="Free memory="+runtime.freeMemory()+" (of "+runtime.totalMemory()+")";
if (this.debugLevel>0) System.out.println(status+", axial motor steps: "+axialMotorPosition+" "+memoryStatus);
if (updateStatus) IJ.showStatus(status); if (updateStatus) IJ.showStatus(status);
OK= this.goniometerParameters.goniometerMotors.moveMotorSetETA(axialMotor, axialMotorPosition); OK= this.goniometerParameters.goniometerMotors.moveMotorSetETA(axialMotor, axialMotorPosition);
...@@ -302,8 +304,8 @@ horizontal axis: ...@@ -302,8 +304,8 @@ horizontal axis:
IJ.showMessage("Error",msg); IJ.showMessage("Error",msg);
return false; return false;
} }
// update motor positions in the image properties, acquire and save images. // update motor positions in the image properties, acquire and save images.
// TODO: Make acquisition/decoding/laser identification multi-threaded // TODO: Make acquisition/decoding/laser identification multi-threaded
this.cameras.setMotorsPosition(this.goniometerParameters.goniometerMotors.getTargetPositions()); // Used target, not current to prevent minor variations this.cameras.setMotorsPosition(this.goniometerParameters.goniometerMotors.getTargetPositions()); // Used target, not current to prevent minor variations
this.cameras.reportTiming=debugTiming; this.cameras.reportTiming=debugTiming;
......
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