Skip to content

Commit

Permalink
Version 1.1.01
Browse files Browse the repository at this point in the history
  • Loading branch information
MSiemons authored Mar 10, 2020
1 parent 2fa882d commit 1795db4
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 55 deletions.
44 changes: 23 additions & 21 deletions src/AberrationCorrection.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class AberrationCorrection {
public double EstWrmserr;
public double EstWrms;
public boolean succes;
public Params paramstore;
volatile boolean AOstopflag;
private Acquisition acqui;

Expand Down Expand Up @@ -83,7 +84,7 @@ public void start(Params params) throws Exception {
boolean startok = true;
if (!params.demomode) {
for (int jzern = 0; jzern < Nzernikes; jzern ++) {
startok = startok && !(Math.abs( Double.valueOf(REALMframe.core_.getProperty("MIRAO52E", params.Zernikes[jzern])) ) > 0.0001);
startok = startok && !(Math.abs( Double.valueOf(REALMframe.core_.getProperty(params.DMname, params.Zernikes[jzern])) ) > 0.0001);
}
}
if (!startok) {
Expand Down Expand Up @@ -113,8 +114,8 @@ public void start(Params params) throws Exception {

// Apply bias
if (!params.demomode) {
REALMframe.core_.setProperty("MIRAO52E", params.Zernikes[jzern], (this.Aest[jzern] + biases[jbias]) / 1000);
REALMframe.core_.setProperty("MIRAO52E","ApplyZernikes",1);
REALMframe.core_.setProperty(params.DMname, params.Zernikes[jzern], (this.Aest[jzern] + biases[jbias]) / 1000);
REALMframe.core_.setProperty(params.DMname,"ApplyZernikes",1);
}

}
Expand Down Expand Up @@ -219,8 +220,8 @@ public void start(Params params) throws Exception {

// Applycorrection
if (!params.demomode) {
REALMframe.core_.setProperty("MIRAO52E", params.Zernikes[jzern], this.Aest[jzern] / 1000);
REALMframe.core_.setProperty("MIRAO52E","ApplyZernikes",1);
REALMframe.core_.setProperty(params.DMname, params.Zernikes[jzern], this.Aest[jzern] / 1000);
REALMframe.core_.setProperty(params.DMname,"ApplyZernikes",1);
}

// Show metric values and fit
Expand All @@ -240,7 +241,8 @@ public void start(Params params) throws Exception {
}
}

// Aberration correction finished. Store and show results
// Aberration correction finished. Store and show results
this.paramstore = params;
this.EstWrms = getWrms(this.Aest);
this.EstWrmserr = getWrmserr(this.Aest,this.Aerr);

Expand Down Expand Up @@ -287,7 +289,7 @@ public void start(Params params) throws Exception {
}

// Save data
public void save(String file_path, Params params) throws Exception {
public void save(String file_path) throws Exception {

FileWriter write = new FileWriter( file_path , false);
PrintWriter print_line = new PrintWriter(write);
Expand All @@ -298,45 +300,45 @@ public void save(String file_path, Params params) throws Exception {
print_line.printf( "%s" + "%n" ,"Date: " + dateFormat.format(date));
print_line.printf("%s" + "%n", "" );
print_line.printf("%s" + "%n", "Settings");
print_line.printf( "%s" + "%n" ,"NA: " + Float.toString(params.NA));
print_line.printf( "%s" + "%n" ,"Wavelength [nm]: " + Float.toString(params.wavelength));
print_line.printf( "%s" + "%n" ,"Pixelsize[nm]: " + Float.toString(params.pixelsize));
print_line.printf( "%s" + "%n" ,"Correction rounds: " + Integer.toString(params.Nrounds));
print_line.printf( "%s" + "%n" ,"NA: " + Float.toString(this.paramstore.NA));
print_line.printf( "%s" + "%n" ,"Wavelength [nm]: " + Float.toString(this.paramstore.wavelength));
print_line.printf( "%s" + "%n" ,"Pixelsize[nm]: " + Float.toString(this.paramstore.pixelsize));
print_line.printf( "%s" + "%n" ,"Correction rounds: " + Integer.toString(this.paramstore.Nrounds));
print_line.printf( "%s" ,"Zernike modes: ");
for (int i = 0; i < params.Zernikes.length; i ++)
print_line.printf("%s, ",params.Zernikes[i]);
for (int i = 0; i < this.paramstore.Zernikes.length; i ++)
print_line.printf("%s, ",this.paramstore.Zernikes[i]);
print_line.printf( "%n");
print_line.printf( "%s" ,"Applied biases [nm]: ");
for (int i = 0; i < params.biases.length; i ++)
print_line.printf("%s, ",Double.toString(params.biases[i]));
for (int i = 0; i < this.paramstore.biases.length; i ++)
print_line.printf("%s, ",Double.toString(this.paramstore.biases[i]));
print_line.printf( "%n");
print_line.printf( "%n");
print_line.printf("%s" + "%n", "Aberration correction results");
print_line.printf( "%s" + "%n" ,"Wrms [rad]: " + Double.toString(this.EstWrms / params.wavelength * 2 * Math.PI));
print_line.printf( "%s" + "%n" ,"Wrms standard error [rad]: " + Double.toString(this.EstWrmserr / params.wavelength * 2 * Math.PI));
print_line.printf( "%s" + "%n" ,"Wrms [rad]: " + Double.toString(this.EstWrms / this.paramstore.wavelength * 2 * Math.PI));
print_line.printf( "%s" + "%n" ,"Wrms standard error [rad]: " + Double.toString(this.EstWrmserr / this.paramstore.wavelength * 2 * Math.PI));
print_line.printf( "%s" + "%n","Zernike coefficients [rad]");
for (int i = 0; i < this.AestStore.length; i ++) {
print_line.printf( "%s" ,"Round " + (i +1) + ": ");
for (int j = 0; j < this.AestStore[0].length; j ++)
print_line.printf("%s, ",this.AestStore[i][j] / params.wavelength * 2 * Math.PI);
print_line.printf("%s, ",this.AestStore[i][j] / this.paramstore.wavelength * 2 * Math.PI);
print_line.printf( "%n");
}
print_line.printf( "%s" ,"Final: ");
for (int j = 0; j < this.Aest.length; j ++)
print_line.printf("%s, ",this.Aest[j] / params.wavelength * 2 * Math.PI);
print_line.printf("%s, ",this.Aest[j] / this.paramstore.wavelength * 2 * Math.PI);
print_line.printf( "%n");
print_line.printf( "%n");
print_line.printf( "%s" + "%n","Standard Error of Zernike coefficients [rad]");
for (int i = 0; i < this.AerrStore.length; i ++) {
print_line.printf( "%s" ,"Round " + (i +1) + ": ");
for (int j = 0; j < this.AerrStore[0].length; j ++)
print_line.printf("%s, ",this.AerrStore[i][j] / params.wavelength * 2 * Math.PI);
print_line.printf("%s, ",this.AerrStore[i][j] / this.paramstore.wavelength * 2 * Math.PI);
print_line.printf( "%n");
}
print_line.printf( "%n");
print_line.printf( "%s" + "%n","Metric values");
for (int i = 0; i < this.Mstore[0].length; i ++) {
print_line.printf( "%s" + "%n" ,"Zernike mode " + params.Zernikes[i]);
print_line.printf( "%s" + "%n" ,"Zernike mode " + this.paramstore.Zernikes[i]);
for (int j = 0; j < this.Mstore.length; j ++) {
print_line.printf( "%s" ,"Round " + (j +1) + ": ");
for (int k = 0; k < this.Mstore[0][0].length; k ++)
Expand Down
9 changes: 9 additions & 0 deletions src/Params.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class Params {
public float alpha;
public boolean show;
public boolean demomode;
public String DMname;

public void update() {

Expand All @@ -62,6 +63,14 @@ public void update() {
this.Zernikes = REALMframe.ZERNLIST3;
this.zernindn = REALMframe.zernindn3;
this.zernindm = REALMframe.zernindm3;
} else if(Zernlist == 3) {
this.Zernikes = REALMframe.ZERNLIST4;
this.zernindn = REALMframe.zernindn4;
this.zernindm = REALMframe.zernindm4;
} else if(Zernlist == 4) {
this.Zernikes = REALMframe.ZERNLIST5;
this.zernindn = REALMframe.zernindn5;
this.zernindm = REALMframe.zernindm5;
}
this.Nzernikes = this.Zernikes.length;

Expand Down
Loading

0 comments on commit 1795db4

Please sign in to comment.