diff --git a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/AbstractDataView.java b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/AbstractDataView.java
index 16a3e1af..15ebdba5 100644
--- a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/AbstractDataView.java
+++ b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/AbstractDataView.java
@@ -49,8 +49,9 @@ public abstract class AbstractDataView extends Canvas {
protected BigDecimal[] ticsX;
protected BigDecimal[] ticsY;
// protected BigDecimal[] ticsYII;
- private double displayOffsetY = 0;
- private double displayOffsetX = 0;
+ protected double displayOffsetY = 0;
+ protected double displayOffsetX = 0;
+ protected String xAxisLabel;
private AbstractDataView() {
super();
@@ -108,9 +109,9 @@ public void labelXAxis(String label) {
public void showTitle(String title) {
Paint savedPaint = getGraphicsContext2D().getFill();
- getGraphicsContext2D().setFont(Font.font("SansSerif", 14));
+ getGraphicsContext2D().setFont(Font.font("SansSerif", 10));
getGraphicsContext2D().setFill(Paint.valueOf("RED"));
- getGraphicsContext2D().fillText(title, leftMargin + 25, topMargin + 12);
+ getGraphicsContext2D().fillText(title, leftMargin + 25, topMargin + 7);
getGraphicsContext2D().setFill(savedPaint);
}
diff --git a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/GBeamLinePlot.java b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/GBeamLinePlot.java
index 92236a7a..54e5f176 100644
--- a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/GBeamLinePlot.java
+++ b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/GBeamLinePlot.java
@@ -80,7 +80,7 @@ public void paint(GraphicsContext g2d) {
g2d.beginPath();
g2d.setStroke(Paint.valueOf("Blue"));
g2d.setLineDashes(0);
- // x = magnetMass y = intensity
+ // x = magnetMass y = blockIntensities
for (int i = 0; i < xMass.length; i++) {
g2d.lineTo(mapX(xMass[i]), mapY(yIntensity[i]));
diff --git a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/HistogramPlot.java b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/HistogramPlot.java
index 4961d447..3ecd0a1d 100644
--- a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/HistogramPlot.java
+++ b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/HistogramPlot.java
@@ -45,12 +45,13 @@ public void preparePanel() {
minX = xAxisData[0];
maxX = xAxisData[xAxisData.length - 1];
if (histogramBuilder.getHistograms().length > 1) {
- // assume only 2 for now
- minX = Math.min(minX, histogramBuilder.getHistograms()[1].binCenters()[0]);
- maxX = Math.max(maxX, histogramBuilder.getHistograms()[1].binCenters()[histogramBuilder.getHistograms()[1].binCount() - 1]);
+ for (int histogramIndex = 0; histogramIndex < histogramBuilder.getHistograms().length; histogramIndex++) {
+ minX = Math.min(minX, histogramBuilder.getHistograms()[histogramIndex].binCenters()[0]);
+ maxX = Math.max(maxX, histogramBuilder.getHistograms()[histogramIndex].binCenters()[histogramBuilder.getHistograms()[histogramIndex].binCount() - 1]);
+ }
}
- double xMarginStretch = TicGeneratorForAxes.generateMarginAdjustment(minX, maxX, 0.05);
+ double xMarginStretch = TicGeneratorForAxes.generateMarginAdjustment(minX, maxX, 0.25);
minX -= xMarginStretch;
maxX += xMarginStretch;
ticsX = TicGeneratorForAxes.generateTics(minX, maxX, (int) (graphWidth / 40.0));
@@ -64,16 +65,17 @@ public void preparePanel() {
maxY = StrictMath.max(maxY, yAxisDatum);
}
if (histogramBuilder.getHistograms().length > 1) {
- // assume only 2 for now
- for (double yAxisDatum : histogramBuilder.getHistograms()[1].binCounts()) {
- minY = StrictMath.min(minY, yAxisDatum);
- maxY = StrictMath.max(maxY, yAxisDatum);
+ for (int histogramIndex = 0; histogramIndex < histogramBuilder.getHistograms().length; histogramIndex++) {
+ for (double yAxisDatum : histogramBuilder.getHistograms()[histogramIndex].binCounts()) {
+ minY = StrictMath.min(minY, yAxisDatum);
+ maxY = StrictMath.max(maxY, yAxisDatum);
+ }
}
}
// customized for histogram
minY = 0;
- ticsY = TicGeneratorForAxes.generateTics(minY, maxY, (int) (graphHeight / 10.0));
+ ticsY = TicGeneratorForAxes.generateTics(minY, maxY, (int) (graphHeight / 20.0));
// check for no data
if ((ticsY != null) && (ticsY.length > 1)) {
@@ -111,11 +113,15 @@ public void paint(GraphicsContext g2d) {
if (histogramBuilder.getHistograms().length > 1) {
g2d.setFill(Paint.valueOf("GREEN"));
- xAxisData = histogramBuilder.getHistograms()[1].binCenters();
- yAxisData = histogramBuilder.getHistograms()[1].binCounts();
- binWidth = histogramBuilder.getHistograms()[1].binWidth();
- doFrameBins = (mapX(xAxisData[1]) - mapX(xAxisData[0])) > 1.0;
- plotData(g2d, binWidth, doFrameBins);
+
+ for (int histogramIndex = 0; histogramIndex < histogramBuilder.getHistograms().length; histogramIndex++) {
+ xAxisData = histogramBuilder.getHistograms()[histogramIndex].binCenters();
+ yAxisData = histogramBuilder.getHistograms()[histogramIndex].binCounts();
+ binWidth = histogramBuilder.getHistograms()[histogramIndex].binWidth();
+ doFrameBins = (mapX(xAxisData[1]) - mapX(xAxisData[0])) > 1.0;
+ plotData(g2d, binWidth, doFrameBins);
+ }
+
xAxisData = histogramBuilder.getHistograms()[0].binCenters();
yAxisData = histogramBuilder.getHistograms()[0].binCounts();
}
@@ -143,7 +149,7 @@ public void paint(GraphicsContext g2d) {
text.setText(bigDecimal.toString());
textWidth = (int) text.getLayoutBounds().getWidth();
g2d.fillText(text.getText(),//
- (float) mapX(minX) - textWidth - 5f,
+ (float) mapX(minX) - textWidth - 2.5f,
(float) mapY(bigDecimal.doubleValue()) + verticalTextShift);
// right side
@@ -181,7 +187,7 @@ private void plotData(GraphicsContext g2d, double binWidth, boolean doFrameBins)
g2d.fillRect(
mapX(xAxisData[i] - binWidth / 2.0) + (doFrameBins ? 1.0 : 0.0),
mapY(yAxisData[i]),
- mapX(xAxisData[1]) - mapX(xAxisData[0]) - (doFrameBins ? 1.0 : 0.0),
+ mapX(xAxisData[1]) - mapX(xAxisData[0]) - (doFrameBins ? 1.0 : -0.5),
mapY(0.0) - mapY(yAxisData[i]));
}
}
diff --git a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/MultiLineLinePlot.java b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/MultiLineLinePlot.java
new file mode 100644
index 00000000..00c7b8f5
--- /dev/null
+++ b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/MultiLineLinePlot.java
@@ -0,0 +1,141 @@
+package org.cirdles.tripoli.gui.dataViews.plots;
+
+import javafx.scene.canvas.GraphicsContext;
+import javafx.scene.paint.Paint;
+import javafx.scene.shape.Path;
+import javafx.scene.shape.Rectangle;
+import javafx.scene.text.Font;
+import javafx.scene.text.Text;
+import org.cirdles.tripoli.visualizationUtilities.linePlots.MultiLinePlotBuilder;
+
+
+public class MultiLineLinePlot extends AbstractDataView {
+
+ private final MultiLinePlotBuilder multiLinePlotBuilder;
+ private double[][] yData;
+
+ /**
+ * @param bounds
+ * @param linePlotBuilder
+ */
+ public MultiLineLinePlot(Rectangle bounds, MultiLinePlotBuilder multiLinePlotBuilder) {
+ super(bounds, 50, 5);
+ this.multiLinePlotBuilder = multiLinePlotBuilder;
+ }
+
+ @Override
+ public void preparePanel() {
+ xAxisData = multiLinePlotBuilder.getxData();
+ yData = multiLinePlotBuilder.getyData();
+
+ minX = xAxisData[0];
+ maxX = xAxisData[xAxisData.length - 1];
+
+ ticsX = TicGeneratorForAxes.generateTics(minX, maxX, (int) (graphWidth / 40.0));
+ double xMarginStretch = TicGeneratorForAxes.generateMarginAdjustment(minX, maxX, 0.01);
+ minX -= xMarginStretch;
+ maxX += xMarginStretch;
+
+ minY = Double.MAX_VALUE;
+ maxY = -Double.MAX_VALUE;
+
+ for (int i = 0; i < yData.length; i++) {
+ for (int j = 0; j < yData[i].length; j++) {
+ minY = StrictMath.min(minY, yData[i][j]);
+ maxY = StrictMath.max(maxY, yData[i][j]);
+ }
+ }
+ ticsY = TicGeneratorForAxes.generateTics(minY, maxY, (int) (graphHeight / 15.0));
+ if ((ticsY != null) && (ticsY.length > 1)) {
+ // force y to tics
+ minY = ticsY[0].doubleValue();
+ maxY = ticsY[ticsY.length - 1].doubleValue();
+ // adjust margins
+ double yMarginStretch = TicGeneratorForAxes.generateMarginAdjustment(minY, maxY, 0.1);
+ minY -= yMarginStretch * 2.0;
+ maxY += yMarginStretch;
+ }
+
+ setDisplayOffsetY(0.0);
+ setDisplayOffsetX(0.0);
+
+ this.repaint();
+ }
+
+ @Override
+ public void paint(GraphicsContext g2d) {
+ super.paint(g2d);
+
+ Text text = new Text();
+ text.setFont(Font.font("SansSerif", 12));
+ int textWidth = 0;
+
+ showTitle(multiLinePlotBuilder.getTitle());
+
+ // new line plots
+ g2d.setLineWidth(1.0);
+ g2d.setStroke(Paint.valueOf("Black"));
+ for (int lineIndex = 0; lineIndex < yData.length; lineIndex++) {
+ g2d.setLineDashes(8);
+ g2d.beginPath();
+ g2d.moveTo(mapX(xAxisData[0]), mapY(yData[lineIndex][0]));
+ for (int i = 0; i < xAxisData.length; i++) {
+ // line tracing through points
+ g2d.lineTo(mapX(xAxisData[i]), mapY(yData[lineIndex][i]));
+ }
+ g2d.stroke();
+ }
+ g2d.setLineDashes(0);
+
+ if (ticsY.length > 1) {
+ // border and fill
+ g2d.setLineWidth(0.5);
+ g2d.setStroke(Paint.valueOf("BLACK"));
+ g2d.strokeRect(
+ mapX(minX),
+ mapY(ticsY[ticsY.length - 1].doubleValue()),
+ graphWidth,
+ StrictMath.abs(mapY(ticsY[ticsY.length - 1].doubleValue()) - mapY(ticsY[0].doubleValue())));
+
+ g2d.setFill(Paint.valueOf("BLACK"));
+
+ // ticsY
+ float verticalTextShift = 3.2f;
+ g2d.setFont(Font.font("SansSerif", 10));
+ if (ticsY != null) {
+ for (int i = 0; i < ticsY.length; i++) {
+ g2d.strokeLine(
+ mapX(minX), mapY(ticsY[i].doubleValue()), mapX(maxX), mapY(ticsY[i].doubleValue()));
+
+ // left side
+ text.setText(ticsY[i].toString());
+ textWidth = (int) text.getLayoutBounds().getWidth();
+ g2d.fillText(text.getText(),//
+ (float) mapX(minX) - textWidth - 5f,
+ (float) mapY(ticsY[i].doubleValue()) + verticalTextShift);
+
+ }
+ // ticsX
+ if (ticsX != null) {
+ for (int i = 0; i < ticsX.length - 1; i++) {
+ try {
+ g2d.strokeLine(
+ mapX(ticsX[i].doubleValue()),
+ mapY(ticsY[0].doubleValue()),
+ mapX(ticsX[i].doubleValue()),
+ mapY(ticsY[0].doubleValue()) + 5);
+
+ // bottom
+ String xText = ticsX[i].toPlainString();
+ g2d.fillText(xText,
+ (float) mapX(ticsX[i].doubleValue()) - 5f,
+ (float) mapY(ticsY[0].doubleValue()) + 15);
+
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/PeakCentresLinePlot.java b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/PeakCentresLinePlot.java
index 3f7f19d0..6bc28eca 100644
--- a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/PeakCentresLinePlot.java
+++ b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/PeakCentresLinePlot.java
@@ -86,7 +86,7 @@ public void paint(GraphicsContext g2d) {
g2d.beginPath();
g2d.setStroke(Paint.valueOf("Black"));
g2d.setLineDashes(0);
- // x = magnetMass y = intensity
+ // x = magnetMass y = blockIntensities
for (int i = 0; i < xAxisData.length; i++) {
g2d.lineTo(mapX(xAxisData[i]), mapY(yAxisData[i]));
@@ -216,4 +216,4 @@ public void handle(MouseEvent mouseEvent) {
}
}
-}
+}
\ No newline at end of file
diff --git a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/plotsControllers/RJMCMCPlots/RJMCMCPlotsController.java b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/plotsControllers/RJMCMCPlots/RJMCMCPlotsController.java
index 8cba61fa..55bbac78 100644
--- a/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/plotsControllers/RJMCMCPlots/RJMCMCPlotsController.java
+++ b/TripoliApp/src/main/java/org/cirdles/tripoli/gui/dataViews/plots/plotsControllers/RJMCMCPlots/RJMCMCPlotsController.java
@@ -9,6 +9,8 @@
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Rectangle;
+import org.cirdles.commons.util.ResourceExtractor;
+import org.cirdles.tripoli.Tripoli;
import org.cirdles.tripoli.gui.dataViews.plots.*;
import org.cirdles.tripoli.sessions.analysis.methods.AnalysisMethod;
import org.cirdles.tripoli.sessions.analysis.methods.AnalysisMethodBuiltinFactory;
@@ -99,6 +101,9 @@ public class RJMCMCPlotsController {
@FXML
private Button processFileButton;
+ @FXML
+ private Button processFileButton2;
+
@FXML
private ToolBar toolbar;
@@ -106,21 +111,25 @@ public class RJMCMCPlotsController {
@FXML
- void demo1ButtonAction(ActionEvent event) throws IOException {
+ void demo1_2IsotopeButtonAction(ActionEvent event) throws IOException {
processDataFileAndShowPlotsOfRJMCMC(
listViewOfSyntheticFiles.getSelectionModel().selectedItemProperty().getValue().toPath(),
AnalysisMethodBuiltinFactory.analysisMethodsBuiltinMap.get("BurdickBlSyntheticData"));
-
+ ((Button) event.getSource()).setDisable(true);
+ processFileButton2.setDisable(true);
+ }
+ @FXML
+ void demo1_5IsotopeButtonAction(ActionEvent event) throws IOException {
// Jim's playground for 5 isotopes
-// ResourceExtractor RESOURCE_EXTRACTOR= new ResourceExtractor(Tripoli.class);
-// Path dataFile = RESOURCE_EXTRACTOR
-// .extractResourceAsFile("/org/cirdles/tripoli/dataProcessors/dataSources/synthetic/fiveIsotopeSyntheticData/SyntheticDataset_01R.txt").toPath();
-// processDataFileAndShowPlotsOfRJMCMC(
-// dataFile,
-// AnalysisMethodBuiltinFactory.analysisMethodsBuiltinMap.get("KU_204_5_6_7_8_Daly_AllFaradayPb"));
-
+ ResourceExtractor RESOURCE_EXTRACTOR = new ResourceExtractor(Tripoli.class);
+ Path dataFile = RESOURCE_EXTRACTOR
+ .extractResourceAsFile("/org/cirdles/tripoli/dataProcessors/dataSources/synthetic/fiveIsotopeSyntheticData/SyntheticDataset_01R.txt").toPath();
+ processDataFileAndShowPlotsOfRJMCMC(
+ dataFile,
+ AnalysisMethodBuiltinFactory.analysisMethodsBuiltinMap.get("KU_204_5_6_7_8_Daly_AllFaradayPb"));
((Button) event.getSource()).setDisable(true);
+ processFileButton.setDisable(true);
}
@FXML
@@ -159,6 +168,7 @@ void initialize() {
populateListOfSyntheticData2IsotopesFiles();
processFileButton.setDisable(listViewOfSyntheticFiles.getItems().isEmpty());
+ processFileButton2.setDisable(listViewOfSyntheticFiles.getItems().isEmpty());
}
private void populateListOfSyntheticData2IsotopesFiles() {
@@ -242,10 +252,10 @@ public void processDataFileAndShowPlotsOfRJMCMC(Path dataFile, AnalysisMethod an
(plotTabPane.getHeight() - TAB_HEIGHT) / ensembleGridPane.getRowCount()),
(HistogramBuilder) dalyFaradayHistogramBuilder);
- AbstractDataView intensityLinePlot = new BasicLinePlot(
+ AbstractDataView intensityLinePlot = new MultiLineLinePlot(
new Rectangle(ensembleGridPane.getWidth(),
(plotTabPane.getHeight() - TAB_HEIGHT) / ensembleGridPane.getRowCount()),
- (LinePlotBuilder) intensityLinePlotBuilder
+ (MultiLinePlotBuilder) intensityLinePlotBuilder
);
AbstractDataView signalNoiseHistogramPlot = new HistogramPlot(
@@ -400,7 +410,7 @@ public void processDataFileAndShowPlotsOfRJMCMC(Path dataFile, AnalysisMethod an
intensityLinePlot.preparePanel();
ensembleGridPane.add(intensityLinePlot, 0, 2, 2, 1);
signalNoiseHistogramPlot.preparePanel();
- ensembleGridPane.add(signalNoiseHistogramPlot, 0, 4, 2, 1);
+ ensembleGridPane.add(signalNoiseHistogramPlot, 0, 3, 2, 1);
convergeRatioLinePlot.preparePanel();
convergeRatioAnchorPane.getChildren().add(convergeRatioLinePlot);
diff --git a/TripoliApp/src/main/resources/org/cirdles/tripoli/gui/dataViews/plots/plotsControllers/RJMCMCPlots.fxml b/TripoliApp/src/main/resources/org/cirdles/tripoli/gui/dataViews/plots/plotsControllers/RJMCMCPlots.fxml
index 2abcea72..0b0f202f 100644
--- a/TripoliApp/src/main/resources/org/cirdles/tripoli/gui/dataViews/plots/plotsControllers/RJMCMCPlots.fxml
+++ b/TripoliApp/src/main/resources/org/cirdles/tripoli/gui/dataViews/plots/plotsControllers/RJMCMCPlots.fxml
@@ -16,12 +16,21 @@
* limitations under the License.
-->
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -31,30 +40,19 @@
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
-
+
@@ -63,22 +61,16 @@
-
+
-
+
-
-
+
+
-
+
@@ -87,12 +79,8 @@
-
-
+
+
@@ -101,22 +89,16 @@
-
+
-
+
-
-
+
+
-
+
@@ -125,22 +107,16 @@
-
+
-
+
-
-
+
+
-
+
@@ -149,12 +125,8 @@
-
-
+
+
@@ -163,23 +135,16 @@
-
+
-
+
-
-
+
+
-
+
@@ -188,18 +153,17 @@
-
-
+
+
-
+
+
-
\ No newline at end of file
+
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/Session.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/Session.java
index c6efde6d..7cc29d37 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/Session.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/Session.java
@@ -30,17 +30,7 @@ public class Session implements Serializable {
@Serial
private static final long serialVersionUID = 6597752272434171800L;
-// private void readObject ( ObjectInputStream stream ) throws IOException,
-// ClassNotFoundException {
-// stream.defaultReadObject();
-//
-// ObjectStreamClass myObject = ObjectStreamClass.lookup(
-// Class.forName( Session.class.getCanonicalName()) );
-// long theSUID = myObject.getSerialVersionUID();
-//
-// System.err.println( "Customized De-serialization of Session "
-// + theSUID );
-// }
+
private String sessionName;
private Map mapOfAnalyses;
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/MassSpectrometerModel.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/MassSpectrometerModel.java
index b23b529f..53ca00f9 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/MassSpectrometerModel.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/MassSpectrometerModel.java
@@ -33,7 +33,7 @@ Beam width (mm)
@Serial
private static final long serialVersionUID = 1402626964061990257L;
- private String massSpectrometerName;
+ private final String massSpectrometerName;
private DetectorSetup detectorSetup;
private double collectorWidthMM; //% collector aperture width (mm)
private double theoreticalBeamWidthMM; //% a priori estimate of beam width (mm)
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/peakShapes/PeakShapeOutputDataRecord.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/peakShapes/PeakShapeOutputDataRecord.java
index c530009b..cba58608 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/peakShapes/PeakShapeOutputDataRecord.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/peakShapes/PeakShapeOutputDataRecord.java
@@ -17,7 +17,7 @@
* @param beamWindow
*/
public record PeakShapeOutputDataRecord(
- Primitive64Store magnetMasses, // vector of masses for intensity measurements
+ Primitive64Store magnetMasses, // vector of masses for blockIntensities measurements
Primitive64Store measuredPeakIntensities, // vector of corresponding peak intensities
double peakCenterMass, // mass at center of peak from header
double integrationPeriodMS, // integration period of measurements in ms
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelDriverExperiment.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelDriverExperiment.java
index 25ca4552..101b0022 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelDriverExperiment.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelDriverExperiment.java
@@ -20,6 +20,7 @@
import org.apache.commons.math3.random.RandomDataGenerator;
import org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.dataSourceProcessors.DataSourceProcessor_OPPhoenix;
import org.cirdles.tripoli.sessions.analysis.methods.AnalysisMethod;
+import org.cirdles.tripoli.species.IsotopicRatio;
import org.cirdles.tripoli.utilities.callbacks.LoggingCallbackInterface;
import org.cirdles.tripoli.utilities.exceptions.TripoliException;
import org.cirdles.tripoli.utilities.stateUtilities.TripoliSerializer;
@@ -52,7 +53,7 @@
*/
public class DataModelDriverExperiment {
- private static final boolean doFullProcessing = true;
+ private static final boolean doFullProcessing = false;
public static AbstractPlotBuilder[] driveModelTest(Path dataFilePath, AnalysisMethod analysisMethod, LoggingCallbackInterface loggingCallback) throws IOException {
@@ -68,7 +69,7 @@ public static AbstractPlotBuilder[] driveModelTest(Path dataFilePath, AnalysisMe
List ensembleRecordsList = new ArrayList<>();
DataModellerOutputRecord lastDataModelInit = null;
if (doFullProcessing) {
- plotBuilders = applyInversionWithRJMCMC(massSpecOutputDataRecord, dataModelInit, loggingCallback);
+ plotBuilders = applyInversionWithRJMCMC(massSpecOutputDataRecord, dataModelInit, analysisMethod.getTripoliRatiosList(), loggingCallback);
} else {
try {
EnsemblesStore ensemblesStore = (EnsemblesStore) TripoliSerializer.getSerializedObjectFromFile("EnsemblesStore.ser", true);
@@ -77,7 +78,8 @@ public static AbstractPlotBuilder[] driveModelTest(Path dataFilePath, AnalysisMe
} catch (TripoliException e) {
e.printStackTrace();
}
- plotBuilders = DataModelPlot.analysisAndPlotting(massSpecOutputDataRecord, ensembleRecordsList, lastDataModelInit);
+
+ plotBuilders = DataModelPlot.analysisAndPlotting(massSpecOutputDataRecord, ensembleRecordsList, lastDataModelInit, analysisMethod.getTripoliRatiosList());
}
} catch (RecoverableCondition e) {
plotBuilders = new AbstractPlotBuilder[0];
@@ -86,7 +88,11 @@ public static AbstractPlotBuilder[] driveModelTest(Path dataFilePath, AnalysisMe
return plotBuilders;
}
- static AbstractPlotBuilder[] applyInversionWithRJMCMC(MassSpecOutputDataRecord massSpecOutputDataRecord, DataModellerOutputRecord dataModelInit_X0, LoggingCallbackInterface loggingCallback) {
+ static AbstractPlotBuilder[] applyInversionWithRJMCMC
+ (MassSpecOutputDataRecord massSpecOutputDataRecord,
+ DataModellerOutputRecord dataModelInit_X0,
+ List isotopicRatioList,
+ LoggingCallbackInterface loggingCallback) {
/*
% MCMC Parameters
maxcnt = 2000; % Maximum number of models to save
@@ -149,7 +155,7 @@ static AbstractPlotBuilder[] applyInversionWithRJMCMC(MassSpecOutputDataRecord m
/*
% Forward model isotope measurements
for n = 1:d0.Nblock % Iterate over blocks
- % Calculate block intensity from intensity variables
+ % Calculate block blockIntensities from blockIntensities variables
Intensity{n} = InterpMat{n}*x0.I{n};
Intensity2{n} = Intensity{n};
@@ -245,7 +251,7 @@ static AbstractPlotBuilder[] applyInversionWithRJMCMC(MassSpecOutputDataRecord m
Ndf = 1; % Number of DF gains = 1
- % Size of model: # isotopes + # intensity knots + # baselines + # df gain
+ % Size of model: # isotopes + # blockIntensities knots + # baselines + # df gain
Nmod = d0.Niso + sum(d0.Ncycle) + d0.Nfar + Ndf ;
% Data and data covariance vectors
xmean = zeros(Nmod,1);
@@ -414,26 +420,24 @@ static AbstractPlotBuilder[] applyInversionWithRJMCMC(MassSpecOutputDataRecord m
long interval1 = System.nanoTime() - prev;
prev = interval1 + prev;
- // todo: reminder only 1 block here
- // todo: remove zeroes from firstblockinterpolations
ArrayList intensity2 = new ArrayList<>(1);
- PhysicalStore tempIntensity = storeFactory.make(massSpecOutputDataRecord.allBlockInterpolations()[0].countRows(),
- storeFactory.columns(dataModelUpdaterOutputRecord_x2.blockIntensities()).getColDim());
- // todo: fix block indexing
- tempIntensity.fillByMultiplying(massSpecOutputDataRecord.allBlockInterpolations()[0], Access1D.wrap(dataModelUpdaterOutputRecord_x2.blockIntensities()[0]));
- intensity2.add(0, tempIntensity.toRawCopy1D());
-
- for (int row = (int) blockStartIndicesFaraday[0]; row <= (int) blockEndIndicesFaraday[0]; row++) {
- tmpIArray[row] = intensity2.get(0)[(int) massSpecOutputDataRecord.timeIndColumn()[row] - 1];
- }
- for (int row = (int) blockStartIndicesDaly[0]; row <= (int) blockEndIndicesDaly[0]; row++) {
- tmpIArray[row] = intensity2.get(0)[(int) massSpecOutputDataRecord.timeIndColumn()[row] - 1];
+ for (int blockIndex = 0; blockIndex < massSpecOutputDataRecord.blockCount(); blockIndex++) {
+ PhysicalStore tempIntensity = storeFactory.make(massSpecOutputDataRecord.allBlockInterpolations()[blockIndex].countRows(),
+ storeFactory.columns(dataModelUpdaterOutputRecord_x2.blockIntensities()[blockIndex]).getColDim());
+ tempIntensity.fillByMultiplying(massSpecOutputDataRecord.allBlockInterpolations()[blockIndex], Access1D.wrap(dataModelUpdaterOutputRecord_x2.blockIntensities()[blockIndex]));
+ intensity2.add(tempIntensity.toRawCopy1D());
+
+ for (int row = (int) blockStartIndicesFaraday[blockIndex]; row <= (int) blockEndIndicesFaraday[blockIndex]; row++) {
+ tmpIArray[row] = intensity2.get(blockIndex)[(int) massSpecOutputDataRecord.timeIndColumn()[row] - 1];
+ }
+ for (int row = (int) blockStartIndicesDaly[blockIndex]; row <= (int) blockEndIndicesDaly[blockIndex]; row++) {
+ tmpIArray[row] = intensity2.get(blockIndex)[(int) massSpecOutputDataRecord.timeIndColumn()[row] - 1];
+ }
}
long interval2 = System.nanoTime() - prev;
prev = interval2 + prev;
- // todo: reminder only 1 block here
double[] dnobl2 = new double[rowDimension];
double[] d2 = new double[rowDimension];
@@ -692,7 +696,7 @@ static AbstractPlotBuilder[] applyInversionWithRJMCMC(MassSpecOutputDataRecord m
e.printStackTrace();
}
- return DataModelPlot.analysisAndPlotting(massSpecOutputDataRecord, ensembleRecordsList, dataModelInit);
+ return DataModelPlot.analysisAndPlotting(massSpecOutputDataRecord, ensembleRecordsList, dataModelInit, isotopicRatioList);
}
-}
+}
\ No newline at end of file
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelPlot.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelPlot.java
index 60afa6e7..0f229752 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelPlot.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelPlot.java
@@ -17,6 +17,7 @@
package org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.dataOutputModels.rjmcmc;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+import org.cirdles.tripoli.species.IsotopicRatio;
import org.cirdles.tripoli.visualizationUtilities.AbstractPlotBuilder;
import org.cirdles.tripoli.visualizationUtilities.histograms.HistogramBuilder;
import org.cirdles.tripoli.visualizationUtilities.linePlots.ComboPlotBuilder;
@@ -36,8 +37,12 @@
*/
public class DataModelPlot {
- static AbstractPlotBuilder[] analysisAndPlotting(
- MassSpecOutputDataRecord massSpecOutputDataRecord, List ensembleRecordsList, DataModellerOutputRecord lastDataModelInit) {
+ public static AbstractPlotBuilder[] analysisAndPlotting(
+ MassSpecOutputDataRecord massSpecOutputDataRecord,
+ List ensembleRecordsList,
+ DataModellerOutputRecord lastDataModelInit,
+ List isotopicRatioList) {
+
/*
%% Analysis and Plotting
@@ -58,27 +63,33 @@ static AbstractPlotBuilder[] analysisAndPlotting(
DFstd = std(ens_DF(:,burn:cnt),[],2);
*/
- int burn = 500;//1000;
+ int burn;// = 100;// 500;//1000;
+ burn = 450;//Math.min(100, ensembleRecordsList.size() - 50);
int countOfEnsemblesUsed = ensembleRecordsList.size() - burn;
// log ratios - only the first row
- double[] ensembleLogRatios = new double[countOfEnsemblesUsed];
- double[] ensembleRatios = new double[countOfEnsemblesUsed];
+ double[][] ensembleLogRatios = new double[isotopicRatioList.size()][countOfEnsemblesUsed];
+ double[][] ensembleRatios = new double[isotopicRatioList.size()][countOfEnsemblesUsed];
+ double[] logRatioMean = new double[isotopicRatioList.size()];
+ double[] logRatioStdDev = new double[isotopicRatioList.size()];
DescriptiveStatistics descriptiveStatisticsLogRatios = new DescriptiveStatistics();
- for (int index = burn; index < countOfEnsemblesUsed + burn; index++) {
- ensembleLogRatios[index - burn] = ensembleRecordsList.get(index).logRatios()[0];
- descriptiveStatisticsLogRatios.addValue(ensembleLogRatios[index - burn]);
- ensembleRatios[index - burn] = exp(ensembleLogRatios[index - burn]);
+ for (int ratioIndex = 0; ratioIndex < isotopicRatioList.size(); ratioIndex ++) {
+ for (int index = burn; index < countOfEnsemblesUsed + burn; index++) {
+ ensembleLogRatios[ratioIndex][index - burn] = ensembleRecordsList.get(index).logRatios()[ratioIndex];
+ descriptiveStatisticsLogRatios.addValue(ensembleLogRatios[ratioIndex][index - burn]);
+ ensembleRatios[ratioIndex][index - burn] = exp(ensembleLogRatios[ratioIndex][index - burn]);
+ }
+ logRatioMean[ratioIndex] = descriptiveStatisticsLogRatios.getMean();
+ logRatioStdDev[ratioIndex] = descriptiveStatisticsLogRatios.getStandardDeviation();
}
- double logRatioMean = descriptiveStatisticsLogRatios.getMean();
- double logRatioStdDev = descriptiveStatisticsLogRatios.getStandardDeviation();
- // baseLines - first 2 rows
- double[][] ensembleBaselines = new double[ensembleRecordsList.get(0).baseLine().length][countOfEnsemblesUsed];
- double[] baselinesMeans = new double[massSpecOutputDataRecord.isotopeCount()];
- double[] baselinesStdDev = new double[massSpecOutputDataRecord.isotopeCount()];
+ // baseLines
+ int baselineSize = ensembleRecordsList.get(0).baseLine().length;
+ double[][] ensembleBaselines = new double[baselineSize][countOfEnsemblesUsed];
+ double[] baselinesMeans = new double[baselineSize];
+ double[] baselinesStdDev = new double[baselineSize];
- for (int row = 0; row < ensembleRecordsList.get(0).baseLine().length; row++) {
+ for (int row = 0; row < baselineSize; row++) {
DescriptiveStatistics descriptiveStatisticsBaselines = new DescriptiveStatistics();
for (int index = burn; index < countOfEnsemblesUsed + burn; index++) {
ensembleBaselines[row][index - burn] = ensembleRecordsList.get(index).baseLine()[row] / 6.24e7 * 1e6;
@@ -99,11 +110,12 @@ static AbstractPlotBuilder[] analysisAndPlotting(
double dalyFaradayGainStdDev = descriptiveStatisticsDalyFaradayGain.getStandardDeviation();
// signal noise
- double[][] ensembleSignalnoise = new double[2][countOfEnsemblesUsed];
- double[] signalNoiseMeans = new double[2];
- double[] signalNoiseStdDev = new double[2];
+ int faradayCount = massSpecOutputDataRecord.faradayCount();
+ double[][] ensembleSignalnoise = new double[faradayCount][countOfEnsemblesUsed];
+ double[] signalNoiseMeans = new double[faradayCount];
+ double[] signalNoiseStdDev = new double[faradayCount];
- for (int row = 0; row < massSpecOutputDataRecord.faradayCount(); row++) {
+ for (int row = 0; row < faradayCount; row++) {
DescriptiveStatistics descriptiveStatisticsSignalNoise = new DescriptiveStatistics();
for (int index = burn; index < countOfEnsemblesUsed + burn; index++) {
ensembleSignalnoise[row][index - burn] = ensembleRecordsList.get(index).signalNoise()[row];
@@ -124,41 +136,44 @@ static AbstractPlotBuilder[] analysisAndPlotting(
*/
// Intensity
- // meanof 16 items across 400
- // todo handle blocks
- int knotsCount = ensembleRecordsList.get(0).intensity()[0].length;
+ int knotsCount = ensembleRecordsList.get(0).blockIntensities()[0].length;
+ int blockCount = massSpecOutputDataRecord.blockCount();
double[][] ensembleIntensity = new double[knotsCount][countOfEnsemblesUsed];
- double[] intensityMeans = new double[knotsCount];
- double[] intensityStdDevs = new double[knotsCount];
-
- for (int knotIndex = 0; knotIndex < knotsCount; knotIndex++) {
- DescriptiveStatistics descriptiveStatisticsIntensity = new DescriptiveStatistics();
- for (int index = burn; index < countOfEnsemblesUsed + burn; index++) {
- ensembleIntensity[knotIndex][index - burn] = ensembleRecordsList.get(index).intensity()[0][knotIndex];
- descriptiveStatisticsIntensity.addValue(ensembleIntensity[knotIndex][index - burn]);
+ double[][] intensityMeans = new double[blockCount][knotsCount];
+ double[][] intensityStdDevs = new double[blockCount][knotsCount];
+
+ for (int blockIndex = 0; blockIndex < blockCount; blockIndex++) {
+ for (int knotIndex = 0; knotIndex < knotsCount; knotIndex++) {
+ DescriptiveStatistics descriptiveStatisticsIntensity = new DescriptiveStatistics();
+ for (int index = burn; index < countOfEnsemblesUsed + burn; index++) {
+ ensembleIntensity[knotIndex][index - burn] = ensembleRecordsList.get(index).blockIntensities()[blockIndex][knotIndex];
+ descriptiveStatisticsIntensity.addValue(ensembleIntensity[knotIndex][index - burn]);
+ }
+ intensityMeans[blockIndex][knotIndex] = descriptiveStatisticsIntensity.getMean();
+ intensityStdDevs[blockIndex][knotIndex] = descriptiveStatisticsIntensity.getStandardDeviation();
}
- intensityMeans[knotIndex] = descriptiveStatisticsIntensity.getMean();
- intensityStdDevs[knotIndex] = descriptiveStatisticsIntensity.getStandardDeviation();
}
- // calculate intensity means for plotting
- PhysicalStore.Factory storeFactory = Primitive64Store.FACTORY;
- MatrixStore intensityMeansMatrix = storeFactory.columns(intensityMeans);
- MatrixStore yDataMatrix = massSpecOutputDataRecord.allBlockInterpolations()[0].multiply(intensityMeansMatrix).multiply((1.0 / (dalyFaradayGainMean * 6.24e7)) * 1e6);
- double[] yDataIntensityMeans = yDataMatrix.toRawCopy1D();
+ // calculate blockIntensities means for plotting
+ double[][] yDataIntensityMeans = new double[blockCount][];
+ for (int blockIndex = 0; blockIndex < blockCount; blockIndex++) {
+ PhysicalStore.Factory storeFactory = Primitive64Store.FACTORY;
+ MatrixStore intensityMeansMatrix = storeFactory.columns(intensityMeans[blockIndex]);
+ MatrixStore yDataMatrix = massSpecOutputDataRecord.allBlockInterpolations()[blockIndex].multiply(intensityMeansMatrix).multiply((1.0 / (dalyFaradayGainMean * 6.24e7)) * 1e6);
+ yDataIntensityMeans[blockIndex] = yDataMatrix.toRawCopy1D();
+ }
double[] xDataIntensityMeans = new double[massSpecOutputDataRecord.allBlockInterpolations()[0].getRowDim()];
for (int i = 0; i < xDataIntensityMeans.length; i++) {
xDataIntensityMeans[i] = i;
}
-
// visualization - Ensembles tab
AbstractPlotBuilder[] plotBuilders = new AbstractPlotBuilder[15];
- plotBuilders[0] = HistogramBuilder.initializeHistogram(ensembleRatios, 50, "Histogram of ratios");
+ plotBuilders[0] = HistogramBuilder.initializeHistogram(true, ensembleRatios, 50, "Histogram of ratios");
plotBuilders[1] = HistogramBuilder.initializeHistogram(true, ensembleBaselines, 50, "Histogram of baseline");
plotBuilders[2] = HistogramBuilder.initializeHistogram(ensembleDalyFaradayGain, 50, "Histogram of Daly/Faraday Gain");
plotBuilders[3] = HistogramBuilder.initializeHistogram(true, ensembleSignalnoise, 50, "Histogram of Signal Noise");
- plotBuilders[4] = LinePlotBuilder.initializeLinePlot(xDataIntensityMeans, yDataIntensityMeans, "Mean Intensity");
+ plotBuilders[4] = MultiLinePlotBuilder.initializeLinePlot(xDataIntensityMeans, yDataIntensityMeans, "Mean Intensity");
// visualization converge ratio and others tabs
double[] convergeLogRatios = new double[ensembleRecordsList.size()];
@@ -169,7 +184,7 @@ static AbstractPlotBuilder[] analysisAndPlotting(
double[] convergeErrWeightedMisfit = new double[ensembleRecordsList.size()];
double[] convergeErrRawMisfit = new double[ensembleRecordsList.size()];
double[] xDataconvergeSavedIterations = new double[ensembleRecordsList.size()];
- double[][] convergeIntensities = new double[ensembleRecordsList.get(0).intensity()[0].length][ensembleRecordsList.size()];
+ double[][] convergeIntensities = new double[ensembleRecordsList.get(0).blockIntensities()[0].length][ensembleRecordsList.size()];
double[] convergeNoiseFaradayL1 = new double[ensembleRecordsList.size()];
double[] convergeNoiseFaradayH1 = new double[ensembleRecordsList.size()];
for (int index = 0; index < ensembleRecordsList.size(); index++) {
@@ -180,7 +195,7 @@ static AbstractPlotBuilder[] analysisAndPlotting(
convergeErrWeightedMisfit[index] = StrictMath.sqrt(ensembleRecordsList.get(index).errorWeighted());
convergeErrRawMisfit[index] = StrictMath.sqrt(ensembleRecordsList.get(index).errorUnWeighted());
for (int intensityIndex = 0; intensityIndex < convergeIntensities.length; intensityIndex++) {
- convergeIntensities[intensityIndex][index] = ensembleRecordsList.get(index).intensity()[0][intensityIndex];
+ convergeIntensities[intensityIndex][index] = ensembleRecordsList.get(index).blockIntensities()[0][intensityIndex];
}
convergeNoiseFaradayL1[index] = ensembleRecordsList.get(index).signalNoise()[0];
convergeNoiseFaradayH1[index] = ensembleRecordsList.get(index).signalNoise()[1];
@@ -197,7 +212,6 @@ static AbstractPlotBuilder[] analysisAndPlotting(
// visualization data fit
- // only first block for now
// todo: this is duplicated code from above in part
double[] data = lastDataModelInit.dataArray();
double[] dataWithNoBaseline = new double[lastDataModelInit.dataArray().length];
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelUpdater.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelUpdater.java
index 59d9118f..44894d72 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelUpdater.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelUpdater.java
@@ -128,17 +128,17 @@ static DataModellerOutputRecord updateMSv2(
double[] xInd = new double[countOfRows];
System.arraycopy(dataModelInit.logratios(), 0, xx0, 0, countOfIsotopes);
Arrays.fill(xInd, 1.0);
- // todo: only good for one block
+
for (int blockIndex = 0; blockIndex < countOfBlocks; blockIndex++) {
- System.arraycopy(dataModelInit.blockIntensities()[blockIndex], 0, xx0, countOfIsotopes, nCycle[blockIndex]);
+ System.arraycopy(dataModelInit.blockIntensities()[blockIndex], 0, xx0, countOfIsotopes + blockIndex * nCycle[blockIndex], nCycle[blockIndex]);
double[] temp = new double[nCycle[blockIndex]];
Arrays.fill(temp, blockIndex + 2);
- System.arraycopy(temp, 0, xInd, countOfIsotopes, nCycle[blockIndex]);
+ System.arraycopy(temp, 0, xInd, countOfIsotopes + blockIndex * nCycle[blockIndex], nCycle[blockIndex]);
}
- System.arraycopy(dataModelInit.baselineMeans(), 0, xx0, countOfIsotopes + nCycle[0], countOfFaradays);
+ System.arraycopy(dataModelInit.baselineMeans(), 0, xx0, countOfIsotopes + nCycle[0] * countOfBlocks, countOfFaradays);
double[] temp = new double[countOfFaradays];
Arrays.fill(temp, 2.0 + countOfBlocks);
- System.arraycopy(temp, 0, xInd, countOfIsotopes + nCycle[0], countOfFaradays);
+ System.arraycopy(temp, 0, xInd, countOfIsotopes + nCycle[0] * countOfBlocks, countOfFaradays);
xx0[countOfRows - 1] = dataModelInit.dfGain();
xInd[countOfRows - 1] = 3.0 + countOfBlocks;
@@ -268,9 +268,11 @@ elseif strcmp(oper(1:3),'noi') %CHANGE NOISE
}
if (!noiseFlag) {
- // todo: only 1 block here for now
List x2LogRatioList = new ArrayList<>();
- List x2BlockIntensitiesList = new ArrayList<>();
+ List> x2BlockintensitiesListII = new ArrayList<>();
+ for (int blockIndex = 0; blockIndex < countOfBlocks; blockIndex++) {
+ x2BlockintensitiesListII.add(new ArrayList<>());
+ }
List x2BaselineMeansList = new ArrayList<>();
double x2DFGain = 0.0;
@@ -278,8 +280,10 @@ elseif strcmp(oper(1:3),'noi') %CHANGE NOISE
if (xInd[row] == 1) {
x2LogRatioList.add(xx[row]);
}
- if (xInd[row] == 2) {
- x2BlockIntensitiesList.add(xx[row]);
+ for (int blockIndex = 0; blockIndex < countOfBlocks; blockIndex++) {
+ if (xInd[row] == 2 + blockIndex) {
+ x2BlockintensitiesListII.get(blockIndex).add(xx[row]);
+ }
}
if (xInd[row] == 2 + countOfBlocks) {
x2BaselineMeansList.add(xx[row]);
@@ -289,8 +293,11 @@ elseif strcmp(oper(1:3),'noi') %CHANGE NOISE
}
}
double[] x2LogRatio = x2LogRatioList.stream().mapToDouble(d -> d).toArray();
- double[] x2BlockIntensities = x2BlockIntensitiesList.stream().mapToDouble(d -> d).toArray();
double[] x2BaselineMeans = x2BaselineMeansList.stream().mapToDouble(d -> d).toArray();
+ double[][] x2BlockIntensities = new double[countOfBlocks][];
+ for (int blockIndex = 0; blockIndex < countOfBlocks; blockIndex++) {
+ x2BlockIntensities[blockIndex] = x2BlockintensitiesListII.get(blockIndex).stream().mapToDouble(d -> d).toArray();
+ }
dataModelInit2 = new DataModellerOutputRecord(
x2BaselineMeans,
@@ -299,7 +306,7 @@ elseif strcmp(oper(1:3),'noi') %CHANGE NOISE
x2LogRatio,
dataModelInit.signalNoise().clone(),
dataModelInit.dataArray().clone(),
- new double[][]{x2BlockIntensities},
+ x2BlockIntensities,
dataModelInit.intensityPerBlock() // ?deep clone
);
}
@@ -357,7 +364,7 @@ static UpdatedCovariancesRecord updateMeanCovMS(
PhysicalStore.Factory storeFactory = Primitive64Store.FACTORY;
int countOfIsotopes = dataModelInit.logratios().length;
- // todo - handle multiple blocks
+
int countOfBlocks = storeFactory.columns(dataModelInit.blockIntensities()[0]).getColDim();
int[] nCycle = new int[countOfBlocks];
int sumOfCycleCounts = 0;
@@ -390,10 +397,11 @@ static UpdatedCovariancesRecord updateMeanCovMS(
enso.set(row, modelIndex, ensembleRecordsList.get(modelIndex + countOfNewModels - 1).logRatios()[1]);
totalsByRow.set(row, 0, totalsByRow.get(row, 0) + ensembleRecordsList.get(modelIndex + countOfNewModels - 1).logRatios()[1]);
row++;
- // todo fix block index
+ // todo fix block index STILL NEEDS
+
for (int intensityIndex = 0; intensityIndex < dataModelInit.blockIntensities()[0].length; intensityIndex++) {
- enso.set(row, modelIndex, ensembleRecordsList.get(modelIndex + countOfNewModels - 1).intensity()[0][intensityIndex]);
- totalsByRow.set(row, 0, totalsByRow.get(row, 0) + ensembleRecordsList.get(modelIndex + countOfNewModels - 1).intensity()[0][intensityIndex]);
+ enso.set(row, modelIndex, ensembleRecordsList.get(modelIndex + countOfNewModels - 1).blockIntensities()[0][intensityIndex]);
+ totalsByRow.set(row, 0, totalsByRow.get(row, 0) + ensembleRecordsList.get(modelIndex + countOfNewModels - 1).blockIntensities()[0][intensityIndex]);
row++;
}
enso.set(row, modelIndex, ensembleRecordsList.get(modelIndex + countOfNewModels - 1).baseLine()[0]);
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelUpdaterHelper.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelUpdaterHelper.java
index 7793029d..93760fb4 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelUpdaterHelper.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/DataModelUpdaterHelper.java
@@ -26,7 +26,7 @@
public class DataModelUpdaterHelper {
/*
- % Range for ratios and intensity parameters
+ % Range for ratios and blockIntensities parameters
prior.BL = [-1 1]*1e6; % Faraday baseline
prior.BLdaly = [0 0]; % Daly baseline (no baseline uncertainty)
prior.lograt = [-20 20]; % Log ratio
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/EnsemblesStore.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/EnsemblesStore.java
index 3e07b9b2..98d57eea 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/EnsemblesStore.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataOutputModels/rjmcmc/EnsemblesStore.java
@@ -24,8 +24,8 @@
*/
public class EnsemblesStore implements Serializable {
- private List ensembles;
- private DataModellerOutputRecord lastDataModelInit;
+ private final List ensembles;
+ private final DataModellerOutputRecord lastDataModelInit;
public EnsemblesStore(List ensembles, DataModellerOutputRecord lastDataModelInit) {
this.ensembles = ensembles;
@@ -40,9 +40,9 @@ public DataModellerOutputRecord getLastDataModelInit() {
return lastDataModelInit;
}
- record EnsembleRecord(
+ public record EnsembleRecord(
double[] logRatios,
- double[][] intensity,
+ double[][] blockIntensities,
double[] baseLine,
double dfGain,
double[] signalNoise,
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataSourceProcessors/ogtripoli/OGTripoliMassSpecDataFileInterface.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataSourceProcessors/ogtripoli/OGTripoliMassSpecDataFileInterface.java
index 8832e6b1..b1167bab 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataSourceProcessors/ogtripoli/OGTripoliMassSpecDataFileInterface.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/massSpectrometerModels/dataSourceProcessors/ogtripoli/OGTripoliMassSpecDataFileInterface.java
@@ -17,5 +17,5 @@
package org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.dataSourceProcessors.ogtripoli;
public interface OGTripoliMassSpecDataFileInterface {
- public boolean testFileValidity();
+ boolean testFileValidity();
}
\ No newline at end of file
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/methods/AnalysisMethod.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/methods/AnalysisMethod.java
index 4de0a13b..a13503f8 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/methods/AnalysisMethod.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/methods/AnalysisMethod.java
@@ -19,6 +19,7 @@
import org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.MassSpectrometerModel;
import org.cirdles.tripoli.sessions.analysis.methods.baseline.BaselineTable;
import org.cirdles.tripoli.sessions.analysis.methods.sequence.SequenceTable;
+import org.cirdles.tripoli.species.IsotopicRatio;
import org.cirdles.tripoli.species.SpeciesRecordInterface;
import java.io.Serial;
@@ -38,6 +39,8 @@ public class AnalysisMethod implements Serializable {
protected BaselineTable baselineTable;
protected SequenceTable sequenceTable;
private List speciesList;
+ private List isotopicRatiosList;
+
private AnalysisMethod(String methodName, MassSpectrometerModel massSpectrometer) {
this(methodName, massSpectrometer, BaselineTable.createEmptyBaselineTable(), SequenceTable.createEmptySequenceTable());
@@ -49,6 +52,7 @@ private AnalysisMethod(String methodName, MassSpectrometerModel massSpectrometer
this.speciesList = new ArrayList<>();
this.baselineTable = baselineTable;
this.sequenceTable = sequenceTable;
+ this.isotopicRatiosList = new ArrayList<>();
}
public static AnalysisMethod initializeAnalysisMethod(String methodName, MassSpectrometerModel massSpectrometer) {
@@ -115,4 +119,13 @@ public SequenceTable getSequenceTable() {
public void setSequenceTable(SequenceTable sequenceTable) {
this.sequenceTable = sequenceTable;
}
+
+ public List getTripoliRatiosList() {
+ return isotopicRatiosList;
+ }
+
+ public void setTripoliRatiosList(List isotopicRatiosList) {
+ this.isotopicRatiosList = isotopicRatiosList;
+ }
+
}
\ No newline at end of file
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/methods/AnalysisMethodBuiltinFactory.java b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/methods/AnalysisMethodBuiltinFactory.java
index f3c1b4ab..0c58a7df 100644
--- a/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/methods/AnalysisMethodBuiltinFactory.java
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/sessions/analysis/methods/AnalysisMethodBuiltinFactory.java
@@ -22,6 +22,7 @@
import org.cirdles.tripoli.sessions.analysis.methods.baseline.BaselineTable;
import org.cirdles.tripoli.sessions.analysis.methods.sequence.SequenceCell;
import org.cirdles.tripoli.sessions.analysis.methods.sequence.SequenceTable;
+import org.cirdles.tripoli.species.IsotopicRatio;
import org.cirdles.tripoli.species.SpeciesRecordInterface;
import org.cirdles.tripoli.species.nuclides.NuclidesFactory;
@@ -51,6 +52,8 @@ public final class AnalysisMethodBuiltinFactory implements Serializable {
burdickBlSyntheticData.getSpeciesList().add(pb206);
burdickBlSyntheticData.getSpeciesList().add(pb208);
+ burdickBlSyntheticData.getTripoliRatiosList().add(new IsotopicRatio(pb206, pb208));
+
DetectorSetup detectorSetup = burdickBlSyntheticData.getMassSpectrometer().getDetectorSetup();
BaselineCell baselineCell = burdickBlSyntheticData.getBaselineTable().accessBaselineCellForDetector(detectorSetup.getMapOfDetectors().get("Ax_Fara"), "Bl1");
@@ -72,6 +75,8 @@ public final class AnalysisMethodBuiltinFactory implements Serializable {
sequenceCell = burdickBlSyntheticData.getSequenceTable().accessSequenceCellForDetector(detectorSetup.getMapOfDetectors().get("H1"), "S1");
sequenceCell.addTargetSpecies(pb208);
+
+
}
static {
@@ -86,6 +91,11 @@ public final class AnalysisMethodBuiltinFactory implements Serializable {
ku_204_5_6_7_8_Daly_AllFaradayPb.getSpeciesList().add(pb207);
ku_204_5_6_7_8_Daly_AllFaradayPb.getSpeciesList().add(pb208);
+ ku_204_5_6_7_8_Daly_AllFaradayPb.getTripoliRatiosList().add(new IsotopicRatio(pb204, pb208));
+ ku_204_5_6_7_8_Daly_AllFaradayPb.getTripoliRatiosList().add(new IsotopicRatio(pb205, pb208));
+ ku_204_5_6_7_8_Daly_AllFaradayPb.getTripoliRatiosList().add(new IsotopicRatio(pb207, pb208));
+ ku_204_5_6_7_8_Daly_AllFaradayPb.getTripoliRatiosList().add(new IsotopicRatio(pb207, pb208));
+
DetectorSetup detectorSetup = ku_204_5_6_7_8_Daly_AllFaradayPb.getMassSpectrometer().getDetectorSetup();
BaselineTable baselineTable = ku_204_5_6_7_8_Daly_AllFaradayPb.getBaselineTable();
diff --git a/TripoliCore/src/main/java/org/cirdles/tripoli/species/IsotopicRatio.java b/TripoliCore/src/main/java/org/cirdles/tripoli/species/IsotopicRatio.java
new file mode 100644
index 00000000..4f736465
--- /dev/null
+++ b/TripoliCore/src/main/java/org/cirdles/tripoli/species/IsotopicRatio.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 James Bowring, Noah McLean, Scott Burdick, and CIRDLES.org.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.cirdles.tripoli.species;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author James F. Bowring
+ */
+public class IsotopicRatio implements Serializable {
+ @Serial
+ private static final long serialVersionUID = 676151940943728743L;
+ private final SpeciesRecordInterface numerator;
+ private final SpeciesRecordInterface denominator;
+
+ public IsotopicRatio(SpeciesRecordInterface numerator, SpeciesRecordInterface denominator) {
+ this.numerator = numerator;
+ this.denominator = denominator;
+ }
+
+// private void readObject(ObjectInputStream stream) throws IOException,
+// ClassNotFoundException {
+// stream.defaultReadObject();
+//
+// ObjectStreamClass myObject = ObjectStreamClass.lookup(
+// Class.forName(IsotopicRatio.class.getCanonicalName()));
+// long theSUID = myObject.getSerialVersionUID();
+//
+// System.err.println("Customized De-serialization of IsotopicRatio "
+// + theSUID);
+// }
+}
\ No newline at end of file
diff --git a/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/aboutContent.txt b/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/aboutContent.txt
index f3b9506b..475860ae 100644
--- a/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/aboutContent.txt
+++ b/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/aboutContent.txt
@@ -1,3 +1,3 @@
Tripoli is a collaborative development effort coordinated by the Cyber Infrastructure Research and Development Lab for the Earth Sciences (CIRDLES.org)
-at the College of Charleston, Charleston, SC and
-the University of Kansas and Wayne State University.
\ No newline at end of file
+ at the College of Charleston, Charleston, SC with
+ the University of Kansas and Wayne State University.
\ No newline at end of file
diff --git a/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/contributorsContent.txt b/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/contributorsContent.txt
index 439fbf04..8964c695 100644
--- a/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/contributorsContent.txt
+++ b/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/contributorsContent.txt
@@ -1,5 +1,7 @@
Contributors:
-Jim Bowring,
-Noah McLean,
-Scott Burdick
-... you?
\ No newline at end of file
+ Jim Bowring,
+ Noah McLean,
+ Scott Burdick,
+ Ian Robinson,
+ Royal Boggs,
+ ... you?
\ No newline at end of file
diff --git a/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/supportersContent.txt b/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/supportersContent.txt
index 520c591d..c8205cf1 100644
--- a/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/supportersContent.txt
+++ b/TripoliCore/src/main/resources/org/cirdles/tripoli/docs/supportersContent.txt
@@ -1,2 +1,3 @@
Supporters:
-We have applied for an NSF grant ...
\ No newline at end of file
+We have been awarded a 3-year NSF grant: https://cirdles.org/Tripoli/nsf_award_abstract.html.
+ The College of Charleston supports CIRDLES.org with funding for undergraduates.
\ No newline at end of file
diff --git a/TripoliCore/src/test/java/org/cirdles/tripoli/dataProcessors/dataSources/synthetic/DataSourceProcessorOPPhoenixTest.java b/TripoliCore/src/test/java/org/cirdles/tripoli/dataProcessors/dataSources/synthetic/DataSourceProcessorOPPhoenixTest.java
index 7c30cc9d..40096ab5 100644
--- a/TripoliCore/src/test/java/org/cirdles/tripoli/dataProcessors/dataSources/synthetic/DataSourceProcessorOPPhoenixTest.java
+++ b/TripoliCore/src/test/java/org/cirdles/tripoli/dataProcessors/dataSources/synthetic/DataSourceProcessorOPPhoenixTest.java
@@ -18,13 +18,20 @@
import org.cirdles.commons.util.ResourceExtractor;
import org.cirdles.tripoli.Tripoli;
+import org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.dataOutputModels.rjmcmc.DataModelPlot;
+import org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.dataOutputModels.rjmcmc.DataModellerOutputRecord;
+import org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.dataOutputModels.rjmcmc.EnsemblesStore;
import org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.dataOutputModels.rjmcmc.MassSpecOutputDataRecord;
import org.cirdles.tripoli.sessions.analysis.massSpectrometerModels.dataSourceProcessors.DataSourceProcessor_OPPhoenix;
import org.cirdles.tripoli.sessions.analysis.methods.AnalysisMethodBuiltinFactory;
+import org.cirdles.tripoli.utilities.exceptions.TripoliException;
+import org.cirdles.tripoli.utilities.stateUtilities.TripoliSerializer;
+import org.cirdles.tripoli.visualizationUtilities.AbstractPlotBuilder;
import org.junit.jupiter.api.*;
import java.io.IOException;
import java.nio.file.Path;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -77,5 +84,15 @@ void prepareInputDataModelFromFileFiveIsotopes() throws IOException {
assert (massSpecOutputDataRecord.rawDataColumn().length == 162000);
assertEquals(-531920.15291, massSpecOutputDataRecord.rawDataColumn()[26669]);
+
+// try {
+// EnsemblesStore ensemblesStore = (EnsemblesStore) TripoliSerializer.getSerializedObjectFromFile("/Users/bowring/Development/Tripoli_ET/TripoliApp/EnsemblesStore.ser", true);
+// List ensembleRecordsList = ensemblesStore.getEnsembles();
+// DataModellerOutputRecord lastDataModelInit = ensemblesStore.getLastDataModelInit();
+// AbstractPlotBuilder[] plotBuilders = DataModelPlot.analysisAndPlotting(massSpecOutputDataRecord, ensembleRecordsList, lastDataModelInit);
+// } catch (TripoliException e) {
+// e.printStackTrace();
+// }
+
}
}
\ No newline at end of file
diff --git a/TripoliCore/src/test/java/org/cirdles/tripoli/sessions/SessionTest.java b/TripoliCore/src/test/java/org/cirdles/tripoli/sessions/SessionTest.java
index f1c04906..dbaa2c23 100644
--- a/TripoliCore/src/test/java/org/cirdles/tripoli/sessions/SessionTest.java
+++ b/TripoliCore/src/test/java/org/cirdles/tripoli/sessions/SessionTest.java
@@ -35,8 +35,6 @@ void initializeDefaultSession() throws TripoliException {
testSession.getMapOfAnalyses().put("testAnalysis", Analysis.initializeAnalysis("testAnalysis", analysisMethodsBuiltinMap.get("BurdickBlSyntheticData")));
testSession.getMapOfAnalyses().put("testAnalysis2", Analysis.initializeAnalysis("testAnalysis", analysisMethodsBuiltinMap.get("BurdickBlSyntheticData")));
-// testSession.getMapOfAnalyses().get("testAnalysis").
-
TripoliSerializer.serializeObjectToFile(testSession, String.valueOf(testFilePath.getFileName()));
Session testSession2 = (Session) TripoliSerializer.getSerializedObjectFromFile(String.valueOf(testFilePath.getFileName()), true);