Skip to content

Commit

Permalink
Fixed HippoWizard and TOF calculation/notification for background
Browse files Browse the repository at this point in the history
  • Loading branch information
luttero committed Jul 30, 2019
1 parent 22f68c2 commit 26c963c
Show file tree
Hide file tree
Showing 29 changed files with 875 additions and 516 deletions.
43 changes: 8 additions & 35 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<project name="Maud" default="copy_full" basedir=".">

<property file="${user.home}/.ant_maud.properties"/>
<property file="${user.home}/.ant_maud_v2.properties"/>
<property name="dropbox" location="${user.home}/Dropbox/Maud"/>
<property name="src" location="src"/>
<property name="web" location="src/web"/>
Expand Down Expand Up @@ -2189,14 +2189,7 @@
</exec>
</target>

<target name="build_installer_osx" depends="bundle" description="Build the macOS application">
<!-- <ftp server="${ftpfullserver}" userid="${ftpuserfull}" password="${passwdfull}" remotedir="${deployfulldir}">
<fileset file="${mirrorfulldir}/Maud.jar"/>
</ftp> -->
<!--copy file="${inst}/Maud.entitlements" todir="${inst}/Maud_OSX/Maud.app/Contents" /-->
<!--exec executable="chmod">
<arg line=" -R +w ${app_osx}/Maud.app/Contents/PlugIns"/>
</exec-->
<target name="sign_bundle" depends="bundle" description="Sign the macOS application">
<apply dir="${app_osx}" executable="codesign">
<arg line="-v -f -s &quot;Developer ID Application: Luca Lutterotti (U2NJNG54F3)&quot; "/>
<fileset dir="${app_osx}/Maud.app/Contents/PlugIns" />
Expand Down Expand Up @@ -2226,6 +2219,9 @@
<exec executable="spctl" dir="${app_osx}" failonerror="true">
<arg line="-vv --assess --type execute Maud.app"/>
</exec>
</target>

<target name="build_installer_osx" depends="sign_bundle" description="Build the macos installers">
<copy file="${app_osx}/.DS_Store_default" tofile="${app_osx}/.DS_Store"/>
<exec dir="${app_osx}" executable="/Users/luca/bin/mkdmg.pl" os="Mac OS X">
<arg line="Maud.dmg.gz Maud.app .background .DS_Store"/>
Expand Down Expand Up @@ -2282,36 +2278,13 @@
<exec dir="${inst}/Maud_windows64/" executable="zip" os="Mac OS X">
<arg line="-r ${dropbox}/windows64/Maud.zip Maud"/>
</exec>
<!--delete file="${dropbox}/windows/Maud.zip"/>
<exec dir="${inst}/Maud_windows/" executable="zip" os="Mac OS X">
<arg line="-r ${dropbox}/windows/Maud.zip Maud"/>
</exec>
<delete file="${dropbox}/unix/Maud.tar.gz"/>
<exec dir="${inst}/Maud_unix/" executable="tar" os="Mac OS X">
<arg line="cfz ${dropbox}/unix/Maud.tar.gz Maud"/>
</exec>
<delete file="${dropbox}/unix_nj/Maud.tar.gz"/>
<exec dir="${inst}/Maud_unix_nj/" executable="tar" os="Mac OS X">
<arg line="cfz ${dropbox}/unix_nj/Maud.tar.gz Maud"/>
</exec>
<delete file="${dropbox}/linux64_nj/Maud.tar.gz"/>
<exec dir="${inst}/Maud_linux64_nj/" executable="tar" os="Mac OS X">
<arg line="cfz ${dropbox}/linux64_nj/Maud.tar.gz Maud"/>
</exec>
<delete file="${dropbox}/windows_nj/Maud.zip"/>
<exec dir="${inst}/Maud_windows_nj/" executable="zip" os="Mac OS X">
<arg line="-r ${dropbox}/windows_nj/Maud.zip Maud"/>
</exec>
<delete file="${dropbox}/windows64_nj/Maud.zip"/>
<exec dir="${inst}/Maud_windows64_nj/" executable="zip" os="Mac OS X">
<arg line="-r ${dropbox}/windows64_nj/Maud.zip Maud"/>
</exec-->
</target>

