Skip to content

Commit 4494d2b

Browse files
authored
Various new features and fixes. (#631)
* Refined parsing of excel tasks from squid 2.5 * Added Orig function for column swapping and improved parsing of Squid25 tasks * Added groundwork for custom WMs for RefMat * Proposed fix to #629 * Fixed #615 * Prepared for RefMat WM * Fixed #630 relative to audit window * Refactored * Prepared for column swapping part I * updated demo
1 parent 773834b commit 4494d2b

File tree

41 files changed

+2386
-1718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2386
-1718
lines changed

common.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ apply plugin: 'java'
66
apply plugin: 'maven'
77

88
String mavenGroupId = 'org.cirdles'
9-
String mavenVersion = '1.7.10'
9+
String mavenVersion = '1.8.1'
1010

1111
sourceCompatibility = '1.8'
1212
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

squidApp/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ mainClassName = 'org.cirdles.squid.gui.SquidUI'
2222
dependencies {
2323
implementation 'org.jetbrains:annotations:20.1.0'
2424
implementation 'org.jetbrains:annotations:20.1.0'
25+
implementation "com.github.cirdles:LudwigLibrary:ae99e60ae0"
2526
compile project(":squidCore")
2627

2728
compile group: 'org.apache.xmlgraphics', name: 'batik-svg-dom', version: '1.9.1'

squidApp/src/main/java/org/cirdles/squid/gui/MassesAuditController.java

+23-22
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class MassesAuditController implements Initializable, MassAuditRefreshInt
7777
private static boolean showSpotLabels;
7878
private static boolean synchedScrolls;
7979
// binary: 00= masses, 01 = SBM, 10 = Counts; 11 = both SBM and Counts
80-
private static int countsRadioButtonChoice = 0B00;
80+
private static int countsRadioButtonChoice;
8181
private final int BUTTON_WIDTH = 60;
8282
private final int COMBO_WIDTH = 210;
8383
private final int ROW_HEIGHT = 30;
@@ -92,9 +92,9 @@ public class MassesAuditController implements Initializable, MassAuditRefreshInt
9292
private List<AbstractDataView> trailingGraphs;
9393

9494
// 1-based counting of spots
95-
private int zoomedStart = 5;
96-
private int zoomedWidth = 40;
97-
private int zoomedEnd = zoomedStart + zoomedWidth - 1;
95+
private int zoomedStart;
96+
private int zoomedWidth;
97+
private int zoomedEnd;
9898

9999
@FXML
100100
private Accordion massesAccordian;
@@ -136,6 +136,8 @@ public class MassesAuditController implements Initializable, MassAuditRefreshInt
136136
@Override
137137
public void initialize(URL url, ResourceBundle rb) {
138138

139+
countsRadioButtonChoice = 0B00;
140+
139141
setupMassStationDetailsListViews();
140142
setupMassDeltas();
141143

@@ -161,6 +163,12 @@ public void initialize(URL url, ResourceBundle rb) {
161163

162164
calculateCountOfScansCumulative();
163165

166+
zoomedWidth = Math.min(40, squidProject.getTask().getShrimpFractions().size() - 0);
167+
zoomedStart = zoomedWidth == 40 ? 5 : 1;
168+
zoomedEnd = zoomedStart + zoomedWidth - 1;
169+
170+
zoomScrollBar.setVisible(zoomedWidth == 40);
171+
164172
zoomScrollBar.setValue(zoomedStart);
165173
zoomScrollBar.valueProperty().addListener(new ChangeListener<Number>() {
166174
public void changed(ObservableValue<? extends Number> ov,
@@ -172,7 +180,7 @@ public void changed(ObservableValue<? extends Number> ov,
172180
zoomedEnd = zoomedStart + zoomedWidth - 1;
173181
} else {
174182
zoomedEnd = ((zoomedEnd + delta) <= (zoomScrollBar.getMax())) ? (zoomedEnd + delta) : (int) zoomScrollBar.getMax();
175-
zoomedStart = zoomedEnd - zoomedWidth + 1;
183+
zoomedStart = Math.max(1, zoomedEnd - zoomedWidth + 1);
176184
}
177185
updateAllMassesCanvases(savedZoomedStart);
178186
}
@@ -422,13 +430,6 @@ private void produceMassModeGraphOnScrolledPane(int massCounter, String title, L
422430
legendCanvas.paint(gc0);
423431

424432
// prepare for three plots (canvas) = leadingSpots, zoomedSpots, trailingSpots
425-
// test zoom window
426-
zoomedWidth = zoomedEnd - zoomedStart + 1;
427-
if (zoomedEnd >= squidProject.getPrawnFileRuns().size()) {
428-
zoomedEnd = squidProject.getPrawnFileRuns().size() - 1;
429-
zoomedStart = zoomedEnd - zoomedWidth + 1;
430-
}
431-
432433
HBox graphsBox = new HBox();
433434
scrolledBox.getChildren().add(graphsBox);
434435

@@ -603,19 +604,19 @@ private void updateAllMassesCanvases(int savedZoomedStart) {
603604
// adjust selections
604605
List<Integer> shiftedIndices = new ArrayList<>();
605606
List<PrawnFile.Run> shiftedRuns = new ArrayList<>();
606-
if (!((AbstractDataView)zoomingGraphs.get(0)).getListOfSelectedIndices().isEmpty()){
607+
if (!AbstractDataView.getListOfSelectedIndices().isEmpty()) {
607608
int shift = zoomedStart - savedZoomedStart;
608-
Integer[] targetArray = ((AbstractDataView)zoomingGraphs.get(0)).getListOfSelectedIndices().toArray(new Integer[0]);
609+
Integer[] targetArray = AbstractDataView.getListOfSelectedIndices().toArray(new Integer[0]);
609610

610-
for (int i = 0; i < targetArray.length; i ++){
611+
for (int i = 0; i < targetArray.length; i++) {
611612
targetArray[i] -= shift;
612-
if ((targetArray[i] >= 0) && (targetArray[i] < zoomedWidth)){
613+
if ((targetArray[i] >= 0) && (targetArray[i] < zoomedWidth)) {
613614
shiftedIndices.add(targetArray[i]);
614-
shiftedRuns.add(((SpeciesGraphInterface)zoomingGraphs.get(0)).getPrawnFileRuns().get(targetArray[i]));
615+
shiftedRuns.add(((SpeciesGraphInterface) zoomingGraphs.get(0)).getPrawnFileRuns().get(targetArray[i]));
615616
}
616617
}
617618
}
618-
updateGraphsWithSelectedIndices(shiftedIndices, shiftedRuns,0);
619+
updateGraphsWithSelectedIndices(shiftedIndices, shiftedRuns, 0);
619620

620621
// trailing canvas
621622
int endTrailingIndex = ((SpeciesGraphInterface) legendGraphs.get(0)).getMeasuredTrimMasses().size();
@@ -936,19 +937,19 @@ public void updateGraphsWithSelectedIndices(List<Integer> listOfSelectedSpotsInd
936937
List<AbstractDataView> activeGraphs = new ArrayList<>();
937938
switch (leadingZoomingTrailing) {
938939
case -1:
939-
// activeGraphs.addAll(leadingGraphs);
940+
// activeGraphs.addAll(leadingGraphs);
940941
break;
941942
case 0:
942943
activeGraphs.addAll(zoomingGraphs);
943944
break;
944945
case 1:
945-
// activeGraphs.addAll(trailingGraphs);
946+
// activeGraphs.addAll(trailingGraphs);
946947
break;
947948
}
948949

949950
for (int i = 0; i < activeGraphs.size(); i++) {
950-
activeGraphs.get(i).setListOfSelectedIndices(listOfSelectedSpotsIndices);
951-
activeGraphs.get(i).setSelectedRuns(selectedRuns);
951+
AbstractDataView.setListOfSelectedIndices(listOfSelectedSpotsIndices);
952+
AbstractDataView.setSelectedRuns(selectedRuns);
952953
activeGraphs.get(i).repaint();
953954
}
954955
}

squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -1522,10 +1522,18 @@ private void referenceMaterialConcordiaAction(ActionEvent event) {
15221522
launchConcordiaAndWeightedMeanPlots();
15231523
}
15241524

1525+
@FXML
1526+
private void referenceMaterialCalibrationConstAction(ActionEvent event) {
1527+
PlotsController.fractionTypeSelected = SpotTypes.REFERENCE_MATERIAL;
1528+
PlotsController.plotTypeSelected = PlotTypes.CALIBRATION_CONSTANT;
1529+
PlotsController.currentlyPlottedSampleTreeNode = null;
1530+
launchConcordiaAndWeightedMeanPlots();
1531+
}
1532+
15251533
@FXML
15261534
private void referenceMaterialWMAction(ActionEvent event) {
15271535
PlotsController.fractionTypeSelected = SpotTypes.REFERENCE_MATERIAL;
1528-
PlotsController.plotTypeSelected = PlotTypes.WEIGHTED_MEAN;
1536+
PlotsController.plotTypeSelected = PlotTypes.WEIGHTED_MEAN_RM;
15291537
PlotsController.currentlyPlottedSampleTreeNode = null;
15301538
launchConcordiaAndWeightedMeanPlots();
15311539
}

squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/countCorrections/CountCorrectionsController.java

+16-20
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,10 @@
1515
*/
1616
package org.cirdles.squid.gui.dateInterpretations.countCorrections;
1717

18-
import java.net.URL;
19-
import java.util.Formatter;
20-
import java.util.List;
21-
import java.util.Map;
22-
import java.util.ResourceBundle;
2318
import javafx.event.ActionEvent;
2419
import javafx.fxml.FXML;
2520
import javafx.fxml.Initializable;
26-
import javafx.scene.control.Button;
27-
import javafx.scene.control.Label;
28-
import javafx.scene.control.RadioButton;
29-
import javafx.scene.control.ToggleGroup;
30-
import javafx.scene.control.TreeItem;
31-
import javafx.scene.control.TreeView;
21+
import javafx.scene.control.*;
3222
import javafx.scene.layout.AnchorPane;
3323
import javafx.scene.layout.HBox;
3424
import javafx.scene.layout.VBox;
@@ -37,18 +27,24 @@
3727
import javafx.scene.text.Text;
3828
import javafx.scene.text.TextFlow;
3929
import org.cirdles.squid.constants.Squid3Constants;
30+
import org.cirdles.squid.gui.SquidUIController;
31+
import org.cirdles.squid.shrimp.ShrimpFraction;
32+
import org.cirdles.squid.shrimp.ShrimpFractionExpressionInterface;
33+
import org.cirdles.squid.tasks.expressions.spots.SpotSummaryDetails;
34+
import org.cirdles.squid.tasks.taskUtilities.OvercountCorrection;
35+
36+
import java.net.URL;
37+
import java.util.Formatter;
38+
import java.util.List;
39+
import java.util.Map;
40+
import java.util.ResourceBundle;
41+
4042
import static org.cirdles.squid.constants.Squid3Constants.ABS_UNCERTAINTY_DIRECTIVE;
4143
import static org.cirdles.squid.gui.SquidUI.PIXEL_OFFSET_FOR_MENU;
4244
import static org.cirdles.squid.gui.SquidUI.primaryStageWindow;
4345
import static org.cirdles.squid.gui.SquidUIController.squidProject;
44-
45-
import org.cirdles.squid.gui.SquidUIController;
46-
import org.cirdles.squid.shrimp.ShrimpFraction;
47-
import org.cirdles.squid.shrimp.ShrimpFractionExpressionInterface;
4846
import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.BIWT_204_OVR_CTS_FROM_207;
4947
import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.BIWT_204_OVR_CTS_FROM_208;
50-
import org.cirdles.squid.tasks.expressions.spots.SpotSummaryDetails;
51-
import org.cirdles.squid.tasks.taskUtilities.OvercountCorrection;
5248

5349
/**
5450
* FXML Controller class
@@ -166,9 +162,9 @@ private void showUnknownsWithOvercountCorrections() {
166162

167163
double[][] r204_206 = ((ShrimpFraction) spot).getOriginalIsotopicRatioValuesByStringName("204/206");
168164
double[][] r204_206_207 = spot.getTaskExpressionsEvaluationsPerSpot()
169-
.get(squidProject.getTask().getNamedExpressionsMap().get("CountCorrectionExpression204From207"));
165+
.get(squidProject.getTask().getNamedExpressionsMap().get("SWAPCountCorrectionExpression204From207"));
170166
double[][] r204_206_208 = spot.getTaskExpressionsEvaluationsPerSpot()
171-
.get(squidProject.getTask().getNamedExpressionsMap().get("CountCorrectionExpression204From208"));
167+
.get(squidProject.getTask().getNamedExpressionsMap().get("SWAPCountCorrectionExpression204From208"));
172168

173169
TextFlow textFlowI = new TextFlow();
174170

@@ -248,4 +244,4 @@ private void returnOnAction(ActionEvent actionEvent) {
248244
SquidUIController primaryStageController = (SquidUIController) primaryStageWindow.getScene().getUserData();
249245
primaryStageController.launchCommonLeadAssignment();
250246
}
251-
}
247+
}

squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/plots/plotControllers/PlotsController.java

+82-6
Original file line numberDiff line numberDiff line change
@@ -742,12 +742,12 @@ public void calculateWeightedMean() {
742742
}
743743

744744
@Override
745-
public void showRefMatWeightedMeanPlot() {
745+
public void showRefMatCalibrationConstantPlot() {
746746
// may 2020 new approach per Nicole
747747
if (vboxMaster.getChildren().get(0) instanceof ToolBoxNodeInterface) {
748748
vboxMaster.getChildren().remove(0);
749749
}
750-
HBox toolBox = new RefMatWeightedMeanControlNode(this);
750+
HBox toolBox = new RefMatCalibrationConstantWMControlNode(this);
751751
vboxMaster.getChildren().add(0, toolBox);
752752

753753
// get details
@@ -892,7 +892,7 @@ public void updateItem(SampleTreeNodeInterface item, boolean empty) {
892892
}
893893

894894
private void showSampleWeightedMeanPlot() {
895-
// dec 2019 new approach per Nicole
895+
// dec 2019 new approach per @NicoleRayner
896896
if (vboxMaster.getChildren().get(0) instanceof ToolBoxNodeInterface) {
897897
vboxMaster.getChildren().remove(0);
898898
}
@@ -962,6 +962,77 @@ public TreeItem<SampleTreeNodeInterface> fromString(String string) {
962962

963963
}
964964

965+
private void showRMWeightedMeanPlot() {
966+
// MAY 2021 requested by @NicoleRayner
967+
if (vboxMaster.getChildren().get(0) instanceof ToolBoxNodeInterface) {
968+
vboxMaster.getChildren().remove(0);
969+
}
970+
HBox toolBox = new RefMatWeightedMeanToolBoxNode(this);
971+
vboxMaster.getChildren().add(0, toolBox);
972+
973+
spotsTreeViewCheckBox.setCellFactory(cell -> new CheckBoxTreeCell<>(
974+
(TreeItem<SampleTreeNodeInterface> item) -> item.getValue().getSelectedProperty(),
975+
new StringConverter<TreeItem<SampleTreeNodeInterface>>() {
976+
977+
@Override
978+
public String toString(TreeItem<SampleTreeNodeInterface> object) {
979+
SampleTreeNodeInterface item = object.getValue();
980+
// the goal is to show the nodename + weightedMean source + value of sorting choice if different
981+
String nodeStringWM = "";
982+
if (object.getParent() != null) {
983+
984+
String wmExpressionName
985+
= ((SampleNode) object.getParent().getValue()).getSpotSummaryDetailsWM().getExpressionTree().getName().split("_WM_")[0];
986+
double[][] wmExpressionValues;
987+
if (stringIsSquidRatio(wmExpressionName)) {
988+
// ratio case
989+
wmExpressionValues
990+
= Arrays.stream(item.getShrimpFraction()
991+
.getIsotopicRatioValuesByStringName(wmExpressionName)).toArray(double[][]::new);
992+
} else {
993+
wmExpressionValues = item.getShrimpFraction()
994+
.getTaskExpressionsEvaluationsPerSpotByField(wmExpressionName);
995+
}
996+
997+
String ageOrValueSourceOfWM;
998+
double uncertainty = 0.0;
999+
if (wmExpressionValues[0].length > 1) {
1000+
uncertainty = wmExpressionValues[0][1];
1001+
}
1002+
if (wmExpressionName.contains("Age")) {
1003+
ageOrValueSourceOfWM = WeightedMeanPlot.makeAgeString(wmExpressionValues[0][0], uncertainty);
1004+
} else {
1005+
ageOrValueSourceOfWM = WeightedMeanPlot.makeValueString(wmExpressionValues[0][0], uncertainty);
1006+
}
1007+
nodeStringWM = item.getShrimpFraction().getFractionID() + " " + ageOrValueSourceOfWM;
1008+
1009+
String sortingExpression = ((SampleNode) object.getParent().getValue()).getSpotSummaryDetailsWM().getSelectedExpressionName();
1010+
// check to see if sorted by same field
1011+
if ((item instanceof WeightedMeanSpotNode)
1012+
&& (wmExpressionName.compareToIgnoreCase(sortingExpression) != 0)) {
1013+
nodeStringWM += prettyPrintSortedWM(item.getShrimpFraction(), sortingExpression);
1014+
}
1015+
1016+
}
1017+
return (object.getParent() == null) ? object.getValue().getNodeName() : (item instanceof SampleNode) ? "" : nodeStringWM;
1018+
}
1019+
1020+
@Override
1021+
public TreeItem<SampleTreeNodeInterface> fromString(String string) {
1022+
throw new UnsupportedOperationException("Not supported yet.");
1023+
}
1024+
1025+
}));
1026+
1027+
spotListAnchorPane.getChildren().clear();
1028+
spotListAnchorPane.getChildren().add(spotsTreeViewCheckBox);
1029+
spotsTreeViewCheckBox.prefHeightProperty().bind(spotListAnchorPane.prefHeightProperty());
1030+
spotsTreeViewCheckBox.prefWidthProperty().bind(spotListAnchorPane.prefWidthProperty());
1031+
1032+
refreshPlot();
1033+
1034+
}
1035+
9651036
private String prettyPrintSortedWM(ShrimpFractionExpressionInterface shrimpFraction, String sortingExpression) {
9661037
String nodeStringWM = "";
9671038

@@ -1001,8 +1072,11 @@ public void showActivePlot() {
10011072
case TERA_WASSERBURG:
10021073
showConcordiaPlotsOfUnknownsOrRefMat();
10031074
break;
1004-
case WEIGHTED_MEAN:
1005-
showRefMatWeightedMeanPlot();
1075+
case CALIBRATION_CONSTANT:
1076+
showRefMatCalibrationConstantPlot();
1077+
break;
1078+
case WEIGHTED_MEAN_RM:
1079+
showRMWeightedMeanPlot();
10061080
break;
10071081
case WEIGHTED_MEAN_SAMPLE:
10081082
showSampleWeightedMeanPlot();
@@ -1015,10 +1089,12 @@ public void showActivePlot() {
10151089
public enum PlotTypes {
10161090
CONCORDIA("CONCORDIA"),
10171091
TERA_WASSERBURG("TERA_WASSERBURG"),
1018-
WEIGHTED_MEAN("WEIGHTED_MEAN"),
1092+
CALIBRATION_CONSTANT("CALIBRATION_CONSTANT"),
1093+
WEIGHTED_MEAN_RM("WEIGHTED_MEAN_RM"),
10191094
WEIGHTED_MEAN_SAMPLE("WEIGHTED_MEAN_SAMPLE"),
10201095
ANY_TWO("ANY_TWO");
10211096

1097+
10221098
private final String plotType;
10231099

10241100
PlotTypes(String plotType) {

0 commit comments

Comments
 (0)