Skip to content

Commit

Permalink
Adds features for USeries date interpretations (#176)
Browse files Browse the repository at this point in the history
* refactors

* advances sea water in u-series

* advances boundaries
  • Loading branch information
bowring authored Apr 25, 2019
1 parent 273e5ef commit b8c2c42
Show file tree
Hide file tree
Showing 33 changed files with 1,983 additions and 387 deletions.
1 change: 1 addition & 0 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ That way multiple projects can share the same settings (useful for formatting ru
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
<netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
</properties>
</project-shared-configuration>
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<groupId>org.cirdles</groupId>
<artifactId>ET_Redux</artifactId>
<name>ET_Redux</name>
<version>3.6.74</version>
<version>3.6.80</version>
<description>Successor to U-Pb_Redux</description>
<url>https://cirdles.org</url>
<inceptionYear>2006</inceptionYear>
Expand Down Expand Up @@ -257,6 +257,14 @@
<artifactId>fop</artifactId>
<version>2.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/math.geom2d/javaGeom -->
<dependency>
<groupId>math.geom2d</groupId>
<artifactId>javaGeom</artifactId>
<version>0.11.1</version>
</dependency>

</dependencies>
<build>
<plugins>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/earthtime/ETRedux.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public ETRedux(File reduxFile) //throws3 IOException, InvalidPreferencesFormatEx
ToolTipManager.sharedInstance().setDismissDelay(10000);

if (theUPbReduxFrame != null) {
theUPbReduxFrame.pack();
theUPbReduxFrame.setVisible(true);
}

Expand Down
12 changes: 10 additions & 2 deletions src/main/java/org/earthtime/ETReduxFrame.form
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,12 @@
<Property name="text" type="java.lang.String" value="UTh"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="editDetrritalUraniumthoriumModels">
<MenuItem class="javax.swing.JMenuItem" name="editPhysicalConstantsModelsUTh">
<Properties>
<Property name="text" type="java.lang.String" value="Physical Constants Models"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editDetrritalUraniumthoriumModelsActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editPhysicalConstantsModelsUThActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="editDetritalUraniumThoriumModels">
Expand All @@ -568,6 +568,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editDetritalUraniumThoriumModelsActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem1">
<Properties>
<Property name="text" type="java.lang.String" value="Sea Water Models"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem1ActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
Expand Down
48 changes: 35 additions & 13 deletions src/main/java/org/earthtime/ETReduxFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Vector;
Expand Down Expand Up @@ -675,7 +676,7 @@ private boolean checkSavedStatusTheProject() {
try {
if (theProject.isChanged()) {
// Modal dialog with OK/cancel and a text field
int response = JOptionPane.showConfirmDialog(null,
int response = JOptionPane.showConfirmDialog(this,
new String[]{"The current Project " + theProject.getProjectName() + " has been changed.",
"Do you want to Save it before proceeding ?"
},
Expand Down Expand Up @@ -1043,7 +1044,7 @@ private boolean checkSavedStatusTheSample() {
try {
if (theSample.isChanged()) {
// Modal dialog with OK/cancel and a text field
int response = JOptionPane.showConfirmDialog(null,
int response = JOptionPane.showConfirmDialog(this,
new String[]{"The current Sample " + theSample.getSampleName() + " has been changed.",
"Do you want to Save it before proceeding ?"
},
Expand Down Expand Up @@ -1931,7 +1932,7 @@ public void producePbcCorrectionReport() {
File pbcCorrReportFile = new File("LAICPMS_Pbc_Correction_Report_for_" + theProject.getProjectName() + ".txt");
PrintWriter outputWriter = null;
try {
outputWriter = new PrintWriter(new FileWriter(pbcCorrReportFile));
outputWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(pbcCorrReportFile), StandardCharsets.UTF_8));//new FileWriter(pbcCorrReportFile));
for (AliquotInterface activeAliquot : theProject.getSuperSample().getActiveAliquots()) {
outputWriter.println("Fractions from " + activeAliquot.getAliquotName() + "\n");
outputWriter.println(PbcCorrectionDetails.headerString() + "\n");
Expand Down Expand Up @@ -2104,8 +2105,9 @@ private void initComponents() {
manageTIMSLabDefaults = new javax.swing.JMenuItem();
manageLAICPMSLabDefaults = new javax.swing.JMenuItem();
labDataUTh = new javax.swing.JMenu();
editDetrritalUraniumthoriumModels = new javax.swing.JMenuItem();
editPhysicalConstantsModelsUTh = new javax.swing.JMenuItem();
editDetritalUraniumThoriumModels = new javax.swing.JMenuItem();
jMenuItem1 = new javax.swing.JMenuItem();
reportMenu = new javax.swing.JMenu();
editCurrentReportSettingsModel_menuItem = new javax.swing.JMenuItem();
showReportHeadings_menuItem = new javax.swing.JMenuItem();
Expand Down Expand Up @@ -2161,7 +2163,6 @@ private void initComponents() {
setTitle("EARTHTIME Redux");
setBackground(new java.awt.Color(237, 242, 250));
setLocationByPlatform(true);
setPreferredSize(new java.awt.Dimension(1175, 750));
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
formComponentResized(evt);
Expand Down Expand Up @@ -2867,13 +2868,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

labDataUTh.setText("UTh");

editDetrritalUraniumthoriumModels.setText("Physical Constants Models");
editDetrritalUraniumthoriumModels.addActionListener(new java.awt.event.ActionListener() {
editPhysicalConstantsModelsUTh.setText("Physical Constants Models");
editPhysicalConstantsModelsUTh.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
editDetrritalUraniumthoriumModelsActionPerformed(evt);
editPhysicalConstantsModelsUThActionPerformed(evt);
}
});
labDataUTh.add(editDetrritalUraniumthoriumModels);
labDataUTh.add(editPhysicalConstantsModelsUTh);

editDetritalUraniumThoriumModels.setText("Detrital Uranium Thorium Models");
editDetritalUraniumThoriumModels.addActionListener(new java.awt.event.ActionListener() {
Expand All @@ -2883,6 +2884,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
labDataUTh.add(editDetritalUraniumThoriumModels);

jMenuItem1.setText("Sea Water Models");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
labDataUTh.add(jMenuItem1);

labDataMenu.add(labDataUTh);

mainMenuBar.add(labDataMenu);
Expand Down Expand Up @@ -3705,6 +3714,10 @@ private void manageSampleDateInterpretation(SampleTreeI dateTreeByAliquot, Sampl
}

}

public void updateEvolutionPlot(){
((EvolutionPlotPanel)myEvolutionPlotPanel).repaint();
}

/**
*
Expand Down Expand Up @@ -4424,13 +4437,13 @@ private void visitUseriesRocksActionPerformed(java.awt.event.ActionEvent evt) {/
BrowserControl.displayURL("https://sites.google.com/site/useriesrocks/");
}//GEN-LAST:event_visitUseriesRocksActionPerformed

private void editDetrritalUraniumthoriumModelsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editDetrritalUraniumthoriumModelsActionPerformed
private void editPhysicalConstantsModelsUThActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editPhysicalConstantsModelsUThActionPerformed
try {
editLabDataUTh(0);
} catch (BadLabDataException ex) {
new ETWarningDialog(ex).setVisible(true);
}
}//GEN-LAST:event_editDetrritalUraniumthoriumModelsActionPerformed
}//GEN-LAST:event_editPhysicalConstantsModelsUThActionPerformed

private void editDetritalUraniumThoriumModelsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editDetritalUraniumThoriumModelsActionPerformed
try {
Expand Down Expand Up @@ -4474,6 +4487,14 @@ private void genericUPbSquid3DataTableCSV_menuItemActionPerformed(java.awt.event
setUpNewCompiledLegacyProject(GENERIC_SQUID3_UPB.getName(), GENERIC_SQUID3_UPB.getIsotypeSystem(), GENERIC_SQUID3_UPB.getDefaultReportSpecsType());
}//GEN-LAST:event_genericUPbSquid3DataTableCSV_menuItemActionPerformed

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
try {
editLabDataUTh(3);
} catch (BadLabDataException ex) {
new ETWarningDialog(ex).setVisible(true);
}
}//GEN-LAST:event_jMenuItem1ActionPerformed

private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
BrowserControl.displayURL("http://cirdles.org/projects/et_redux/");
}
Expand Down Expand Up @@ -4502,13 +4523,13 @@ private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
private javax.swing.JMenu earthTimeWebSiteMenu;
private javax.swing.JMenuItem editCurrentReportSettingsModel_menuItem;
private javax.swing.JMenuItem editDetritalUraniumThoriumModels;
private javax.swing.JMenuItem editDetrritalUraniumthoriumModels;
private javax.swing.JMenuItem editInitialPbModels;
private javax.swing.JMenuItem editLabFractionationModels;
private javax.swing.JMenuItem editLabTracers;
private javax.swing.JMenuItem editMineralStandardsModels;
private javax.swing.JMenuItem editPbBlanks;
private javax.swing.JMenuItem editPhysicalConstantsModels;
private javax.swing.JMenuItem editPhysicalConstantsModelsUTh;
private javax.swing.JMenuItem exitRedux;
private javax.swing.JSeparator exitSeparator;
private javax.swing.JMenuItem exit_menuItem;
Expand All @@ -4525,6 +4546,7 @@ private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
private javax.swing.JMenu helpMenu;
private javax.swing.JMenuItem helpMenuItem;
private javax.swing.JButton interpretSampleDates_button;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenuItem jMenuItem5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void paint(Graphics2D g2d) {

// draw sample curve as backdrop
Path2D sampleProbabilities = new Path2D.Double(Path2D.WIND_NON_ZERO);
Path2D sampleKDE = new Path2D.Double(Path2D.WIND_NON_ZERO);
// Path2D sampleKDE = new Path2D.Double(Path2D.WIND_NON_ZERO);

// handle zoom
int startX = 0;
Expand All @@ -275,7 +275,7 @@ public void paint(Graphics2D g2d) {

// sampleProbabilities.moveTo( mapX( getMinX_Display() ), mapY( 0.01 ) );
sampleProbabilities.moveTo(Math.max(leftMargin, mapX(pdfPoints.get(startX))), mapY(0.01));
sampleKDE.moveTo(Math.max(leftMargin, mapX(timescale[startX])), mapY(0.01));
// sampleKDE.moveTo(Math.max(leftMargin, mapX(timescale[startX])), mapY(0.01));

double scale = 0.96/*
* 8
Expand All @@ -289,12 +289,12 @@ public void paint(Graphics2D g2d) {
Math.max(leftMargin, mapX(pdfPoints.get(i))),//
mapY(stackedAliquotKernels[0][i] * scale + .01));

try {
sampleKDE.lineTo(//
Math.max(leftMargin, mapX(timescale[i])),//
mapY(pdfOfKDE[i] * scaleKDE + .01));
} catch (Exception e) {
}
// try {
// sampleKDE.lineTo(//
// Math.max(leftMargin, mapX(timescale[i])),//
// mapY(pdfOfKDE[i] * scaleKDE + .01));
// } catch (Exception e) {
// }
}

sampleProbabilities.lineTo(mapX(pdfPoints.get(endX)), mapY(0.01));
Expand Down Expand Up @@ -770,29 +770,29 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) {
//stackedAliquotKernels = new double[sample.getAliquots().size() + 1][pdfPoints.size() + 1];
// aug 2016 hack to fix project problem
stackedAliquotKernels = new double[Math.max(sample.getAliquots().size(), 9) + 1][pdfPoints.size() + 1];

// June 2013 experiment with Vermeesch KDE
ArrayList<Double> X = new ArrayList<>();
ArrayList<Double> Y = new ArrayList<>();
ArrayList<Double> Z = new ArrayList<>();

// 4096 = 2^12
timescale = new double[4096];
for (int i = 0; i < timescale.length; i++) {
timescale[i] = i;
}
// end June 2013 experiment with Vermeesch KDE
//////
////// // June 2013 experiment with Vermeesch KDE
////// ArrayList<Double> X = new ArrayList<>();
////// ArrayList<Double> Y = new ArrayList<>();
////// ArrayList<Double> Z = new ArrayList<>();
//////
////// // 4096 = 2^12
////// timescale = new double[4096];
////// for (int i = 0; i < timescale.length; i++) {
////// timescale[i] = i;
////// }
////// // end June 2013 experiment with Vermeesch KDE

for (ETFractionInterface f : selectedFractions) {
// April 2016 remove primary standard
if (!f.isStandard() && !f.isSecondaryStandard()) {
ValueModel date = f.getRadiogenicIsotopeDateByName(chosenDateName);

// June 2013 experiment with Vermeesch KDE
X.add(date.getValue().movePointLeft(6).doubleValue());
Y.add(Math.pow(date.getOneSigmaAbs().movePointLeft(6).doubleValue(), 2));
Z.add(Double.NaN);
// end June 2013 experiment with Vermeesch KDE
////// // June 2013 experiment with Vermeesch KDE
////// X.add(date.getValue().movePointLeft(6).doubleValue());
////// Y.add(Math.pow(date.getOneSigmaAbs().movePointLeft(6).doubleValue(), 2));
////// Z.add(Double.NaN);
////// // end June 2013 experiment with Vermeesch KDE

int aliquotNumber = f.getAliquotNumber();
KernelF myKernel = new KernelF(date);
Expand All @@ -804,22 +804,22 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) {
}
}

// more vermeesch ************************
try {
OtherData otherData = new OtherData(X, Y, Z, new Preferences(true));
double[][] ae = otherData.getDataErrArray(otherData.preferences.logarithmic());

KDE kde = new KDE();
pdfOfKDE = kde.pdf(ae[0], timescale, true);

maxKDE = 0.0;
for (int i = 0; i < pdfOfKDE.length; i++) {
maxKDE = Math.max(maxKDE, pdfOfKDE[i]);
}

} catch (Exception ex) {
}
// end vermeesch ************************
////// // more vermeesch ************************
////// try {
////// OtherData otherData = new OtherData(X, Y, Z, new Preferences(true));
////// double[][] ae = otherData.getDataErrArray(otherData.preferences.logarithmic());
//////
////// KDE kde = new KDE();
////// pdfOfKDE = kde.pdf(ae[0], timescale, true);
//////
////// maxKDE = 0.0;
////// for (int i = 0; i < pdfOfKDE.length; i++) {
////// maxKDE = Math.max(maxKDE, pdfOfKDE[i]);
////// }
//////
////// } catch (Exception ex) {
////// }
////// // end vermeesch ************************

double maxDateProb = 0.0;
for (int i = 0; i < pdfPoints.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Enumeration;
import java.util.List;
import java.util.Vector;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
Expand Down Expand Up @@ -436,8 +436,8 @@ public void mousePressed(MouseEvent e) {
((AliquotInterface) nodeInfo).determineUnusedSampleDateModels());

myEditor.setSize(340, 395);
// JDialog.setDefaultLookAndFeelDecorated(true);

myEditor.setLocationRelativeTo(this);
myEditor.setVisible(true);

// get a master vector of active fraction names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,12 @@ private void populateSampleDateModel(
DefaultMutableTreeNode SAMnode) {

DefaultMutableTreeNode sampleDateValue
=
new DefaultMutableTreeNode(//
= new DefaultMutableTreeNode(//
((SampleDateModel) SAM).ShowCustomDateNode());
SAMnode.add(sampleDateValue);

DefaultMutableTreeNode sampleDateMSWD
=
new DefaultMutableTreeNode(//
= new DefaultMutableTreeNode(//
((SampleDateModel) SAM).ShowCustomMSWDwithN());
SAMnode.add(sampleDateMSWD);

Expand Down Expand Up @@ -366,7 +364,7 @@ public void mousePressed(MouseEvent e) {
((SampleInterface) nodeInfo).determineUnusedSampleDateModels(false));

myEditor.setSize(340, 395);
// DialogEditor.setDefaultLookAndFeelDecorated(true);
myEditor.setLocationRelativeTo(this);

myEditor.setVisible(true);

Expand Down
Loading

0 comments on commit b8c2c42

Please sign in to comment.