Skip to content

Commit

Permalink
Merge pull request #47 from bowring/az
Browse files Browse the repository at this point in the history
Maintenance and bug fixes
  • Loading branch information
bowring committed Jan 24, 2016
2 parents 522c4d4 + 215bf08 commit aba9943
Show file tree
Hide file tree
Showing 19 changed files with 427 additions and 655 deletions.
2 changes: 1 addition & 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.4.0</version>
<version>3.4.1</version>
<description>Successor to U-Pb_Redux</description>
<url>https://cirdles.org</url>
<inceptionYear>2006</inceptionYear>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/earthtime/ETReduxFrame.form
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="F1"/>
</Property>
<Property name="text" type="java.lang.String" value="Help-currently under construction"/>
<Property name="text" type="java.lang.String" value="Help from CIRDLES.org"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="helpMenuItemActionPerformed"/>
Expand Down
64 changes: 38 additions & 26 deletions src/main/java/org/earthtime/ETReduxFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.help.DefaultHelpBroker;
import javax.help.HelpBroker;
import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JButton;
Expand Down Expand Up @@ -112,7 +110,6 @@
import org.earthtime.UPb_Redux.utilities.BrowserControl;
import org.earthtime.UPb_Redux.utilities.CustomIcon;
import org.earthtime.UPb_Redux.utilities.ETSerializer;
import org.earthtime.UPb_Redux.utilities.JHelpAction;
import org.earthtime.UPb_Redux.utilities.MacOSAboutHandler;
import org.earthtime.UTh_Redux.dateInterpretation.TopsoilEvolutionPlot;
import org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException;
Expand Down Expand Up @@ -205,6 +202,7 @@ public class ETReduxFrame extends javax.swing.JFrame implements ReportPainterI,
//oct 2014
private DialogEditor sampleDateInterpDialog;
private DialogEditor myFractionEditor;
private DialogEditor geochronProjectExportManager;