<target name="build_installers_only" description="build installers">
<delete file="${app_osx}/Maud.dmg.gz"/>
<exec dir="${app_osx}/" executable="/Users/luca/bin/mkdmg.pl" os="Mac OS X">
<arg line="Maud.dmg.gz Maud.app"/>
<copy file="${app_osx}/.DS_Store_default" tofile="${app_osx}/.DS_Store"/>
<exec dir="${app_osx}" executable="/Users/luca/bin/mkdmg.pl" os="Mac OS X">
<arg line="Maud.dmg.gz Maud.app .background .DS_Store"/>
</exec>
<delete file="${inst}/linux64/Maud.tar.gz"/>
<exec dir="${inst}/Maud_linux64/" executable="tar" os="Mac OS X">
Expand Down
4 changes: 3 additions & 1 deletion src/com/jtex/geom/PointGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public enum PointGroup {
Th("cubic", "Th", "m-3", "m-3", "23"),
O("cubic", "O", "432", "m-3m", "432"),
Td("cubic", "Td", "-43m", "m-3m", "432"),
Oh("cubic", "Oh", "m-3m", "m-3m", "432");
Oh("cubic", "Oh", "m-3m", "m-3m", "432"),
Fi("fiber", "C72h", "72/m", "72/m", "72"),
Fib("fiber", "D72h", "72/mmm", "72/mmm", "7222");

String system;
String schoenflies;
Expand Down
18 changes: 14 additions & 4 deletions src/com/jtex/geom/Symmetry.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ public static Quaternion calcQuat(PointGroup schon, Vec3 axis) {
case Oh:
rot = Axis(lllaxis, 3).prod(Axis(ll0axis, 2).prod(Axis(c, 4)));
break;
case Fi:
rot = Axis(c, 72);
break;
case Fib:
rot = Axis(a, 2).prod(Axis(c, 72));
break;
}
return rot;
}
Expand Down Expand Up @@ -332,7 +338,7 @@ public double rotangle_max_y() {
public double rotangle_max_y(boolean antipodal) {

double theta = Math.PI;
if (schoen.isLaue("-1", "-3", "4/m", "6/m")) {
if (schoen.isLaue("-1", "-3", "4/m", "6/m", "72/m")) {
theta = 2 * Math.PI / (antipodal ? 2 : 1);
} /*else if (schoen.isLaue("mmm", "-3m", "4/mmm", "m-3m", "6/mmm", "m-3")) {
theta = Math.PI;
Expand Down Expand Up @@ -373,16 +379,18 @@ public double rotangle_max_z(boolean antipodal, boolean alpha) {
rho /= 2.0;
} else if (schoen.isLaue("6/m", "6/mmm")) {
rho /= 3.0;
} else if (schoen.isLaue("72/m", "72/mmm")) {
rho /= 36.0;
}
return rho;
}

public Quaternion rotation_special() {
if (schoen.isLaue("-1", "2/m")) {
return this;
} else if (schoen.isLaue("mmm", "-3m", "4/mmm", "6/mmm")) {
} else if (schoen.isLaue("mmm", "-3m", "4/mmm", "6/mmm", "72/mmm")) {
return get(0, 1);
} else if (schoen.isLaue("-3", "4/m", "6/m")) {
} else if (schoen.isLaue("-3", "4/m", "6/m", "72/m")) {
return get(0);
} else if (schoen.isLaue("m-3", "m-3m")) {
return get(0, 1, 2, 3, 4, 5);
Expand All @@ -399,6 +407,8 @@ public int nfold() {
return 4;
} else if (schoen.isLaue("6/m", "6/mmm")) {
return 6;
} else if (schoen.isLaue("72/m", "72/mmm")) {
return 72;
} else {
return 1;
}
Expand Down Expand Up @@ -489,7 +499,7 @@ public Symmetry(String group, Array1D axlength, Array1D angles, Alignment... ali
}

public Alignment[] getAlignment() {
if (this.schoen.isLaue("-1", "2/m", "-3", "-3m", "6/m", "6/mmm")) {
if (this.schoen.isLaue("-1", "2/m", "-3", "-3m", "6/m", "6/mmm", "72/m", "72/mmm")) {
Vec3 base = Vec3.concat(basis(), basisStar()).normalize();
double eps = 1 - 1e-5;

Expand Down
1 change: 1 addition & 0 deletions src/com/jtex/plot/Plotter.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public static SimpleMultiPlotComponent plot(PoleFigure pf) {
ScatterOptions scatterOptions = new ScatterOptions(Shapes.Named.CIRCLE, .5);
for (int i = 0; i < pf.size(); i++) {
PoleFigure pft = pf.get(i);
// System.out.println("Plotting pole figure of length: " + pft.getData().size());
Array1D data = pft.getData();
SphericalCanvas canvas = new SphericalCanvasScatter(
pft.getR(),
Expand Down
5 changes: 3 additions & 2 deletions src/com/jtex/plot/gui/SimpleMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ public void actionPerformed(ActionEvent e) {
opt.setVisible(true);

if (!opt.wasCanceled()) {
ODF estimate = ODF.estimate(data.getPf(), opt.getODFPoptions());
data.setOdf(estimate);
com.jtex.qta.ODF estimate = new com.jtex.qta.ODF();
estimate = estimate.estimate(data.getPf(), opt.getODFPoptions());
data.setOdf(estimate);
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/com/jtex/plot/gui/SimpleODFOptionsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void windowClosing(java.awt.event.WindowEvent e) {
private javax.swing.JTextField jTextField2;
// End of variables declaration//GEN-END:variables

public ODF.ODFOptions getODFPoptions() {
public com.jtex.qta.ODFOptions getODFPoptions() {

double hw = Double.parseDouble(jTextField1.getText());
double res = Double.parseDouble(jTextField2.getText());
Expand All @@ -223,7 +223,7 @@ public ODF.ODFOptions getODFPoptions() {
break;
}

ODF.ODFOptions opts = new ODF.ODFOptions(pf, Math.toRadians(res), psi);
com.jtex.qta.ODFOptions opts = new com.jtex.qta.ODFOptions(pf, Math.toRadians(res), psi);
opts.setGhostCorrection(jCheckBox1.isSelected());

return opts;
Expand Down
153 changes: 12 additions & 141 deletions src/com/jtex/qta/ODF.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@
*/
public class ODF extends ODFComponent {

protected final PoleFigure pfsource;
protected Symmetry cs;
protected Symmetry ss;
protected PoleFigure pfsource = null;
protected Symmetry cs = null;
protected Symmetry ss = null;

protected ArrayList<ODFComponent> odfs;
protected ArrayList<ODFComponent> odfs = new ArrayList<ODFComponent>();

public ODF() {}

public ODF(Symmetry cs, Symmetry ss, final PoleFigure source) {
this.odfs = new ArrayList<ODFComponent>();
// this.odfs = new ArrayList<ODFComponent>();
this.cs = cs;
this.ss = ss;
this.pfsource = source;
Expand Down Expand Up @@ -90,16 +92,16 @@ public PoleFigure getPFsource() {
return pfsource;
}

public static ODF estimate(PoleFigure pf) {
return ODF.estimate(pf, 10);
public ODF estimate(PoleFigure pf) {
return estimate(pf, 10);
}

public static ODF estimate(PoleFigure pf, double dghalfwidth) {
public ODF estimate(PoleFigure pf, double dghalfwidth) {
double halfwidth = Math.toRadians(dghalfwidth);
return estimate(pf, new ODFOptions(pf.getCS(), pf.getSS(), halfwidth, new DeLaValleePoussin(halfwidth)));
}

public static ODF estimate(PoleFigure pf, ODFOptions options) {
public ODF estimate(PoleFigure pf, ODFOptions options) {

Symmetry cs = options.getCS();
Symmetry ss = options.getSS();
Expand Down Expand Up @@ -360,138 +362,6 @@ public void setPortion(double p) {

}

public static class ODFOptions {

Symmetry cs;
Symmetry ss;
double resolution;
Kernel psi;
int iterMax;
int iterMin;
int flags;
boolean doGhostCorrection = true;
SO3Grid grid;
Array1D c0;

public ODFOptions(PoleFigure pf) {
this(pf, Math.toRadians(7.5));
}

public ODFOptions(PoleFigure pf, double halfwidth) {
this(pf, halfwidth, new DeLaValleePoussin(halfwidth));
}

public ODFOptions(PoleFigure pf, double resolution, Kernel psi) {
this(pf.getCS(), pf.getSS(), resolution, psi);
}

public ODFOptions(Symmetry cs) {
this(cs, Math.toRadians(7.5));
}

public ODFOptions(Symmetry cs, double halfwidth) {
this(cs, halfwidth, halfwidth);
}

public ODFOptions(Symmetry cs, double halfwidth, double resolution) {
this(cs, new Symmetry(), resolution, new DeLaValleePoussin(halfwidth));
}

public ODFOptions(Symmetry cs, Symmetry ss, double resolution, Kernel psi) {
this.cs = cs;
this.resolution = resolution;
this.psi = psi;
this.ss = ss;
this.flags = 1;
this.iterMax = 15;
this.iterMin = 10;

this.grid = SO3Grid.equispacedSO3Grid(resolution, cs, ss);
this.c0 = Array1D.fill(grid.size(), 1.0 / grid.size());

}

public SO3Grid getGrid() {
return grid;
}

public void setGrid(SO3Grid grid) {
this.grid = grid;
}

public Array1D getC0() {
return c0;
}

public Symmetry getCS() {
return cs;
}

public void setC0(Array1D c0) {
this.c0 = c0;
}

public void setIterMax(int iterMax) {
this.iterMax = iterMax;
}

public void setIterMin(int iterMin) {
this.iterMin = iterMin;
}

public void setGhostCorrection(boolean doGhostCorrection) {
this.doGhostCorrection = doGhostCorrection;
}

public boolean getGhostCorrection() {
return doGhostCorrection;
}

public double getHalfwidth() {
return psi.p2hw();
}

public Kernel getPsi() {
return psi;
}

public double getResolution() {
return resolution;
}

public Symmetry getSS() {
return ss;
}

public int getIterMax() {
return iterMax;
}

public int getIterMin() {
return iterMin;
}

public int getFlags() {
return flags;
}

@Override
public String toString() {
return getClass().getName() + "[" + paramString() + "]";
}

protected String paramString() {
String str = "resolution=" + Math.toDegrees(resolution) + "°";
str += ",kernel=" + psi.toString();
str += ",iterMax=" + iterMax;
str += ",iterMin=" + iterMin;
str += ",flags=" + flags;
str += ",grid=" + grid;
return str;
}

}

/*Luca public static void main(String args[]) {
Quaternion q = Quaternion.rotZXZ(1, 2, 3);
Expand All @@ -518,3 +388,4 @@ protected String paramString() {
}*/

}

Loading

0 comments on commit 26c963c

Please sign in to comment.