diff --git a/common.gradle b/common.gradle index 7d818ae4..247b5669 100644 --- a/common.gradle +++ b/common.gradle @@ -7,7 +7,7 @@ apply plugin: 'maven-publish' String mavenGroupId = 'org.cirdles' -String mavenVersion = '2.0.8' +String mavenVersion = '2.0.9' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' diff --git a/squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/commonLeadAssignment/CommonLeadAssignmentController.java b/squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/commonLeadAssignment/CommonLeadAssignmentController.java index b4fa4b79..eb3dc009 100644 --- a/squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/commonLeadAssignment/CommonLeadAssignmentController.java +++ b/squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/commonLeadAssignment/CommonLeadAssignmentController.java @@ -125,6 +125,10 @@ public void initialize(URL url, ResourceBundle rb) { } private void init() throws SquidException { + if (squidProject.getTask().getOvercountCorrectionType().equals(Squid3Constants.OvercountCorrectionTypes.FR_Custom)) + { + OvercountCorrection.correctionCustom(squidProject.getTask()); + } // update try { squidProject.getTask().setupSquidSessionSpecsAndReduceAndReport(false); @@ -161,10 +165,13 @@ private void init() throws SquidException { mapOfWeightedMeansBySampleNames.put(entry.getKey(), spotSummaryDetails); } -// showUnknownsWithOvercountCorrections(); + ExpressionTreeInterface customExpression = squidProject.getTask().getNamedExpressionsMap().get(SWAP_CUSTOM_CORRECTION_204); + if ((customExpression == null) || !customExpression.isValueModel()){ + customSWAPRB.setDisable(true); + squidProject.getTask().setOvercountCorrectionType(Squid3Constants.OvercountCorrectionTypes.NONE); + correctionNoneRB.setSelected(true); + } - ExpressionTreeInterface customExpression = squidProject.getTask().getNamedExpressionsMap().get("SWAPCustomCorrection204"); - customSWAPRB.setDisable((customExpression == null) || !customExpression.isValueModel()); switch (squidProject.getTask().getOvercountCorrectionType()) { case NONE: correctionNoneRB.setSelected(true); @@ -177,7 +184,6 @@ private void init() throws SquidException { break; case FR_Custom: customSWAPRB.setSelected(true); - OvercountCorrection.correctionCustom(squidProject.getTask()); } showUnknownsWithOvercountCorrections(); @@ -228,7 +234,7 @@ public void setUpHeader() { biweight208Label.setText("biWgt 204 ovrCnts: " + formatter); - customSWAPLabel.setText("SWAPCustomCorrection204"); + customSWAPLabel.setText(SWAP_CUSTOM_CORRECTION_204); viewDetailsButton.setStyle("-fx-font-size: 12px;-fx-font-weight: bold; -fx-padding: 0 0 0 0;"); } diff --git a/squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/countCorrections/CountCorrectionsController.java b/squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/countCorrections/CountCorrectionsController.java index 57abb277..ba4b6661 100644 --- a/squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/countCorrections/CountCorrectionsController.java +++ b/squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/countCorrections/CountCorrectionsController.java @@ -44,8 +44,7 @@ import static org.cirdles.squid.gui.SquidUI.PIXEL_OFFSET_FOR_MENU; import static org.cirdles.squid.gui.SquidUI.primaryStageWindow; import static org.cirdles.squid.gui.SquidUIController.squidProject; -import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.BIWT_204_OVR_CTS_FROM_207; -import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.BIWT_204_OVR_CTS_FROM_208; +import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.*; /** * FXML Controller class @@ -84,6 +83,13 @@ public class CountCorrectionsController implements Initializable { */ @Override public void initialize(URL url, ResourceBundle rb) { + if (squidProject.getTask().getOvercountCorrectionType().equals(Squid3Constants.OvercountCorrectionTypes.FR_Custom)) { + try { + OvercountCorrection.correctionCustom(squidProject.getTask()); + } catch (SquidException e) { +// throw new RuntimeException(e); + } + } // update try { squidProject.getTask().setupSquidSessionSpecsAndReduceAndReport(false); @@ -95,8 +101,12 @@ public void initialize(URL url, ResourceBundle rb) { spotsTreeViewTextFlow.prefHeightProperty().bind(primaryStageWindow.getScene().heightProperty() .subtract(PIXEL_OFFSET_FOR_MENU + headerHBox.getPrefHeight())); - ExpressionTreeInterface customExpression = squidProject.getTask().getNamedExpressionsMap().get("SWAPCustomCorrection204"); - customSWAPRB.setDisable((customExpression == null) || !customExpression.isValueModel()); + ExpressionTreeInterface customExpression = squidProject.getTask().getNamedExpressionsMap().get(SWAP_CUSTOM_CORRECTION_204); + if ((customExpression == null) || !customExpression.isValueModel()) { + customSWAPRB.setDisable(true); + squidProject.getTask().setOvercountCorrectionType(Squid3Constants.OvercountCorrectionTypes.NONE); + } + switch (squidProject.getTask().getOvercountCorrectionType()) { case NONE: correctionNoneRB.setSelected(true); @@ -109,11 +119,6 @@ public void initialize(URL url, ResourceBundle rb) { break; case FR_Custom: customSWAPRB.setSelected(true); - try { - OvercountCorrection.correctionCustom(squidProject.getTask()); - } catch (SquidException e) { -// throw new RuntimeException(e); - } } setUpHeader(); @@ -181,10 +186,10 @@ private void showUnknownsWithOvercountCorrections() { double[][] r204_206_208 = spot.getTaskExpressionsEvaluationsPerSpot() .get(squidProject.getTask().getNamedExpressionsMap().get("SWAPCountCorrectionExpression204From208")); double[][] custom204 = new double[r204_206_208.length][r204_206_208[0].length]; - ExpressionTreeInterface customExp = squidProject.getTask().getNamedExpressionsMap().get("SWAPCustomCorrection204"); + ExpressionTreeInterface customExp = squidProject.getTask().getNamedExpressionsMap().get(SWAP_CUSTOM_CORRECTION_204); if ((null != customExp) && customExp.isValueModel()) { custom204 = spot.getTaskExpressionsEvaluationsPerSpot() - .get(squidProject.getTask().getNamedExpressionsMap().get("SWAPCustomCorrection204")); + .get(squidProject.getTask().getNamedExpressionsMap().get(SWAP_CUSTOM_CORRECTION_204)); } TextFlow textFlowI = new TextFlow(); diff --git a/squidApp/src/main/resources/org/cirdles/squid/gui/parameters/SquidParametersManagerGUI.fxml b/squidApp/src/main/resources/org/cirdles/squid/gui/parameters/SquidParametersManagerGUI.fxml index 5edd8001..f90d522b 100644 --- a/squidApp/src/main/resources/org/cirdles/squid/gui/parameters/SquidParametersManagerGUI.fxml +++ b/squidApp/src/main/resources/org/cirdles/squid/gui/parameters/SquidParametersManagerGUI.fxml @@ -18,7 +18,8 @@ - diff --git a/squidCore/src/main/java/org/cirdles/squid/shrimp/ShrimpFraction.java b/squidCore/src/main/java/org/cirdles/squid/shrimp/ShrimpFraction.java index d4e5bbe3..9535fc89 100644 --- a/squidCore/src/main/java/org/cirdles/squid/shrimp/ShrimpFraction.java +++ b/squidCore/src/main/java/org/cirdles/squid/shrimp/ShrimpFraction.java @@ -28,6 +28,7 @@ import java.math.RoundingMode; import java.util.*; +import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.SWAP_CUSTOM_CORRECTION_204; import static org.cirdles.squid.utilities.conversionUtilities.CloningUtilities.clone2dArray; /** @@ -1001,7 +1002,7 @@ public String getOverCtCorr() { retVal.append("Corrected from 208"); break; case CUSTOM: - retVal.append("SWAPCustomCorrection204"); + retVal.append(SWAP_CUSTOM_CORRECTION_204); break; } return retVal.toString(); diff --git a/squidCore/src/main/java/org/cirdles/squid/tasks/Task.java b/squidCore/src/main/java/org/cirdles/squid/tasks/Task.java index 68d7c2e8..518fa96f 100644 --- a/squidCore/src/main/java/org/cirdles/squid/tasks/Task.java +++ b/squidCore/src/main/java/org/cirdles/squid/tasks/Task.java @@ -503,6 +503,9 @@ public void updateTaskFromTaskDesign(TaskDesign taskDesign, boolean taskSkeleton String targetSampleName = customExp.getName().split("_WM_")[1].trim(); customExp.getExpressionTree().setUnknownsGroupSampleName(targetSampleName); } + if (taskExpressionsOrdered.contains(customExp)) { + taskExpressionsOrdered.remove(customExp); + } taskExpressionsOrdered.add(customExp); } @@ -668,9 +671,10 @@ public void generateBuiltInExpressions() { SortedSet overCountExpressionsOrdered = generateOverCountExpressions(isDirectAltPD()); taskExpressionsOrdered.addAll(overCountExpressionsOrdered); - if (!namedExpressionsMap.containsKey("SWAPCustomCorrection204")) { + if (!namedExpressionsMap.containsKey(SWAP_CUSTOM_CORRECTION_204)) { Expression customExp = buildCountCorrectionCustomExpression(); - namedExpressionsMap.put("SWAPCustomCorrection204", customExp.getExpressionTree()); + namedExpressionsMap.put(SWAP_CUSTOM_CORRECTION_204, customExp.getExpressionTree()); + taskExpressionsOrdered.remove(customExp); taskExpressionsOrdered.add(customExp); } @@ -1080,7 +1084,7 @@ public void updateAllUnknownSpotsWithOverCountCorrectedBy204_206_208() { } public void updateAllUnknownSpotsWithCustomCorrection() { - ExpressionTreeInterface customExp = namedExpressionsMap.get("SWAPCustomCorrection204"); + ExpressionTreeInterface customExp = namedExpressionsMap.get(SWAP_CUSTOM_CORRECTION_204); if ((null != customExp) && customExp.isValueModel()) { for (ShrimpFractionExpressionInterface spot : unknownSpots) { SquidRatiosModel ratio204_206 = ((ShrimpFraction) spot).getRatioByName("204/206"); diff --git a/squidCore/src/main/java/org/cirdles/squid/tasks/TaskInterface.java b/squidCore/src/main/java/org/cirdles/squid/tasks/TaskInterface.java index e97f1641..58f9925d 100644 --- a/squidCore/src/main/java/org/cirdles/squid/tasks/TaskInterface.java +++ b/squidCore/src/main/java/org/cirdles/squid/tasks/TaskInterface.java @@ -40,7 +40,7 @@ import static org.cirdles.squid.constants.Squid3Constants.TaskTypeEnum.GEOCHRON; import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.*; -import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltinExpressionsCountCorrection204.*; +import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltinExpressionsCountCorrection204.buildCountCorrectionCustomExpression; /** * @author James F. Bowring @@ -415,10 +415,6 @@ default void applyDirectives(boolean customizeTaskExpressions) throws SquidExcep } List customExpressions = getCustomTaskExpressions(); - // special temporary case Sep 2019 - customExpressions.remove(buildCountCorrectionExpressionFrom207()); - customExpressions.remove(buildCountCorrectionExpressionFrom208()); - customExpressions.remove(buildCountCorrectionCustomExpression()); getTaskExpressionsOrdered().clear(); @@ -497,6 +493,14 @@ default void applyDirectives(boolean customizeTaskExpressions) throws SquidExcep getTaskExpressionsOrdered().add(parentPPM); } + + Expression defaultCustomExp = buildCountCorrectionCustomExpression(); + if (customExpressions.contains(defaultCustomExp)) { + Expression customExp = customExpressions.get(customExpressions.indexOf(defaultCustomExp)); + getNamedExpressionsMap().put(SWAP_CUSTOM_CORRECTION_204, customExp.getExpressionTree()); + getTaskExpressionsOrdered().remove(defaultCustomExp); + } + getTaskExpressionsOrdered().addAll(customExpressions); setChanged(true); diff --git a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/Expression.java b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/Expression.java index 4b3667b9..7e8e3ca7 100644 --- a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/Expression.java +++ b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/Expression.java @@ -45,6 +45,7 @@ import static org.cirdles.squid.constants.Squid3Constants.*; import static org.cirdles.squid.constants.Squid3Constants.SpotTypes.UNKNOWN; +import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.SWAP_CUSTOM_CORRECTION_204; import static org.cirdles.squid.tasks.expressions.functions.Function.replaceAliasedFunctionNamesInExpressionString; /** @@ -350,6 +351,9 @@ public String getNotes() { if (this.expressionTree.isSquidSpecialUPbThExpression()) { notes = BuiltInExpressionsNotes.BUILTIN_EXPRESSION_NOTES.get(name); } + if (this.expressionTree.getName().compareToIgnoreCase(SWAP_CUSTOM_CORRECTION_204) == 0) { + notes = BuiltInExpressionsNotes.BUILTIN_EXPRESSION_NOTES.get(SWAP_CUSTOM_CORRECTION_204); + } if (this.isParameterValue() || this.isReferenceMaterialValue()) { notes = "from Model: " + sourceModelNameAndVersion + "\n\n" + BuiltInExpressionsNotes.BUILTIN_EXPRESSION_NOTES.get(name); diff --git a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsDataDictionary.java b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsDataDictionary.java index 69aa26a0..e4eb6ef5 100644 --- a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsDataDictionary.java +++ b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsDataDictionary.java @@ -193,6 +193,9 @@ public class BuiltInExpressionsDataDictionary { public static final String RAD_206PB204PB_FACTOR = "Rad_206Pb204Pb_Factor"; public static final String RAD_208PB204PB_FACTOR = "Rad_208Pb204Pb_Factor"; public static final List COMPOSITION_EXPRESSION_NAMES = new ArrayList<>(); + // ************************ CUSTOM SWAPPING ********************* + public static final String SWAP_CUSTOM_CORRECTION_204 = "SWAPCustomCorrection204"; + // ************************ MISC CONSTANTS ********************* private static final String R206_238CALIB_CONST = CALIB_CONST_206_238_ROOT + "_CalibConst"; public static final String PB4COR206_238CALIB_CONST = PB4CORR + R206_238CALIB_CONST; public static final String PB4COR206_238CALIB_CONST_WM = WTDAV_PREFIX + PB4COR206_238CALIB_CONST; diff --git a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsNotes.java b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsNotes.java index 742834bd..aa64beba 100644 --- a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsNotes.java +++ b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsNotes.java @@ -546,5 +546,14 @@ public class BuiltInExpressionsNotes { + " (i.e. the third element of the WtdAv vector output) calculated from " + "any RM dataset of WtdAv_Xcor_208Pb232Th_CalibConst values. In this context, " + "Xcor denotes the index isotope used for the common Pb correction in the RM (i.e. 204Pb or 207Pb)."); + + BUILTIN_EXPRESSION_NOTES.put(SWAP_CUSTOM_CORRECTION_204, + "Edit this expression to calculate a custom corrected value " + + "for 204/206 as per Squid2.5 'column swapping' and invoke it from the Common Pb menu " + + "window for overcounts of 204. \n\n" + + "REQUIRED: Use the expression name '" + SWAP_CUSTOM_CORRECTION_204 + "' and define a ValueModel. \n" + + "The default definition is: 'ValueModel(Orig([\"204/206\"]),Orig([±\"204/206\"]),true)'. \n\n" + + " NOTE: Use the 'Orig' function to retrieve the unmutable value of a ratio. Otherwise, " + + "a circular logic obtains."); } } \ No newline at end of file diff --git a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltinExpressionsCountCorrection204.java b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltinExpressionsCountCorrection204.java index 9ccb3ebb..2eee90db 100644 --- a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltinExpressionsCountCorrection204.java +++ b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltinExpressionsCountCorrection204.java @@ -17,8 +17,7 @@ import org.cirdles.squid.tasks.expressions.Expression; -import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.BIWT_204_OVR_CTS_FROM_207; -import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.BIWT_204_OVR_CTS_FROM_208; +import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.*; import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsFactory.buildExpression; /** @@ -28,7 +27,7 @@ public class BuiltinExpressionsCountCorrection204 { /** * @return - * @see https://github.com/CIRDLES/ET_Redux/wiki/SQ2.50-Procedural-Framework:-Part-7a-(204-overcounts) + * @see ... */ public static Expression buildCountCorrectionExpressionFrom207() { @@ -67,7 +66,7 @@ public static Expression buildCountCorrectionExpressionFrom207() { /** * @return - * @see https://github.com/CIRDLES/ET_Redux/wiki/SQ2.50-Procedural-Framework:-Part-7a-(204-overcounts) + * @see ... */ public static Expression buildCountCorrectionExpressionFrom208() { @@ -107,18 +106,10 @@ public static Expression buildCountCorrectionExpressionFrom208() { public static Expression buildCountCorrectionCustomExpression() { Expression countCorrectionCustom = buildExpression( - "SWAPCustomCorrection204", + SWAP_CUSTOM_CORRECTION_204, "ValueModel(Orig([\"204/206\"]),Orig([±\"204/206\"]),true)", false, true, false); - countCorrectionCustom.getExpressionTree().setSquidSpecialUPbThExpression(true); - countCorrectionCustom.setNotes( - "Edit this expression to calculate a custom corrected value " - + "for 204/206 as per Squid2.5 'column swapping' and invoke it from the Common Pb menu " - + "window for overcounts of 204. \n\n" - + "REQUIRED: Use the expression name 'SWAPCustomCorrection204' and define a ValueModel. \n" - + "The default definition is: 'ValueModel(Orig([\"204/206\"]),Orig([±\"204/206\"]),true)'. \n\n" - + " NOTE: Use the 'Orig' function to retrieve the unmutable value of a ratio. Otherwise, " - + "a circular logic obtains."); + countCorrectionCustom.getExpressionTree().setSquidSpecialUPbThExpression(false); return countCorrectionCustom; } diff --git a/squidCore/src/main/resources/org/cirdles/squid/projects/SQUID3_demo_file.squid b/squidCore/src/main/resources/org/cirdles/squid/projects/SQUID3_demo_file.squid index ea8b7588..c445f9dd 100644 Binary files a/squidCore/src/main/resources/org/cirdles/squid/projects/SQUID3_demo_file.squid and b/squidCore/src/main/resources/org/cirdles/squid/projects/SQUID3_demo_file.squid differ