/**
* Creates new form UPbReduxFrame
Expand Down Expand Up @@ -538,7 +536,7 @@ private void openProjectFile() {

private void openTheProject(File projectReduxFile) {

forceCloseOfSampleDateInterpretations();
closeProjectAndOrSample();

theProject = null;
System.gc();
Expand Down Expand Up @@ -785,9 +783,9 @@ private void manageTheProject() {

myProjectManager.initDialogContent();
myProjectManager.setVisible(true);

updateReportTable();

saveProject();
}

Expand Down Expand Up @@ -911,9 +909,8 @@ private void exportProjectSamplesToGeochron() {
theProject.prepareSamplesForExport();

// launch manager
DialogEditor geochronProjectExportManager
= //
new GeochronProjectExportManager(this, true, theProject, myState);
geochronProjectExportManager
= GeochronProjectExportManager.getInstance(null, false, theProject, myState);

geochronProjectExportManager.setVisible(true);
}
Expand Down Expand Up @@ -1412,12 +1409,12 @@ private void customizeReduxSkin() {
// show the welcome page
jSplitPane1.setDividerLocation(1.0);
}

// jan 2016
if (theSample.isSampleTypeProject() && theSample.isAnalysisTypeCOMPILED()){
if (theSample.isSampleTypeProject() && theSample.isAnalysisTypeCOMPILED()) {
manageProjectRawData_button.setText("Manage Project");
} else {
manageProjectRawData_button.setText("Project Raw Data");
manageProjectRawData_button.setText("Project Raw Data");
}
}

Expand Down Expand Up @@ -1490,7 +1487,8 @@ public void loadAndShowReportTableData() {

private void openTheSample(File selFile, boolean checkSavedStatus) throws BadLabDataException {

forceCloseOfSampleDateInterpretations();
// forceCloseOfSampleDateInterpretations();
closeProjectAndOrSample();

if (checkSavedStatus) {
checkSavedStatusTheSample();
Expand All @@ -1499,8 +1497,7 @@ private void openTheSample(File selFile, boolean checkSavedStatus) throws BadLab
setLiveUpdateTimerIsRunning(false);

EarthTimeSerializedFileInterface deserializedFile
= //
(EarthTimeSerializedFileInterface) ETSerializer.GetSerializedObjectFromFile(selFile.getPath());
= (EarthTimeSerializedFileInterface) ETSerializer.GetSerializedObjectFromFile(selFile.getPath());

// TODO: Oct 2011 check for Project file?? or is it automatically a project file
// created here for a single sample??
Expand Down Expand Up @@ -1549,16 +1546,29 @@ private void openTheSample(File selFile, boolean checkSavedStatus) throws BadLab

}

private void closeProjectAndOrSample() {

try {
closeTheSample();
} catch (BadLabDataException badLabDataException) {
}
try {
closeTheProject();
} catch (BadLabDataException badLabDataException) {
}

}

private boolean closeTheSample() throws BadLabDataException {

boolean retval = checkSavedStatusTheSample();

setLiveUpdateTimerIsRunning(false);

forceCloseOfSampleDateInterpretations();
closeOpenDialogs();

if (retval) {
setUpEmptySample();//theSample.getSampleType() );
setUpEmptySample();
}

return retval;
Expand All @@ -1567,12 +1577,19 @@ private boolean closeTheSample() throws BadLabDataException {
private boolean closeTheProject() throws BadLabDataException {

saveTheProject();
forceCloseOfSampleDateInterpretations();
closeOpenDialogs();

setUpEmptySample();

return true;
}

private void closeOpenDialogs() {
GeochronProjectExportManager.removeInstance();

forceCloseOfSampleDateInterpretations();
}

private void setUpEmptySample() //
throws BadLabDataException {
theSample
Expand Down Expand Up @@ -2933,7 +2950,7 @@ public void menuCanceled(javax.swing.event.MenuEvent evt) {
});

helpMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
helpMenuItem.setText("Help-currently under construction");
helpMenuItem.setText("Help from CIRDLES.org");
helpMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
helpMenuItemActionPerformed(evt);
Expand Down Expand Up @@ -4139,13 +4156,8 @@ private void dibbs_USeriesActionPerformed(java.awt.event.ActionEvent evt) {//GEN
}//GEN-LAST:event_dibbs_USeriesActionPerformed

private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
//Needed for having a nice look in windows... weird
ETReduxFrame.setDefaultLookAndFeelDecorated(false);
HelpBroker heb = JHelpAction.getHelpBroker();
//To Bypass the modal parent window issue.
((DefaultHelpBroker) heb).setActivationWindow(this);
JHelpAction.setHelpBroker(heb);
JHelpAction.showHelp();
BrowserControl.displayURL("http://cirdles.org/projects/et_redux/");

}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem ID_TIMSLegacyAnalysis_MIT_menuItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ public void generateSetOfFitFunctions(boolean propagateUncertainties, boolean do

// dec 2014 ... needs refactoring to be property
// ?always true for sessions USING_FULL_PROPAGATION = tripoliSession.getRawDataFileHandler().getAcquisitionModel().isUsingFullPropagation();// RawRatioDataModel.USING_FULL_PROPAGATION;

// for plotting - want to show all even those excluded
int countOfAllStandards = standardFractions.size();
allStandardsMeanLogRatios = new double[countOfAllStandards];
Expand All @@ -182,13 +181,15 @@ public void generateSetOfFitFunctions(boolean propagateUncertainties, boolean do
while (fractionIterator.hasNext()) {
TripoliFraction tf = fractionIterator.next();

RawRatioDataModel rawRatio = //
RawRatioDataModel rawRatio
= //
((RawRatioDataModel) tf.getRawRatioDataModelByName(rawRatioName));

allStandardsMeanLogRatios[index] = //
allStandardsMeanLogRatios[index]
= //
rawRatio.getSessionValueBySessionTechnique(sessionTechnique);
allStandardsMeanLogRatioStdErrs[index] = //
rawRatio.getSessionErrorBySessionTechnique(sessionTechnique);
allStandardsMeanLogRatioStdErrs[index]
= rawRatio.getSessionErrorBySessionTechnique(sessionTechnique);

index++;

Expand Down Expand Up @@ -217,11 +218,14 @@ public void generateSetOfFitFunctions(boolean propagateUncertainties, boolean do
includedStandardsDataActiveMap[index] = true;
includedStandardsAquireTimes[index] = tf.getZeroBasedNormalizedTimeStamp();

RawRatioDataModel rawRatio = //
RawRatioDataModel rawRatio
= //
((RawRatioDataModel) tf.getRawRatioDataModelByName(rawRatioName));
includedStandardsMeanLogRatios[index] = //
includedStandardsMeanLogRatios[index]
= //
rawRatio.getSessionValueBySessionTechnique(sessionTechnique);
includedStandardsMeanLogRatioStdErrs[index] = //
includedStandardsMeanLogRatioStdErrs[index]
= //
rawRatio.getSessionErrorBySessionTechnique(sessionTechnique);
sessionIncludedStandardsCovariance.set( //
index, index, rawRatio.getSessionVarianceBySessionTechnique(sessionTechnique));
Expand All @@ -233,7 +237,8 @@ public void generateSetOfFitFunctions(boolean propagateUncertainties, boolean do
if (countOfIncludedStandards > 0) {
// begin section 8 of uncertainty propagation paper

RawRatioDataModel rawRatioFirst = //
RawRatioDataModel rawRatioFirst
= //
((RawRatioDataModel) getActiveStandardFractions().first().getRawRatioDataModelByName(rawRatioName));
if (rawRatioFirst.hasTwoIdenticalIonCounters()) {
// calculate the covariance between each pair of standards
Expand All @@ -244,15 +249,17 @@ public void generateSetOfFitFunctions(boolean propagateUncertainties, boolean do
while (fractionIterator.hasNext()) {
TripoliFraction tf = fractionIterator.next();

RawRatioDataModel rawRatio = //
RawRatioDataModel rawRatio
= //
((RawRatioDataModel) tf.getRawRatioDataModelByName(rawRatioName));

dLrInt_dDt.set(index2, 0, rawRatio.getSelectedFitFunction().getdLrInt_dDt());

index2++;
}

double deadtimeUnctSqr = //
double deadtimeUnctSqr
= //
((IonCounterCollectorModel) rawRatioFirst.getBotIsotope().getCollectorModel())//
.getDeadTime().getOneSigmaAbs().movePointLeft(0).pow(2).doubleValue();

Expand Down Expand Up @@ -548,7 +555,7 @@ private void generateSPLINEfitFunction(Matrix mySessionIncludedStandardsCovarian
// oct 2014 use overdispersion from LINE function
double myOverDispersion = 0.0;//fOfXexist.getOverDispersion();
//if (myOverDispersion == 0.0) {
if(sessionOfStandardsFitFunctionsWithOD.containsKey(FitFunctionTypeEnum.LINE.getName())){
if (sessionOfStandardsFitFunctionsWithOD.containsKey(FitFunctionTypeEnum.LINE.getName())) {
myOverDispersion = sessionOfStandardsFitFunctionsWithOD.get(FitFunctionTypeEnum.LINE.getName()).getOverDispersion();
}
// try {
Expand Down Expand Up @@ -582,7 +589,6 @@ private void calculateFitFunctions() {
+ " USING " + (USING_FULL_PROPAGATION ? "FULL PROPAGATION" : "FAST PROPAGATION"));

////// FitFunctionTypeEnum saveSelectedFitFunctionType = selectedFitFunctionType;

if (generateMEANfitFunctionUsingLM()) {
try {
generateLINEfitFunctionUsingLM();
Expand All @@ -601,7 +607,6 @@ private void calculateFitFunctions() {
//// if (saveSelectedFitFunctionType != null) {
//// selectedFitFunctionType = saveSelectedFitFunctionType;
//// }

System.out.println("Session complete\n");

}
Expand All @@ -619,7 +624,7 @@ public SortedMap<Double, AbstractFunctionOfX> generateSetOfSplineWithODfitFuncti
sessionSplineRangeOD = new SessionSplineRangeOD();

// safety valve
if (increment == 0){
if (increment == 0) {
increment = (stopValue - startValue) / 10.0;
}
for (double i = startValue; i < stopValue; i += increment) {
Expand All @@ -645,8 +650,6 @@ public SortedMap<Double, AbstractFunctionOfX> generateSetOfSplineWithODfitFuncti
// } else {
// sessionOfStandardsSplinesWithOD.put(Math.sqrt(fOfX_SMOOTHING_SPLINE.getOverDispersion()), fOfX_SMOOTHING_SPLINE);
// }


// oct 2014 new take
// stop processing if roughness bad
if (Double.isNaN(fOfX_SMOOTHING_SPLINE.getLogRoughness())) {//|| (fOfX_SMOOTHING_SPLINE.getLogRoughness() < -41.0)) {
Expand All @@ -662,7 +665,6 @@ public SortedMap<Double, AbstractFunctionOfX> generateSetOfSplineWithODfitFuncti
// }
// } catch (Exception e) {
// }

break;
} else {
//sessionOfStandardsSplinesWithOD.put(Math.sqrt(fOfX_SMOOTHING_SPLINE.getOverDispersion()), fOfX_SMOOTHING_SPLINE);
Expand All @@ -678,7 +680,8 @@ public SortedMap<Double, AbstractFunctionOfX> generateSetOfSplineWithODfitFuncti
private AbstractFunctionOfX generateSplineWithSpecificOD(double overDispersion) {
int rowColCount = sessionIncludedStandardsCovariance.getRowDimension();

Matrix sessionIncludedStandardsCovarianceCopyWithOD = //
Matrix sessionIncludedStandardsCovarianceCopyWithOD
= //
sessionIncludedStandardsCovariance.plus(Matrix.identity(rowColCount, rowColCount).times(overDispersion));

AbstractFunctionOfX fOfX_SMOOTHING_SPLINE_WITH_OD = SmoothingSplineWithCov.getInstance().getFunctionOfX(//
Expand Down Expand Up @@ -718,7 +721,6 @@ public Map<String, AbstractFunctionOfX> getFitFunctions() {
// @Override
// public void calculateFittedFunctions(String fitFunctionTypeName) {
// }

/**
*
* @param selectedFitFunctionType
Expand Down Expand Up @@ -757,7 +759,7 @@ public AbstractFunctionOfX getSelectedFitFunction() {
public AbstractFunctionOfX getSelectedDownHoleFitFunction() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

/**
*
* @param fitFunctionType
Expand Down Expand Up @@ -825,7 +827,6 @@ public double[] getIncludedStandardsAquireTimes() {
return includedStandardsAquireTimes.clone();
}


/**
* @return the includedStandardsMeanLogRatios
*/
Expand Down Expand Up @@ -870,7 +871,6 @@ public SortedSet<TripoliFraction> getActiveStandardFractions() {
//// public boolean[] getDataActiveMap() {
//// return includedStandardsDataActiveMap;
//// }

/**
* @return the sessionTechnique
*/
Expand Down
Loading

0 comments on commit aba9943

Please sign in to comment.