diff --git a/pom.xml b/pom.xml index de32c279..82977bd6 100644 --- a/pom.xml +++ b/pom.xml @@ -237,7 +237,7 @@ com.github.bowring Calamari - v1.0.5 + -SNAPSHOT diff --git a/src/main/java/org/earthtime/ETReduxFrame.java b/src/main/java/org/earthtime/ETReduxFrame.java index 8f1f8e2c..36aea57c 100644 --- a/src/main/java/org/earthtime/ETReduxFrame.java +++ b/src/main/java/org/earthtime/ETReduxFrame.java @@ -1456,7 +1456,7 @@ private void customizeReduxSkin() { public void rebuildFractionDisplays(boolean performReduction, boolean inLiveMode) { ((TabbedReportViews) getReportTableTabbedPane()).setSample(theSample); - updateReportTable(performReduction, inLiveMode); + updateReportTable(performReduction, inLiveMode, ""); } /** @@ -1464,16 +1464,17 @@ public void rebuildFractionDisplays(boolean performReduction, boolean inLiveMode */ @Override public void updateReportTable() { - updateReportTable(false, false); + updateReportTable(false, false, ""); } /** * * @param performReduction * @param inLiveMode the value of inLiveMode + * @param fractionIdToFocus the value of fractionIdToFocus */ @Override - public void updateReportTable(boolean performReduction, boolean inLiveMode) { + public void updateReportTable(boolean performReduction, boolean inLiveMode, String fractionIdToFocus) { // march 2013 try { UPbFractionReducer.getInstance().setSessionCorrectedUnknownsSummaries(// @@ -1485,7 +1486,7 @@ public void updateReportTable(boolean performReduction, boolean inLiveMode) { theSample.reduceSampleData(inLiveMode); } - loadAndShowReportTableData(); + loadAndShowReportTableData(fractionIdToFocus); // oct 2014 // this statement makes a difference if user went back to project manager and changed things @@ -1502,9 +1503,10 @@ public void updateReportTable(boolean performReduction, boolean inLiveMode) { /** * + * @param fractionIdToFocus the value of fractionIdToFocus */ @Override - public void loadAndShowReportTableData() { + public void loadAndShowReportTableData(String fractionIdToFocus) { ((TabbedReportViews) getReportTableTabbedPane()).prepareTabs(); } @@ -3501,7 +3503,7 @@ private void LAICPMS_LegacyAnalysis_MC_UA_menuItemActionPerformed(java.awt.event }//GEN-LAST:event_LAICPMS_LegacyAnalysis_MC_UA_menuItemActionPerformed private void reduceAll_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reduceAll_buttonActionPerformed - updateReportTable(true, false); + updateReportTable(true, false, ""); }//GEN-LAST:event_reduceAll_buttonActionPerformed private void reportResultsTableAsStringsInExcel_menuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reportResultsTableAsStringsInExcel_menuItemActionPerformed @@ -3512,14 +3514,14 @@ private void loadReportSettingsModelFromLocalXMLFileActionPerformed(java.awt.eve myState.setMRUReportSettingsModelFolder(// setReportSettingsModelFromXMLFile(myState.getMRUReportSettingsModelFolder())); - updateReportTable(false, false); + updateReportTable(false, false, ""); }//GEN-LAST:event_loadReportSettingsModelFromLocalXMLFileActionPerformed private void editCurrentReportSettingsModel_menuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editCurrentReportSettingsModel_menuItemActionPerformed ReportSettingsInterface.EditReportSettings(theSample.getReportSettingsModel(), this); - updateReportTable(false, false); + updateReportTable(false, false, ""); }//GEN-LAST:event_editCurrentReportSettingsModel_menuItemActionPerformed private void reportResultsTableAsPDF_menuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reportResultsTableAsPDF_menuItemActionPerformed @@ -3892,12 +3894,12 @@ private void updateData_buttonActionPerformed(java.awt.event.ActionEvent evt) {/ private void selectAllFractions_menuItemActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectAllFractions_menuItemActionPerformed theSample.selectAllFractions(); - updateReportTable(false, false); + updateReportTable(false, false, ""); }//GEN-LAST:event_selectAllFractions_menuItemActionPerformed private void deSelectAllFractions_menuItemActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deSelectAllFractions_menuItemActionPerformed theSample.deSelectAllFractions(); - updateReportTable(false, false); + updateReportTable(false, false, ""); }//GEN-LAST:event_deSelectAllFractions_menuItemActionPerformed private void credits_menuItemActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_credits_menuItemActionPerformed @@ -3916,7 +3918,7 @@ private void saveCurrentReportSettingsModelAsLocalXMLFileActionPerformed(java.aw private void loadDefaultReportSettingsModelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadDefaultReportSettingsModelActionPerformed theSample.restoreDefaultReportSettingsModel(); theSample.setLegacyStatusForReportTable(); - updateReportTable(false, false); + updateReportTable(false, false, ""); }//GEN-LAST:event_loadDefaultReportSettingsModelActionPerformed private void writeCSVFileOfLAICPMSLegacyDataSampleFieldNames_SC_WSU_vBActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_writeCSVFileOfLAICPMSLegacyDataSampleFieldNames_SC_WSU_vBActionPerformed @@ -4023,7 +4025,7 @@ private void saveCurrentReportSettingsAsDefault_menuItemActionPerformed ( java.a private void loadEARTHTIMEDefaultReportSettingsModel_menuItemActionPerformed ( java.awt.event.ActionEvent evt ) {//GEN-FIRST:event_loadEARTHTIMEDefaultReportSettingsModel_menuItemActionPerformed SampleInterface.loadDefaultEARTHTIMEReportSettingsModel(theSample); theSample.setLegacyStatusForReportTable(); - updateReportTable(false, false); + updateReportTable(false, false, ""); }//GEN-LAST:event_loadEARTHTIMEDefaultReportSettingsModel_menuItemActionPerformed private void exit_menuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit_menuItemActionPerformed diff --git a/src/main/java/org/earthtime/Tripoli/dataModels/RawIntensityDataModel.java b/src/main/java/org/earthtime/Tripoli/dataModels/RawIntensityDataModel.java index c26d6ce6..2751d8b0 100644 --- a/src/main/java/org/earthtime/Tripoli/dataModels/RawIntensityDataModel.java +++ b/src/main/java/org/earthtime/Tripoli/dataModels/RawIntensityDataModel.java @@ -107,6 +107,7 @@ public class RawIntensityDataModel // private int peakWidth; private int backgroundRightShade; private int backgroundWidth; + private int timeToNextTimeZero; /** * @@ -1348,4 +1349,18 @@ public int getBackgroundWidth() { public void setBackgroundWidth(int backgroundWidth) { this.backgroundWidth = backgroundWidth; } + + /** + * @return the timeToNextTimeZero + */ + public int getTimeToNextTimeZero() { + return timeToNextTimeZero; + } + + /** + * @param timeToNextTimeZero the timeToNextTimeZero to set + */ + public void setTimeToNextTimeZero(int timeToNextTimeZero) { + this.timeToNextTimeZero = timeToNextTimeZero; + } } diff --git a/src/main/java/org/earthtime/Tripoli/dataViews/AbstractRawDataView.java b/src/main/java/org/earthtime/Tripoli/dataViews/AbstractRawDataView.java index a35403c3..1eb1eb72 100644 --- a/src/main/java/org/earthtime/Tripoli/dataViews/AbstractRawDataView.java +++ b/src/main/java/org/earthtime/Tripoli/dataViews/AbstractRawDataView.java @@ -1173,7 +1173,7 @@ public void updateReportTableView() { if (uPbReduxFrame == null) { uPbReduxFrame = ((AbstractRawDataView) sampleSessionDataView).getuPbReduxFrame(); } - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } diff --git a/src/main/java/org/earthtime/Tripoli/dataViews/dataMonitorViews/AbstractDataMonitorView.java b/src/main/java/org/earthtime/Tripoli/dataViews/dataMonitorViews/AbstractDataMonitorView.java index 46e57619..c2b3ca60 100644 --- a/src/main/java/org/earthtime/Tripoli/dataViews/dataMonitorViews/AbstractDataMonitorView.java +++ b/src/main/java/org/earthtime/Tripoli/dataViews/dataMonitorViews/AbstractDataMonitorView.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Comparator; import java.util.Iterator; import java.util.Map; import java.util.SortedSet; @@ -52,12 +53,15 @@ import javax.swing.JLabel; import javax.swing.JLayeredPane; import javax.swing.JProgressBar; +import javax.swing.JRootPane; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.SwingWorker; import javax.swing.Timer; +import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; +import javax.swing.border.LineBorder; import javax.swing.tree.DefaultMutableTreeNode; import org.earthtime.ETReduxFrame; import org.earthtime.Tripoli.dataModels.DataModelInterface; @@ -98,6 +102,7 @@ import org.earthtime.projects.ProjectInterface; import org.earthtime.ratioDataModels.AbstractRatiosDataModel; import org.earthtime.reduxLabData.ReduxLabData; +import org.earthtime.reportViews.ReportAliquotFractionsView; import org.earthtime.reportViews.TabbedReportViews; import org.earthtime.reports.ReportSettingsInterface; import org.earthtime.samples.SampleInterface; @@ -183,6 +188,7 @@ public class AbstractDataMonitorView extends AbstractRawDataView private static JProgressBar loadDataTaskProgressBar; private static JTextArea rawDataFilePathTextArea; + private static JLabel mostRecentFractionData; private final static int pdfWidth = 625; private final static int pdfHeight = 575; @@ -224,7 +230,7 @@ public AbstractDataMonitorView(ProjectInterface myProject, ProjectManagerSubscri saveMonitoredTime = 0L; tripoliFractions = new TreeSet<>(); - parentDimension = new Dimension(2050, 1250); + parentDimension = new Dimension(2050, 1275); initView(); } @@ -242,6 +248,8 @@ private void initView() { progressBarFactory(); + showMostRecentFractionLabelFactory(); + dataMonitorTimer = new Timer(2500, (ActionEvent e) -> { monitorDataFile(); }); @@ -282,7 +290,11 @@ private void fireLoadDataTask() { //loadAndShowRawData(rawDataFileHandler.getAcquisitionModel().isUsingFullPropagation(), 0); } - private void updateDisplays() { + /** + * + * @param fractionIdToFocus the value of fractionIdToFocus + */ + private void updateDisplays(String fractionIdToFocus) { // need to decide when to fit sessions // initially let's just show the standards @@ -305,7 +317,7 @@ private void updateDisplays() { } try { - getuPbReduxFrame().updateReportTable(true, true); + getuPbReduxFrame().updateReportTable(true, true, fractionIdToFocus); } catch (Exception e) { } @@ -413,9 +425,11 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) { ((TabbedReportViews) reportTableTabbedPane).initializeTabs(); ((TabbedReportViews) reportTableTabbedPane).prepareTabs(); - reportTableTabbedPane.setBounds(leftMargin, topMargin + 705, 1900, 500); + reportTableTabbedPane.setBounds(leftMargin, topMargin + 705, 1930, 500); this.add(reportTableTabbedPane, LAYER_FIVE); + this.add(mostRecentFractionData); + } private void rawDataFilePathTextFactory() throws IOException { @@ -431,9 +445,20 @@ private void rawDataFilePathTextFactory() throws IOException { this.add(rawDataFilePathTextArea, JLayeredPane.DEFAULT_LAYER); } + private void showMostRecentFractionLabelFactory() { + // show rawdatafile path + mostRecentFractionData = new JLabel("Most Recent"); + + mostRecentFractionData.setBounds(leftMargin + 25, topMargin + 647, 500, 22); + mostRecentFractionData.setBorder(new LineBorder(Color.black)); + + mostRecentFractionData.setForeground(Color.blue); + this.add(mostRecentFractionData, JLayeredPane.DEFAULT_LAYER); + } + private void buttonFactory() { ET_JButton closeAndReviewButton = new ET_JButton("Halt Processing and Review Samples"); - closeAndReviewButton.setBounds(leftMargin + 0, topMargin + 660, 450, 25); + closeAndReviewButton.setBounds(leftMargin + 0, topMargin + 670, 450, 22); closeAndReviewButton.addActionListener((ActionEvent ae) -> { try { loadDataTask.cancel(true); @@ -449,7 +474,7 @@ private void buttonFactory() { this.add(closeAndReviewButton, LAYER_FIVE); ET_JButton recalcButton = new ET_JButton("Update Sessions"); - recalcButton.setBounds(leftMargin + 450, topMargin + 660, 120, 25); + recalcButton.setBounds(leftMargin + 450, topMargin + 670, 120, 22); recalcButton.addActionListener((ActionEvent ae) -> { try { tripoliSession.resetAllUPbFractionReduction(); @@ -458,7 +483,7 @@ private void buttonFactory() { } catch (Exception e) { } try { - getuPbReduxFrame().updateReportTable(true, true); + getuPbReduxFrame().updateReportTable(true, true, ""); } catch (Exception e) { } preparePanel(true, true); @@ -468,7 +493,7 @@ private void buttonFactory() { this.add(recalcButton, LAYER_FIVE); ET_JButton refreshButton = new ET_JButton("Refresh Views"); - refreshButton.setBounds(leftMargin + 570, topMargin + 660, 120, 25); + refreshButton.setBounds(leftMargin + 570, topMargin + 670, 120, 22); refreshButton.addActionListener((ActionEvent ae) -> { preparePanel(true, false); }); @@ -477,10 +502,10 @@ private void buttonFactory() { this.add(refreshButton, LAYER_FIVE); ET_JButton editReportSettingsButton = new ET_JButton("Edit Report Settings"); - editReportSettingsButton.setBounds(602, topMargin + 600, 120, 25); + editReportSettingsButton.setBounds(602, topMargin + 600, 120, 22); editReportSettingsButton.addActionListener((ActionEvent ae) -> { ReportSettingsInterface.EditReportSettings(project.getSuperSample().getReportSettingsModel(), uPbReduxFrame); - uPbReduxFrame.updateReportTable(false, true); + uPbReduxFrame.updateReportTable(false, true, ""); ((TabbedReportViews) reportTableTabbedPane).prepareTabs(); }); @@ -488,7 +513,7 @@ private void buttonFactory() { this.add(editReportSettingsButton, LAYER_FIVE); ET_JButton concordiaSettingsButton = new ET_JButton("Concordia Settings"); - concordiaSettingsButton.setBounds(602, topMargin + 550, 120, 25); + concordiaSettingsButton.setBounds(602, topMargin + 550, 120, 22); concordiaSettingsButton.addActionListener((ActionEvent ae) -> { ((AliquotDetailsDisplayInterface) concordiaGraphPanel).showConcordiaDisplayOptionsDialog(); }); @@ -504,7 +529,7 @@ private void progressBarFactory() { loadDataTaskProgressBar.setMaximum(100); loadDataTaskProgressBar.setMinimum(0); loadDataTaskProgressBar.setValue(0); - loadDataTaskProgressBar.setBounds(leftMargin + 0, 695, 450, 20); + loadDataTaskProgressBar.setBounds(leftMargin + 0, 700, 450, 20); } /** @@ -628,7 +653,7 @@ public void preparePDF() { add(probabilityPanel, javax.swing.JLayeredPane.DEFAULT_LAYER); - kwikiPDFToolBar = new KwikiPDFToolBar(1350, concordiaGraphPanel.getHeight() + topMargin + 60, probabilityPanel, concordiaGraphPanel, project.getSuperSample(), dateTreeByAliquot); + kwikiPDFToolBar = new KwikiPDFToolBar(1350, concordiaGraphPanel.getHeight() + topMargin + 50, probabilityPanel, concordiaGraphPanel, project.getSuperSample(), dateTreeByAliquot); add(kwikiPDFToolBar, javax.swing.JLayeredPane.DEFAULT_LAYER); } @@ -710,7 +735,7 @@ private void loadAndShowRawData(// } - private synchronized void loadAndShowRawDataFinishUp() { + private synchronized void loadAndShowRawDataFinishUp() { SortedSet tripoliFractionsCurrent; if (savedCountOfFractions == 0) { @@ -770,7 +795,6 @@ private synchronized void loadAndShowRawDataFinishUp() { tripoliSession.prepareFractionTimeStamps(); tripoliSession.processRawData(true); -// tripoliSession.postProcessDataForCommonLeadLossPreparation(); try { loadDataTaskProgressBar.repaint(); @@ -781,7 +805,25 @@ private synchronized void loadAndShowRawDataFinishUp() { getuPbReduxFrame().initializeProject(true); - updateDisplays(); +//// updateDisplays(""); + // July 2016 + // TODO: refactor so more efficient + // find latest fraction and show in table + SortedSet tripoliFractionsByDate = new TreeSet<>(new Comparator() { + @Override + public int compare(TripoliFraction tf1, TripoliFraction tf2) { + return Long.compare(tf2.getPeakTimeStamp(), tf1.getPeakTimeStamp()); + } + }); + + tripoliFractionsByDate.addAll(tripoliFractions); + System.out.println("Latest = " + tripoliFractionsByDate.first().getFractionID()); + mostRecentFractionData.setText(tripoliFractionsByDate.first().getFractionID()); + + updateDisplays(tripoliFractionsByDate.first().getFractionID()); + + ((ReportAliquotFractionsView) ((TabbedReportViews) reportTableTabbedPane).getViewTabulatedAliquotActiveFractions()) + .forceVerticalScrollToShowSpecificRow(tripoliFractionsByDate.first().getFractionID()); } } @@ -854,7 +896,7 @@ public void propertyChange(PropertyChangeEvent pce) { } else if ("refMaterialLoaded".equalsIgnoreCase(pce.getPropertyName())) { try { tripoliSession.setRefMaterialSessionFittedForLiveMode(false); - System.out.println("ref material loaded <<<<"); +// System.out.println("ref material loaded <<<<"); } catch (Exception e) { } } @@ -873,6 +915,24 @@ protected class DataMonitorViewDialog extends javax.swing.JDialog { */ public DataMonitorViewDialog(Dialog owner, boolean modal) { super(owner, modal); + + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Motif".equals(info.getName())) { //Nimbus (original), Motif, Metal + try { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException classNotFoundException) { + } + break; + } + } + + initDialog(); + } + + private void initDialog() { + setUndecorated(false); + getRootPane().setWindowDecorationStyle(JRootPane.FRAME); + setTitle("Live Data Monitor"); } } @@ -927,10 +987,14 @@ public JDialog displayModelInFrame() { dataMonitorViewDialog = new DataMonitorViewDialog(null, true); dataMonitorViewDialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); - dataMonitorViewDialog.setBounds( // - 400, 400, // - (int) parentDimension.getWidth(), - (int) parentDimension.getHeight()); +// dataMonitorViewDialog.setBounds( // +// 400, 400, // +// (int) parentDimension.getWidth(), +// (int) parentDimension.getHeight()); + dataMonitorViewDialog.setPreferredSize(new Dimension( + (int) parentDimension.getWidth() - 25, + (int) parentDimension.getHeight() - 25)); + dataMonitorViewDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);//.HIDE_ON_CLOSE); //Get the screen size diff --git a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionOverlayContainer.java b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionOverlayContainer.java index d9ec6bff..4db98ae1 100644 --- a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionOverlayContainer.java +++ b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionOverlayContainer.java @@ -37,7 +37,7 @@ * @author James F. Bowring */ public class RawDataSessionOverlayContainer extends AbstractRawDataView { - + private List rawIntensitiesDataOverlayViews; private AbstractRawDataView firstRawIntensitiesDataOverlayView; private List rawIntensitiesDataSerialViews; @@ -54,13 +54,13 @@ public class RawDataSessionOverlayContainer extends AbstractRawDataView { private boolean onLeftOfBackground; private boolean onRightOfBackground; private final AbstractRawDataView rawDataSessionSerialContainer; - + public RawDataSessionOverlayContainer(Rectangle bounds, AbstractRawDataView rawDataSessionSerialContainer) { super(bounds); this.rawDataSessionSerialContainer = rawDataSessionSerialContainer; initSession(); } - + private void initSession() { setBackground(new Color(255, 255, 255)); setOpaque(true); @@ -75,14 +75,13 @@ private void initSession() { @Override public void paint(Graphics2D g2d) { super.paint(g2d); - + BufferedImage bufferedImage = new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB); Graphics2D big = bufferedImage.createGraphics(); Rectangle r = new Rectangle(0, 0, 5, 5); // mark peak -// g2d.setPaint(new Color(241, 255, 240));//pale green Rectangle2D peakZone = new Rectangle2D.Double(// mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex + peakLeftShade]), // mapY(maxY),// @@ -94,17 +93,17 @@ public void paint(Graphics2D g2d) { big.fillOval(0, 0, 5, 5); g2d.setPaint(new TexturePaint(bufferedImage, r)); g2d.fill(peakZone); - + g2d.setPaint(Color.black); - + g2d.setStroke(new BasicStroke(0.75f)); - + g2d.draw(new Line2D.Double(// mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex + peakLeftShade]), // mapY(minY),// mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex + peakLeftShade]),// mapY(maxY))); - + g2d.draw(new Line2D.Double(// mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex + peakLeftShade + peakWidth]), // mapY(minY),// @@ -112,7 +111,6 @@ public void paint(Graphics2D g2d) { mapY(maxY))); // mark background -// g2d.setPaint(new Color(253, 253, 233));//pale yellow Rectangle2D backgroundZone = new Rectangle2D.Double(// mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex - backgroundRightShade - backgroundWidth]), // mapY(maxY),// @@ -124,17 +122,17 @@ public void paint(Graphics2D g2d) { big.fillOval(0, 0, 5, 5); g2d.setPaint(new TexturePaint(bufferedImage, r)); g2d.fill(backgroundZone); - + g2d.setPaint(Color.black); - + g2d.setStroke(new BasicStroke(0.75f)); - + g2d.draw(new Line2D.Double(// mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex - backgroundRightShade - backgroundWidth]), // mapY(minY),// mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex - backgroundRightShade - backgroundWidth]),// mapY(maxY))); - + g2d.draw(new Line2D.Double(// mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex - backgroundRightShade]), // mapY(minY),// @@ -161,7 +159,7 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) { //this.removeAll(); setDisplayOffsetY(0.0); setDisplayOffsetX(0.0); - + rawIntensitiesDataOverlayViews = new ArrayList<>(); Component[] components = getComponents(); for (int i = 0; i < components.length; i++) { @@ -169,7 +167,7 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) { rawIntensitiesDataOverlayViews.add(((AbstractRawDataView) components[i])); } } - + firstRawIntensitiesDataOverlayView = rawIntensitiesDataOverlayViews.get(0); myOnPeakNormalizedAquireTimes = firstRawIntensitiesDataOverlayView.getDataModel().getNormalizedOnPeakAquireTimes(); peakLeftShade = ((RawIntensityDataModel) firstRawIntensitiesDataOverlayView.getDataModel()).getPeakLeftShade(); @@ -177,7 +175,7 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) { backgroundRightShade = ((RawIntensityDataModel) firstRawIntensitiesDataOverlayView.getDataModel()).getBackgroundRightShade(); backgroundWidth = ((RawIntensityDataModel) firstRawIntensitiesDataOverlayView.getDataModel()).getBackgroundWidth(); timeZeroRelativeIndex = ((RawIntensityDataModel) firstRawIntensitiesDataOverlayView.getDataModel()).getTimeZeroRelativeIndex(); - + minX = firstRawIntensitiesDataOverlayView.getMinX(); maxX = firstRawIntensitiesDataOverlayView.getMaxX(); minY = firstRawIntensitiesDataOverlayView.getMinY(); @@ -191,7 +189,7 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) { rawIntensitiesDataSerialViews.add(((AbstractRawDataView) components[i])); } } - + } /** @@ -201,11 +199,11 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) { @Override public void mousePressed(MouseEvent evt) { } - + @Override public void mouseReleased(MouseEvent evt) { } - + @Override public void mouseMoved(MouseEvent evt) { insidePeak = false; @@ -214,7 +212,7 @@ public void mouseMoved(MouseEvent evt) { insideBackground = false; onLeftOfBackground = false; onRightOfBackground = false; - + if (confirmMouseInOnPeakZone(evt.getX())) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); insidePeak = true; @@ -224,7 +222,7 @@ public void mouseMoved(MouseEvent evt) { } else if (confirmMouseRightPeakZone(evt.getX())) { setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); onRightOfPeak = true; - + } else if (confirmMouseInBackgroundZone(evt.getX())) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); insideBackground = true; @@ -238,178 +236,187 @@ public void mouseMoved(MouseEvent evt) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } - + @Override public void mouseDragged(MouseEvent evt) { if (insidePeak) { int deltaX = convertMouseXToValue(evt.getX()) - currentX; if (deltaX < -1 * peakLeftShade) { deltaX = -1 * peakLeftShade; - } - if ((timeZeroRelativeIndex + peakLeftShade + peakWidth + deltaX) > mapX(0.90 * maxX)) { - deltaX = (int) mapX(0.90 * maxX) - (timeZeroRelativeIndex + peakLeftShade + peakWidth); + } else if ((timeZeroRelativeIndex + peakLeftShade + peakWidth + deltaX) > (0.95 * maxX)) { + deltaX = (int) (0.95 * maxX) - (timeZeroRelativeIndex + peakLeftShade + peakWidth); } currentX += deltaX; peakLeftShade += deltaX; updateModels(); - + repaint(); } - + if (onLeftOfPeak) { int deltaX = convertMouseXToValue(evt.getX()) - currentX; if (deltaX < -1 * peakLeftShade) { deltaX = -1 * peakLeftShade; - } - if (deltaX > (peakWidth - 10)) { - deltaX = peakWidth - 10; + } else { + if (deltaX > (peakWidth - 10)) { + deltaX = peakWidth - 10; + } } currentX += deltaX; peakLeftShade += deltaX; peakWidth -= deltaX; updateModels(); - + repaint(); } - + if (onRightOfPeak) { int deltaX = convertMouseXToValue(evt.getX()) - currentX; - if ((timeZeroRelativeIndex + peakLeftShade + peakWidth + deltaX) > mapX(0.90 * maxX)) { - deltaX = (int) mapX(0.90 * maxX) - (timeZeroRelativeIndex + peakLeftShade + peakWidth); + if ((timeZeroRelativeIndex + peakLeftShade + peakWidth + deltaX) > (0.95 * maxX)) { + deltaX = (int) ((0.95 * maxX)) - (timeZeroRelativeIndex + peakLeftShade + peakWidth); + } else { + if ((deltaX < 0) && (Math.abs(deltaX) > (peakWidth - 10))) { + deltaX = -(peakWidth - 10); + } } - if (Math.abs(deltaX) > (peakWidth - 10)) { - deltaX = -(peakWidth - 10); - } - + + currentX += deltaX; peakWidth += deltaX; updateModels(); - - currentX += deltaX; + repaint(); } - + if (insideBackground) { int deltaX = convertMouseXToValue(evt.getX()) - currentX; if (deltaX > backgroundRightShade) { deltaX = backgroundRightShade; - } - if ((timeZeroRelativeIndex - backgroundRightShade - backgroundWidth + deltaX) < mapX(1.10 * minX)) { - deltaX = (int) mapX(1.10 * minX) - (timeZeroRelativeIndex - backgroundRightShade - backgroundWidth); + } else { + if ((timeZeroRelativeIndex - backgroundRightShade - backgroundWidth + deltaX) < (1.05 * minX)) { + deltaX = (int) (1.05 * minX) - (timeZeroRelativeIndex - backgroundRightShade - backgroundWidth); + } } currentX += deltaX; backgroundRightShade -= deltaX; updateModels(); - + repaint(); } - + if (onLeftOfBackground) { int deltaX = convertMouseXToValue(evt.getX()) - currentX; - if ((timeZeroRelativeIndex - backgroundRightShade - backgroundWidth + deltaX) < mapX(1.10 * minX)) { - deltaX = (int) mapX(1.10 * minX) - (timeZeroRelativeIndex - backgroundRightShade - backgroundWidth); - } - if (deltaX > (backgroundWidth - 10)) { - deltaX = backgroundWidth - 10; + if ((timeZeroRelativeIndex - backgroundRightShade - backgroundWidth + deltaX) < (1.05 * minX)) { + deltaX = (int) (1.05 * minX) - (timeZeroRelativeIndex - backgroundRightShade - backgroundWidth); + } else { + if (deltaX > (backgroundWidth - 10)) { + deltaX = backgroundWidth - 10; + } } currentX += deltaX; backgroundWidth -= deltaX; updateModels(); - + repaint(); } - + if (onRightOfBackground) { int deltaX = convertMouseXToValue(evt.getX()) - currentX; if (deltaX > backgroundRightShade) { deltaX = backgroundRightShade; - } - if (deltaX > (backgroundWidth - 10)) { - deltaX = backgroundWidth - 10; + } else { + if (deltaX > (backgroundWidth - 10)) { + deltaX = backgroundWidth - 10; + } } currentX += deltaX; backgroundRightShade -= deltaX; backgroundWidth += deltaX; updateModels(); - + repaint(); - } + } } - + private void updateModels() { for (int i = 0; i < rawIntensitiesDataOverlayViews.size(); i++) { ((RawIntensityDataModel) rawIntensitiesDataOverlayViews.get(i).getDataModel()).setPeakLeftShade(peakLeftShade); ((RawIntensityDataModel) rawIntensitiesDataOverlayViews.get(i).getDataModel()).setPeakWidth(peakWidth); ((RawIntensityDataModel) rawIntensitiesDataOverlayViews.get(i).getDataModel()).setBackgroundRightShade(backgroundRightShade); ((RawIntensityDataModel) rawIntensitiesDataOverlayViews.get(i).getDataModel()).setBackgroundWidth(backgroundWidth); - + rawIntensitiesDataOverlayViews.get(i).preparePanel(true, false); rawIntensitiesDataSerialViews.get(i).preparePanel(true, false); rawIntensitiesDataSerialViews.get(i).repaint(); } - - rawDataSessionSerialContainer.revalidate(); - + +// rawDataSessionSerialContainer.revalidate(); + rawDataSessionSerialContainer.refreshPanel(true, false); + } - + private boolean confirmMouseInOnPeakZone(int x) { boolean retVal = false; - + currentX = convertMouseXToValue(x); retVal = ((currentX > (timeZeroRelativeIndex + peakLeftShade))// && (currentX < (timeZeroRelativeIndex + peakLeftShade + peakWidth))); - + return retVal; } - + private boolean confirmMouseLeftPeakZone(int x) { boolean retVal = false; - + currentX = convertMouseXToValue(x); - retVal = (currentX == (timeZeroRelativeIndex + peakLeftShade)); - + retVal = (currentX >= (timeZeroRelativeIndex + peakLeftShade - 2))// + && (currentX <= (timeZeroRelativeIndex + peakLeftShade + 2)); + return retVal; } - + private boolean confirmMouseRightPeakZone(int x) { boolean retVal = false; - + currentX = convertMouseXToValue(x); - retVal = (currentX == (timeZeroRelativeIndex + peakLeftShade + peakWidth)); - + retVal = (currentX <= (timeZeroRelativeIndex + peakLeftShade + peakWidth + 2))// + && (currentX >= (timeZeroRelativeIndex + peakLeftShade + peakWidth - 2)); + return retVal; } - + private boolean confirmMouseInBackgroundZone(int x) { boolean retVal = false; - + currentX = convertMouseXToValue(x); retVal = ((currentX > (timeZeroRelativeIndex - backgroundRightShade - backgroundWidth))// && (currentX < (timeZeroRelativeIndex - backgroundRightShade))); - + return retVal; } - + private boolean confirmMouseLeftBackgroundZone(int x) { boolean retVal = false; - + currentX = convertMouseXToValue(x); - retVal = (currentX == (timeZeroRelativeIndex - backgroundRightShade - backgroundWidth)); - + retVal = (currentX >= (timeZeroRelativeIndex - backgroundRightShade - backgroundWidth - 2))// + && (currentX <= (timeZeroRelativeIndex - backgroundRightShade - backgroundWidth + 2)); + return retVal; } - + private boolean confirmMouseRightBackgroundZone(int x) { boolean retVal = false; - + currentX = convertMouseXToValue(x); - retVal = (currentX == (timeZeroRelativeIndex - backgroundRightShade)); - + retVal = (currentX >= (timeZeroRelativeIndex - backgroundRightShade - 2))// + && (currentX <= (timeZeroRelativeIndex - backgroundRightShade + 2)); + return retVal; } - + @Override public DataModelInterface getDataModel() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } - + } diff --git a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionPlot.java b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionPlot.java index 8920af38..91f54725 100644 --- a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionPlot.java +++ b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionPlot.java @@ -24,7 +24,6 @@ import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D; import java.util.List; -import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; import org.earthtime.Tripoli.dataModels.DataModelInterface; import org.earthtime.Tripoli.dataModels.RawIntensityDataModel; import org.earthtime.Tripoli.dataViews.AbstractRawDataView; @@ -43,6 +42,7 @@ public class RawDataSessionPlot extends AbstractRawDataView { private int backgroundRightShade; private int backgroundWidth; private int timeZeroRelativeIndex; + private int timeToNextTimeZero; /** * @@ -121,109 +121,100 @@ public void paint(Graphics2D g2d) { mapX(myOnPeakNormalizedAquireTimes[timeZeroRelativeIndex - backgroundRightShade]),// mapY(maxY))); - // calculate good right to graph - DescriptiveStatistics timeZeroDeltas = new DescriptiveStatistics(); - for (int i = 0; i < sessionTimeZeroIndices.size() - 1; i++) { - timeZeroDeltas.addValue(Math.abs(sessionTimeZeroIndices.get(i + 1) - sessionTimeZeroIndices.get(i))); - } - int timeToNextTimeZero = (int) timeZeroDeltas.getMax(); + // mark time zero + g2d.setPaint(Color.red); + g2d.setStroke(new BasicStroke(1.0f)); + g2d.draw(new Line2D.Double(// + mapX(timeZeroRelativeIndex), // + mapY(minY),// + mapX(timeZeroRelativeIndex),// + mapY(maxY))); + g2d.setPaint(Color.black); for (int i = 0; i < sessionTimeZeroIndices.size(); i++) { - int timeZeroStartIndex = sessionTimeZeroIndices.get(i); - -// int timeToNextTimeZero = 300; -// if (i < sessionTimeZeroIndices.size() - 1) { -// timeToNextTimeZero = sessionTimeZeroIndices.get(i + 1) - timeZeroStartIndex; -// } else { -// timeToNextTimeZero = timeZeroStartIndex - sessionTimeZeroIndices.get(i - 1); -// } - // mark time zero - g2d.setPaint(Color.red); - g2d.setStroke(new BasicStroke(1.0f)); - g2d.draw(new Line2D.Double(// - mapX(timeZeroRelativeIndex), // - mapY(minY),// - mapX(timeZeroRelativeIndex),// - mapY(maxY))); - g2d.setPaint(Color.black); - - Shape fractionPlot = new Path2D.Double(); - ((Path2D) fractionPlot).moveTo(// - mapX(0), mapY(myOnPeakData[timeZeroStartIndex - timeZeroRelativeIndex])); - int t = 1; - for (int j = timeZeroStartIndex - timeZeroRelativeIndex - 1; j < timeZeroStartIndex + timeToNextTimeZero - timeZeroRelativeIndex; j++) { - ((Path2D) fractionPlot).lineTo(// - mapX(t), mapY(myOnPeakData[j])); - t++; + if (sessionTimeZeroIndices.get(i) > 0) { + int timeZeroStartIndex = sessionTimeZeroIndices.get(i); + + Shape fractionPlot = new Path2D.Double(); + ((Path2D) fractionPlot).moveTo(// + mapX(0), mapY(myOnPeakData[timeZeroStartIndex - timeZeroRelativeIndex])); + int t = 1; + for (int j = timeZeroStartIndex - timeZeroRelativeIndex - 1; j < timeZeroStartIndex + timeToNextTimeZero - timeZeroRelativeIndex; j++) { + ((Path2D) fractionPlot).lineTo(// + mapX(t), mapY(myOnPeakData[j])); + t++; - } - g2d.setPaint(Color.black); - g2d.setStroke(new BasicStroke(0.75f)); - g2d.draw(fractionPlot); + } + g2d.setPaint(Color.black); + g2d.setStroke(new BasicStroke(0.75f)); + g2d.draw(fractionPlot); + } } } else { //serial mode for (int i = 0; i < sessionTimeZeroIndices.size(); i++) { - // mark onpeak - g2d.setPaint(new Color(241, 255, 240)); //pale green - int peakStartIndex = sessionTimeZeroIndices.get(i) + peakLeftShade; - g2d.fill(new Rectangle2D.Double(// - mapX(myOnPeakNormalizedAquireTimes[peakStartIndex]), // - mapY(maxY),// - mapX(peakWidth),// - Math.abs(mapY(maxY) - mapY(minY)))); - - g2d.setPaint(Color.black); - g2d.setStroke(new BasicStroke(0.75f)); - - g2d.draw(new Line2D.Double(// - mapX(myOnPeakNormalizedAquireTimes[peakStartIndex]), // - mapY(minY),// - mapX(myOnPeakNormalizedAquireTimes[peakStartIndex]),// - mapY(maxY))); - - g2d.draw(new Line2D.Double(// - mapX(myOnPeakNormalizedAquireTimes[peakStartIndex + peakWidth]), // - mapY(minY),// - mapX(myOnPeakNormalizedAquireTimes[peakStartIndex + peakWidth]),// - mapY(maxY))); - - // mark background - g2d.setPaint(new Color(253, 253, 233)); //pale yellow - int backgroundStartIndex = sessionTimeZeroIndices.get(i) - backgroundRightShade - backgroundWidth; - g2d.fill(new Rectangle2D.Double(// - mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex]), // - mapY(maxY),// - mapX(backgroundWidth),// - Math.abs(mapY(maxY) - mapY(minY)))); - - g2d.setPaint(Color.black); - g2d.setStroke(new BasicStroke(0.75f)); - - g2d.draw(new Line2D.Double(// - mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex]), // - mapY(minY),// - mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex]),// - mapY(maxY))); - - g2d.draw(new Line2D.Double(// - mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex + backgroundWidth]), // - mapY(minY),// - mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex + backgroundWidth]),// - mapY(maxY))); - - // mark time zero - g2d.setPaint(Color.red); - int timeZeroIndex = sessionTimeZeroIndices.get(i); - g2d.draw(new Line2D.Double(// - mapX(myOnPeakNormalizedAquireTimes[timeZeroIndex]), // - mapY(minY),// - mapX(myOnPeakNormalizedAquireTimes[timeZeroIndex]),// - mapY(maxY))); - g2d.setPaint(Color.black); + // test if ignored + if (sessionTimeZeroIndices.get(i) > 0) { + // mark onpeak + g2d.setPaint(new Color(241, 255, 240)); //pale green + int peakStartIndex = sessionTimeZeroIndices.get(i) + peakLeftShade; + g2d.fill(new Rectangle2D.Double(// + mapX(myOnPeakNormalizedAquireTimes[peakStartIndex]), // + mapY(maxY),// + mapX(peakWidth),// + Math.abs(mapY(maxY) - mapY(minY)))); + + g2d.setPaint(Color.black); + g2d.setStroke(new BasicStroke(0.75f)); + + g2d.draw(new Line2D.Double(// + mapX(myOnPeakNormalizedAquireTimes[peakStartIndex]), // + mapY(minY),// + mapX(myOnPeakNormalizedAquireTimes[peakStartIndex]),// + mapY(maxY))); + + g2d.draw(new Line2D.Double(// + mapX(myOnPeakNormalizedAquireTimes[peakStartIndex + peakWidth]), // + mapY(minY),// + mapX(myOnPeakNormalizedAquireTimes[peakStartIndex + peakWidth]),// + mapY(maxY))); + + // mark background + g2d.setPaint(new Color(253, 253, 233)); //pale yellow + int backgroundStartIndex = sessionTimeZeroIndices.get(i) - backgroundRightShade - backgroundWidth; + g2d.fill(new Rectangle2D.Double(// + mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex]), // + mapY(maxY),// + mapX(backgroundWidth),// + Math.abs(mapY(maxY) - mapY(minY)))); + + g2d.setPaint(Color.black); + g2d.setStroke(new BasicStroke(0.75f)); + + g2d.draw(new Line2D.Double(// + mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex]), // + mapY(minY),// + mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex]),// + mapY(maxY))); + + g2d.draw(new Line2D.Double(// + mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex + backgroundWidth]), // + mapY(minY),// + mapX(myOnPeakNormalizedAquireTimes[backgroundStartIndex + backgroundWidth]),// + mapY(maxY))); + + // mark time zero + g2d.setPaint(Color.red); + int timeZeroIndex = sessionTimeZeroIndices.get(i); + g2d.draw(new Line2D.Double(// + mapX(myOnPeakNormalizedAquireTimes[timeZeroIndex]), // + mapY(minY),// + mapX(myOnPeakNormalizedAquireTimes[timeZeroIndex]),// + mapY(maxY))); + g2d.setPaint(Color.black); + } } - // draw data over selection zone Shape connectingLine = new Path2D.Double(); ((Path2D) connectingLine).moveTo(// @@ -266,6 +257,7 @@ public void preparePanel(boolean doReScale, boolean inLiveMode backgroundRightShade = ((RawIntensityDataModel) rawRatioDataModel).getBackgroundRightShade(); backgroundWidth = ((RawIntensityDataModel) rawRatioDataModel).getBackgroundWidth(); timeZeroRelativeIndex = ((RawIntensityDataModel) rawRatioDataModel).getTimeZeroRelativeIndex(); + timeToNextTimeZero = ((RawIntensityDataModel) rawRatioDataModel).getTimeToNextTimeZero(); if (doReScale) { setDisplayOffsetY(0.0); @@ -276,7 +268,7 @@ public void preparePanel(boolean doReScale, boolean inLiveMode minX = myOnPeakNormalizedAquireTimes[0]; maxX = myOnPeakNormalizedAquireTimes[myOnPeakNormalizedAquireTimes.length - 1]; if (overlayMode) { - maxX /= sessionTimeZeroIndices.size(); + maxX = timeToNextTimeZero;// + 20;//(maxX / sessionTimeZeroIndices.size()) + timeZeroRelativeIndex * 2.0; } // double xMarginStretch = TicGeneratorForAxes.generateMarginAdjustment(minX, maxX, 0.05); diff --git a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionSerialContainer.java b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionSerialContainer.java index b53aa521..42138121 100644 --- a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionSerialContainer.java +++ b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/RawDataSessionSerialContainer.java @@ -15,8 +15,19 @@ */ package org.earthtime.Tripoli.dataViews.rawDataReviews; +import java.awt.Color; +import java.awt.Component; import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; +import javax.swing.AbstractButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; import org.earthtime.Tripoli.dataModels.DataModelInterface; +import org.earthtime.Tripoli.dataModels.RawIntensityDataModel; import org.earthtime.Tripoli.dataViews.AbstractRawDataView; /** @@ -25,6 +36,30 @@ */ public class RawDataSessionSerialContainer extends AbstractRawDataView { + private List rawIntensitiesDataSerialViews; + private AbstractRawDataView firstRawIntensitiesDataSerialView; + List sessionTimeZeroIndices; + private int timeZeroRelativeIndex; + private int peakLeftShade; + private int peakWidth; + private int backgroundRightShade; + private int backgroundWidth; + private transient boolean initialized; + private JLabel[] fractionNameLabels; + private String[] fractionNames; + private JCheckBox[] fractionIgnores; + + /** + * + * @param bounds the value of bounds + * @param fractionNames the value of fractionNames + */ + public RawDataSessionSerialContainer(Rectangle bounds, String[] fractionNames) { + super(bounds); + initialized = false; + this.fractionNames = fractionNames; + } + /** * * @param g2d @@ -32,11 +67,143 @@ public class RawDataSessionSerialContainer extends AbstractRawDataView { @Override public void paint(Graphics2D g2d) { super.paint(g2d); + +// g2d.setPaint(new Color(235, 255, 255)); +// g2d.setStroke(new BasicStroke(1.f)); +// +// for (int i = 0; i < sessionTimeZeroIndices.size(); i++) { +// Rectangle2D fractionZOne = new Rectangle2D.Double(// +// mapX(myOnPeakNormalizedAquireTimes[sessionTimeZeroIndices.get(i)] - backgroundRightShade - backgroundWidth), // +// 0,// +// mapX(backgroundRightShade + backgroundWidth + peakLeftShade + peakWidth),// +// 25); +// +// g2d.fill(fractionZOne); +// } + } + + public void initPanel() { + setDisplayOffsetY(0.0); + setDisplayOffsetX(0.0); + + //get a handle on serial view models + rawIntensitiesDataSerialViews = new ArrayList<>(); + Component[] components = getComponents(); + for (int i = 0; i < components.length; i++) { + if (components[i] instanceof RawDataSessionPlot) { + rawIntensitiesDataSerialViews.add(((AbstractRawDataView) components[i])); + } + } + + firstRawIntensitiesDataSerialView = rawIntensitiesDataSerialViews.get(0); + sessionTimeZeroIndices = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getSessionTimeZeroIndices(); + myOnPeakNormalizedAquireTimes = firstRawIntensitiesDataSerialView.getDataModel().getNormalizedOnPeakAquireTimes(); + peakLeftShade = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getPeakLeftShade(); + peakWidth = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getPeakWidth(); + backgroundRightShade = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getBackgroundRightShade(); + backgroundWidth = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getBackgroundWidth(); + timeZeroRelativeIndex = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getTimeZeroRelativeIndex(); + + minX = firstRawIntensitiesDataSerialView.getMinX(); + maxX = firstRawIntensitiesDataSerialView.getMaxX(); + minY = firstRawIntensitiesDataSerialView.getMinY(); + maxY = firstRawIntensitiesDataSerialView.getMaxY(); + + fractionNameLabels = new JLabel[sessionTimeZeroIndices.size()]; + for (int i = 0; i < sessionTimeZeroIndices.size(); i++) { + fractionNameLabels[i] = new JLabel(); + fractionNameLabels[i].setBounds(// + (int) mapX(myOnPeakNormalizedAquireTimes[sessionTimeZeroIndices.get(i) - backgroundWidth - backgroundRightShade]),// + 1, (int) mapX(backgroundWidth + backgroundRightShade + peakLeftShade + peakWidth), 20); + fractionNameLabels[i].setHorizontalAlignment(JLabel.CENTER); + fractionNameLabels[i].setOpaque(true); + fractionNameLabels[i].setBackground(new Color(235, 255, 255)); + fractionNameLabels[i].setBorder(javax.swing.BorderFactory.createLineBorder(Color.black)); + add(fractionNameLabels[i], DEFAULT_LAYER); + } + + renameFractions(); + + fractionIgnores = new JCheckBox[sessionTimeZeroIndices.size()]; + for (int i = 0; i < sessionTimeZeroIndices.size(); i++) { + fractionIgnores[i] = new JCheckBox("Ignore"); + fractionIgnores[i].setBounds(// + (int) mapX(myOnPeakNormalizedAquireTimes[sessionTimeZeroIndices.get(i) - backgroundWidth - backgroundRightShade]),// + (int) mapY(minY) - 25, (int) mapX(backgroundWidth + backgroundRightShade + peakLeftShade + peakWidth), 20); + fractionIgnores[i].setHorizontalAlignment(JLabel.CENTER); + fractionIgnores[i].setOpaque(true); + fractionIgnores[i].setBackground(new Color(235, 255, 255)); + fractionIgnores[i].setBorder(javax.swing.BorderFactory.createLineBorder(Color.black)); + fractionIgnores[i].addItemListener(new fractionIgnoresListener(i)); + add(fractionIgnores[i], DEFAULT_LAYER); + } + + initialized = true; } + private void renameFractions() { + int countIgnored = 0; + for (int i = 0; i < sessionTimeZeroIndices.size(); i++) { + if (sessionTimeZeroIndices.get(i) < 0) { + countIgnored++; + fractionNameLabels[i].setText("X " + i); + } else { + if ((i - countIgnored) < fractionNames.length) { + fractionNameLabels[i].setText(fractionNames[i - countIgnored]); + } else { + fractionNameLabels[i].setText("none " + i); + } + } + } + } + + private class fractionIgnoresListener implements ItemListener { + + private int i; + + public fractionIgnoresListener(int i) { + this.i = i; + } + + @Override + public void itemStateChanged(ItemEvent e) { + sessionTimeZeroIndices.set(i, Math.abs(sessionTimeZeroIndices.get(i)) * (int) (((AbstractButton) e.getSource()).isSelected() ? -1 : 1)); + renameFractions(); + repaint(); + } + + } + + /** + * + * @param doReScale the value of doReScale + * @param inLiveMode the value of inLiveMode + */ @Override public void preparePanel(boolean doReScale, boolean inLiveMode) { + if (!initialized) { + initPanel(); + } + + peakLeftShade = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getPeakLeftShade(); + peakWidth = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getPeakWidth(); + backgroundRightShade = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getBackgroundRightShade(); + backgroundWidth = ((RawIntensityDataModel) firstRawIntensitiesDataSerialView.getDataModel()).getBackgroundWidth(); + + // relocate fractionLabels and fraction ignores + for (int i = 0; i < fractionNameLabels.length; i++) { + fractionNameLabels[i].setBounds(// + (int) mapX(myOnPeakNormalizedAquireTimes[sessionTimeZeroIndices.get(i) - backgroundWidth - backgroundRightShade]),// + 1, (int) mapX(backgroundWidth + backgroundRightShade + peakLeftShade + peakWidth), 20); + fractionNameLabels[i].revalidate(); + + fractionIgnores[i].setBounds(// + (int) mapX(myOnPeakNormalizedAquireTimes[sessionTimeZeroIndices.get(i) - backgroundWidth - backgroundRightShade]),// + (int) mapY(minY) - 25, (int) mapX(backgroundWidth + backgroundRightShade + peakLeftShade + peakWidth), 20); + fractionIgnores[i].revalidate(); + } + } @Override diff --git a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/TimeResolvedAnalysisDataView.form b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/TimeResolvedAnalysisDataView.form index 24bc0510..a5cd2a9a 100644 --- a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/TimeResolvedAnalysisDataView.form +++ b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/TimeResolvedAnalysisDataView.form @@ -3,11 +3,12 @@
+ - + - + diff --git a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/TimeResolvedAnalysisDataView.java b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/TimeResolvedAnalysisDataView.java index 0e48391f..951f8ea4 100644 --- a/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/TimeResolvedAnalysisDataView.java +++ b/src/main/java/org/earthtime/Tripoli/dataViews/rawDataReviews/TimeResolvedAnalysisDataView.java @@ -33,13 +33,13 @@ */ public class TimeResolvedAnalysisDataView extends DialogEditor { - private static int SESSION_VIEW_WIDTH = 25000; + private static int SESSION_VIEW_WIDTH; private AbstractRawDataView rawDataSessionSerialContainer; private AbstractRawDataView[] rawDataSessionPlots; + private JLayeredPane placeHolderPane; private AbstractRawDataView rawDataSessionOverlayContainer; private AbstractRawDataView[] rawDataSessionOverlayPlots; private AbstractMassSpecSetup massSpec; - /** * Creates new form TimeResolvedAnalysisDataView @@ -61,17 +61,17 @@ public TimeResolvedAnalysisDataView(java.awt.Frame parent, boolean modal, Abstra rawDataSessionOverlayPlotScrollPane.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE); initSession(); - + // temp hack to remove focus loadData_button.setBackground(Color.white); } private void initSession() { - setSize(1200, 800); - SESSION_VIEW_WIDTH = massSpec.getCountOfAcquisitions(); + setSize(1200, 850); + SESSION_VIEW_WIDTH = massSpec.getCountOfAcquisitions() * 2; - rawDataSessionSerialContainer = new RawDataSessionSerialContainer(); - rawDataSessionSerialContainer.setBounds(0, 0, SESSION_VIEW_WIDTH, rawDataSessionPlotScrollPane.getHeight() - 25); + rawDataSessionSerialContainer = new RawDataSessionSerialContainer(// + new Rectangle(0, 0, SESSION_VIEW_WIDTH, rawDataSessionPlotScrollPane.getHeight() - 25), massSpec.getFractionNames()); // this forces scroll bar rawDataSessionSerialContainer.setPreferredSize(rawDataSessionSerialContainer.getSize()); rawDataSessionSerialContainer.setOpaque(true); @@ -82,32 +82,38 @@ private void initSession() { rawDataSessionPlotScrollPane.revalidate(); // overlay of plots + // need a placeHolderPane + placeHolderPane = new JLayeredPane(); + placeHolderPane.setBounds(0, 0, rawDataSessionOverlayPlotScrollPane.getWidth() - 5, rawDataSessionOverlayPlotScrollPane.getHeight() - 25); + placeHolderPane.setPreferredSize(placeHolderPane.getSize()); + rawDataSessionOverlayPlotScrollPane.setViewportView(placeHolderPane); + rawDataSessionOverlayContainer = new RawDataSessionOverlayContainer(// - new Rectangle(0, 0, rawDataSessionOverlayPlotScrollPane.getWidth(), rawDataSessionOverlayPlotScrollPane.getHeight() - 25),// + new Rectangle(0, 0, placeHolderPane.getWidth() - 25, placeHolderPane.getHeight() - 25),// rawDataSessionSerialContainer); - - rawDataSessionOverlayPlotScrollPane.setViewportView(rawDataSessionOverlayContainer); - rawDataSessionOverlayPlotScrollPane.getHorizontalScrollBar().setUnitIncrement(1000); - rawDataSessionOverlayPlotScrollPane.revalidate(); + rawDataSessionOverlayContainer.setOpaque(true); + rawDataSessionOverlayContainer.setBackground(Color.white); + placeHolderPane.add(rawDataSessionOverlayContainer); Map isotopeToRawIntensitiesMap = massSpec.getIsotopeMappingModel().getIsotopeToRawIntensitiesMap(); rawDataSessionPlots = new AbstractRawDataView[isotopeToRawIntensitiesMap.size()]; rawDataSessionOverlayPlots = new AbstractRawDataView[isotopeToRawIntensitiesMap.size()]; isotopeToRawIntensitiesMap.forEach((isotope, dataModel) -> { int index = massSpec.getVirtualCollectorModelMapToFieldIndexes().get(dataModel); - rawDataSessionPlots[index] = new RawDataSessionPlot(dataModel, new Rectangle(0, index * 110+ 25, SESSION_VIEW_WIDTH, 100), false); + rawDataSessionPlots[index] = new RawDataSessionPlot(dataModel, new Rectangle(0, index * 110 + 25, SESSION_VIEW_WIDTH, 100), false); rawDataSessionSerialContainer.add(rawDataSessionPlots[index], JLayeredPane.DEFAULT_LAYER); rawDataSessionPlots[index].preparePanel(true, false); rawDataSessionPlots[index].repaint(); //overlays - rawDataSessionOverlayPlots[index] = new RawDataSessionPlot(dataModel, new Rectangle(0, index * 110 + 25, rawDataSessionOverlayPlotScrollPane.getWidth(), 100), true); + rawDataSessionOverlayPlots[index] = new RawDataSessionPlot(dataModel, new Rectangle(0, index * 110 + 25, placeHolderPane.getWidth() - 25, 100), true); rawDataSessionOverlayContainer.add(rawDataSessionOverlayPlots[index], JLayeredPane.DEFAULT_LAYER); rawDataSessionOverlayPlots[index].preparePanel(true, false); rawDataSessionOverlayPlots[index].repaint(); }); - rawDataSessionOverlayContainer.preparePanel(true, false); + rawDataSessionSerialContainer.refreshPanel(true, false); + rawDataSessionOverlayContainer.refreshPanel(true, false); } @@ -127,8 +133,9 @@ private void initComponents() { loadData_button = new ET_JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setPreferredSize(new java.awt.Dimension(1200, 800)); - setSize(new java.awt.Dimension(1200, 800)); + setTitle("TRA Raw Data Manager"); + setPreferredSize(new java.awt.Dimension(1200, 850)); + setSize(new java.awt.Dimension(1200, 850)); rawDataSplitPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); rawDataSplitPane.setDividerLocation(300); @@ -182,26 +189,28 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { private void rawDataSessionOverlayPlotScrollPaneComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_rawDataSessionOverlayPlotScrollPaneComponentResized if (rawDataSessionOverlayPlots.length > 0) { - int revisedWidth = rawDataSessionOverlayPlotScrollPane.getWidth() - 25; - rawDataSessionOverlayContainer.setSize(new Dimension(revisedWidth, rawDataSessionOverlayContainer.getHeight())); - rawDataSessionOverlayContainer.setPreferredSize(new Dimension(revisedWidth, rawDataSessionOverlayContainer.getHeight())); - rawDataSessionOverlayContainer.setGraphWidth(revisedWidth); - rawDataSessionOverlayContainer.repaint(); + placeHolderPane.setBounds(0, 0, rawDataSessionOverlayPlotScrollPane.getWidth() - 5, rawDataSessionOverlayPlotScrollPane.getHeight() - 25); + placeHolderPane.setPreferredSize(placeHolderPane.getSize()); + int revisedWidth = placeHolderPane.getWidth() - 25; for (int i = 0; i < rawDataSessionOverlayPlots.length; i++) { rawDataSessionOverlayPlots[i].setSize(new Dimension(revisedWidth, rawDataSessionOverlayPlots[i].getHeight())); - rawDataSessionOverlayPlots[i].setPreferredSize(new Dimension(revisedWidth, rawDataSessionOverlayPlots[i].getHeight())); + rawDataSessionOverlayPlots[i].setPreferredSize(rawDataSessionOverlayPlots[i].getSize()); rawDataSessionOverlayPlots[i].setGraphWidth(revisedWidth); rawDataSessionOverlayPlots[i].repaint(); } - rawDataSessionOverlayContainer.revalidate(); + rawDataSessionOverlayContainer.setSize(new Dimension(revisedWidth, placeHolderPane.getHeight())); + rawDataSessionOverlayContainer.setPreferredSize(rawDataSessionOverlayContainer.getSize()); + rawDataSessionOverlayContainer.setGraphWidth(revisedWidth); + rawDataSessionOverlayContainer.repaint(); + placeHolderPane.revalidate(); } }//GEN-LAST:event_rawDataSessionOverlayPlotScrollPaneComponentResized private void loadData_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadData_buttonActionPerformed - close(); + close(); }//GEN-LAST:event_loadData_buttonActionPerformed diff --git a/src/main/java/org/earthtime/Tripoli/fractions/TripoliFraction.java b/src/main/java/org/earthtime/Tripoli/fractions/TripoliFraction.java index adce954b..6798267c 100644 --- a/src/main/java/org/earthtime/Tripoli/fractions/TripoliFraction.java +++ b/src/main/java/org/earthtime/Tripoli/fractions/TripoliFraction.java @@ -119,17 +119,30 @@ public class TripoliFraction implements // private boolean currentlyFitted; + /** + * + * @param fractionID the value of fractionID + * @param commonLeadCorrectionHighestLevel the value of + * commonLeadCorrectionHighestLevel + * @param isPrimaryReferenceMaterial the value of isPrimaryReferenceMaterial + * @param isSecondaryReferenceMaterial the value of + * isSecondaryReferenceMaterial + * @param backgroundTimeStamp the value of backgroundTimeStamp + * @param peakTimeStamp the value of peakTimeStamp + * @param blockSize the value of blockSize + */ public TripoliFraction( // - String fractionID, // - String commonLeadCorrectionHighestLevel, // - boolean standard, // - long backgroundTimeStamp, // - long peakTimeStamp,// + String fractionID, + String commonLeadCorrectionHighestLevel, + boolean isPrimaryReferenceMaterial, + boolean isSecondaryReferenceMaterial, + long backgroundTimeStamp, + long peakTimeStamp, int blockSize) { this.fractionID = fractionID; - this.standard = standard; - this.secondaryReferenceMaterial = false; + this.standard = isPrimaryReferenceMaterial; + this.secondaryReferenceMaterial = isSecondaryReferenceMaterial; this.backgroundTimeStamp = backgroundTimeStamp; this.peakTimeStamp = peakTimeStamp; this.zeroBasedTimeStamp = 0; @@ -175,7 +188,7 @@ public TripoliFraction( // this.commonLeadCorrectionHighestLevel = commonLeadCorrectionHighestLevel; // default behavior - if (standard) { + if (isPrimaryReferenceMaterial) { this.commonLeadLossCorrectionScheme = CommonLeadLossCorrectionSchemeNONE.getInstance(); } else { try { @@ -220,7 +233,7 @@ public TripoliFraction( // long peakTimeStamp, // SortedSet rawRatios) { - this(fractionID, commonLeadCorrectionHighestLevel, standard, backgroundTimeStamp, peakTimeStamp, ((RawRatioDataModel) rawRatios.first()).getRatios().length); + this(fractionID, commonLeadCorrectionHighestLevel, standard, false, backgroundTimeStamp, peakTimeStamp, ((RawRatioDataModel) rawRatios.first()).getRatios().length); this.rawRatios = rawRatios; diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/AbstractRawDataFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/AbstractRawDataFileHandler.java index 35422950..eff5605c 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/AbstractRawDataFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/AbstractRawDataFileHandler.java @@ -169,7 +169,7 @@ public int hashCode() { * @return the boolean */ public abstract boolean getAndLoadRawIntensityDataForReview(); - + /** * * @param loadDataTask the value of loadDataTask @@ -261,7 +261,8 @@ public int compare(File f1, File f2) { * @param leftShadeCount the value of leftShadeCount * @param ignoreFirstFractions the value of indexgnoreFindexrstFractindexons * @param inLiveMode the value of inLiveMode - * @return the java.util.SortedSet + * @return the + * java.util.SortedSet */ protected abstract SortedSet loadRawDataFile(SwingWorker loadDataTask, boolean usingFullPropagation, int leftShadeCount, int ignoreFirstFractions, boolean inLiveMode); @@ -499,21 +500,24 @@ public ArrayList parseFractionsIntoSamples() { ////// //replace first unknown sample with a standardSample as this is the default primary standard ////// // until / unless user changes on return ////// firstSample = tripoliSamplesSorted.first(); - AbstractTripoliSample primaryStandard = new TripoliPrimaryStandardSample(firstSample.getSampleName()); + AbstractTripoliSample primaryReferenceMaterialSample = new TripoliPrimaryStandardSample(firstSample.getSampleName()); // use these fractions - primaryStandard.setSampleFractions(firstSample.getSampleFractions()); - tripoliSamplesSorted.add(primaryStandard); + primaryReferenceMaterialSample.setSampleFractions(firstSample.getSampleFractions()); + tripoliSamplesSorted.add(primaryReferenceMaterialSample); // convert to ArrayList for storage and passing tripoliSamples.addAll(tripoliSamplesSorted); tripoliSamples.remove(firstSample); -////// // walk samples and set fraction standard flags -////// for (int i = 0; i < tripoliSamples.size(); i++) { -////// tripoliSamples.get(i).setFractionsSampleFlags(); -////// } + // july 2106 + // walk unknown samples and detect secondary reference materials + for (int i = 0; i < tripoliSamples.size(); i++) { + // TODO: refactor Demeter law + tripoliSamples.get(i).setSecondaryReferenceMaterial(tripoliSamples.get(i).getSampleFractions().first().isSecondaryReferenceMaterial()); + } } } + return tripoliSamples; } @@ -549,12 +553,12 @@ private String extractSampleName(String fractionName) { if (index < 0) { index = fractionName.length(); } - + String retVal = fractionName.substring(0, index); - if (retVal.length() == 0){ + if (retVal.length() == 0) { retVal = "Unknowns"; } - + return retVal; } diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Agilent/KoslerAgilent7700FileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Agilent/KoslerAgilent7700FileHandler.java index dcadc54a..e0156cff 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Agilent/KoslerAgilent7700FileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Agilent/KoslerAgilent7700FileHandler.java @@ -247,9 +247,10 @@ protected SortedSet loadRawDataFile(// TripoliFraction tripoliFraction = new TripoliFraction( // + // fractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isStandard, + isStandard, false, fractionBackgroundTimeStamp, // fractionPeakTimeStamp, peakAcquisitions.size()); diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollFaradayFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollFaradayFileHandler.java index 5393b86e..4d46954e 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollFaradayFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollFaradayFileHandler.java @@ -500,9 +500,10 @@ protected SortedSet loadRawDataFile(SwingWorker loadDataTask, b TripoliFraction tripoliFraction = // new TripoliFraction( // + // theFractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isStandard, + isStandard, false, fractionDate.getTime(), // fractionDate.getTime(),// myBlockSize);//, diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollFaradayTRAFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollFaradayTRAFileHandler.java index 11c40f65..36eb3375 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollFaradayTRAFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollFaradayTRAFileHandler.java @@ -440,9 +440,10 @@ protected SortedSet loadRawDataFile(SwingWorker loadDataTask, b // nov 2014 broke into steps to provide cleaner logic TripoliFraction tripoliFraction = new TripoliFraction( // + // theFractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isStandard, + isStandard, false, fractionBackgroundStartTime, // fractionBackgroundStartTime + readCountBackgroundAcquisitions * massSpec.getCOLLECTOR_DATA_FREQUENCY_MILLISECS(), peakAcquisitions.size()); diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollIonCounterFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollIonCounterFileHandler.java index 1a11b3ee..a67ec860 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollIonCounterFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/LaserChronNUPlasmaMultiCollIonCounterFileHandler.java @@ -425,9 +425,10 @@ protected SortedSet loadRawDataFile(SwingWorker loadDataTask, b TripoliFraction tripoliFraction = // new TripoliFraction( // + // theFractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isStandard, + isStandard, false, fractionDate.getTime(), // fractionDate.getTime(),// myBlockSize);//, diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/SantaBarbaraNUPlasmaMultiCollFaradayTRAFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/SantaBarbaraNUPlasmaMultiCollFaradayTRAFileHandler.java index 4dd309cb..f0e631bb 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/SantaBarbaraNUPlasmaMultiCollFaradayTRAFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/NuPlasma/SantaBarbaraNUPlasmaMultiCollFaradayTRAFileHandler.java @@ -183,7 +183,7 @@ public boolean getAndLoadRawIntensityDataForReview() { // detect starts of onpeak NumberFormat format = new DecimalFormat("+#0.00;-#0.00"); List sessionTimeZeroIndices = new ArrayList<>(); - double[] onPeak = ((RawIntensityDataModel) massSpec.getU238()).getOnPeakVirtualCollector().getIntensities(); + double[] onPeak = getSumOfIntensities();//((RawIntensityDataModel) massSpec.getU238()).getOnPeakVirtualCollector().getIntensities(); boolean withinPeak = false; int lastNegativeIndex = 0; for (int i = 0; i < onPeak.length; i++) { @@ -211,13 +211,24 @@ public boolean getAndLoadRawIntensityDataForReview() { } } retVal = true; + + // calculate good right to graph + DescriptiveStatistics timeZeroDeltas = new DescriptiveStatistics(); + for (int i = 0; i < sessionTimeZeroIndices.size() - 1; i++) { + timeZeroDeltas.addValue(Math.abs(sessionTimeZeroIndices.get(i + 1) - sessionTimeZeroIndices.get(i))); + } + int timeToNextTimeZero = (int) timeZeroDeltas.getPercentile(95); + Map isotopeToRawIntensitiesMap = massSpec.getIsotopeMappingModel().getIsotopeToRawIntensitiesMap(); isotopeToRawIntensitiesMap.forEach((isotope, dataModel) -> { ((RawIntensityDataModel) dataModel).setSessionTimeZeroIndices(sessionTimeZeroIndices); + ((RawIntensityDataModel) dataModel).setTimeToNextTimeZero(timeToNextTimeZero); // educated guesses ((RawIntensityDataModel) dataModel).setPeakLeftShade(5); - ((RawIntensityDataModel) dataModel).setPeakWidth(140); - ((RawIntensityDataModel) dataModel).setTimeZeroRelativeIndex(75); + ((RawIntensityDataModel) dataModel).setPeakWidth(timeToNextTimeZero / 2);//140 + ((RawIntensityDataModel) dataModel).setBackgroundRightShade(5); + ((RawIntensityDataModel) dataModel).setBackgroundWidth(timeToNextTimeZero / 8);//25 + ((RawIntensityDataModel) dataModel).setTimeZeroRelativeIndex(timeToNextTimeZero / 4);//75 }); } else { @@ -230,6 +241,19 @@ public boolean getAndLoadRawIntensityDataForReview() { return retVal; } + private double[] getSumOfIntensities() { + double[] sumOfIntensities = new double[((RawIntensityDataModel) massSpec.getU238()).getOnPeakVirtualCollector().getIntensities().length]; + Map isotopeToRawIntensitiesMap = massSpec.getIsotopeMappingModel().getIsotopeToRawIntensitiesMap(); + isotopeToRawIntensitiesMap.forEach((isotope, dataModel) -> { + double[] onPeak = ((RawIntensityDataModel) dataModel).getOnPeakVirtualCollector().getIntensities(); + for (int i = 0; i < sumOfIntensities.length; i++) { + sumOfIntensities[i] += onPeak[i]; + } + }); + + return sumOfIntensities; + } + /** * * @param loadDataTask the value of loadRawDataPropertyChangeListener @@ -327,90 +351,97 @@ protected SortedSet loadRawDataFile(SwingWorker loadDataTask, b int backgroundWidth = ((RawIntensityDataModel) firstModel).getBackgroundWidth(); // walk the zero-time indices - one for each fraction + int countIgnoredFractions = 0; for (int fractionIndex = 0; fractionIndex < sessionTimeZeroIndices.size(); fractionIndex++) { - if (loadDataTask.isCancelled()) { - break; - } - loadDataTask.firePropertyChange("progress", 0, ((100 * fractionIndex) / sessionTimeZeroIndices.size())); + // test for ignored + if (sessionTimeZeroIndices.get(fractionIndex) > 0) { + if (loadDataTask.isCancelled()) { + break; + } + loadDataTask.firePropertyChange("progress", 0, ((100 * fractionIndex) / sessionTimeZeroIndices.size())); - // background - List backgroundAcquisitions = new ArrayList<>(); + // background + List backgroundAcquisitions = new ArrayList<>(); - int startOfBackgroundIndex = sessionTimeZeroIndices.get(fractionIndex) - backgroundRightShade - backgroundWidth; - for (int acquisitionIndex = startOfBackgroundIndex; acquisitionIndex < sessionTimeZeroIndices.get(fractionIndex); acquisitionIndex++) { - // 238 232 208 207 206 204 - double[] backgroundIntensities = new double[6]; - backgroundAcquisitions.add(backgroundIntensities); + int startOfBackgroundIndex = sessionTimeZeroIndices.get(fractionIndex) - backgroundRightShade - backgroundWidth; + for (int acquisitionIndex = startOfBackgroundIndex; acquisitionIndex < sessionTimeZeroIndices.get(fractionIndex); acquisitionIndex++) { + // 238 232 208 207 206 204 + double[] backgroundIntensities = new double[6]; + backgroundAcquisitions.add(backgroundIntensities); - String[] acquisition = fractionData.get(dataFoundIndex + acquisitionIndex).split(","); - for (int index = 0; index < 6; index++) { - backgroundIntensities[index] = Double.parseDouble(acquisition[index]); + String[] acquisition = fractionData.get(dataFoundIndex + acquisitionIndex).split(","); + for (int index = 0; index < 6; index++) { + backgroundIntensities[index] = Double.parseDouble(acquisition[index]); + } } - } - // peak - List peakAcquisitions = new ArrayList<>(); + // peak + List peakAcquisitions = new ArrayList<>(); - int endOfPeakIndex = sessionTimeZeroIndices.get(fractionIndex) + peakLeftShade + peakWidth; - for (int acquisitionIndex = sessionTimeZeroIndices.get(fractionIndex); acquisitionIndex < endOfPeakIndex; acquisitionIndex++) { - // 238 232 208 207 206 204 - double[] peakIntensities = new double[6]; - peakAcquisitions.add(peakIntensities); + int endOfPeakIndex = sessionTimeZeroIndices.get(fractionIndex) + peakLeftShade + peakWidth; + for (int acquisitionIndex = sessionTimeZeroIndices.get(fractionIndex); acquisitionIndex < endOfPeakIndex; acquisitionIndex++) { + // 238 232 208 207 206 204 + double[] peakIntensities = new double[6]; + peakAcquisitions.add(peakIntensities); - String[] acquisition = fractionData.get(dataFoundIndex + acquisitionIndex).split(","); - for (int index = 0; index < 6; index++) { - peakIntensities[index] = Double.parseDouble(acquisition[index]); + String[] acquisition = fractionData.get(dataFoundIndex + acquisitionIndex).split(","); + for (int index = 0; index < 6; index++) { + peakIntensities[index] = Double.parseDouble(acquisition[index]); + } } - } - // specify fraction and turn off data points at ends - // calculate dates - String fractionID = fractionNames[fractionIndex]; - boolean isReferenceMaterial = (fractionID.toLowerCase().contains(referenceMaterialfractionID)); - if (referenceMaterialIncrementerMap.containsKey(fractionID)) { - int refMatIndex = referenceMaterialIncrementerMap.get(fractionID); - referenceMaterialIncrementerMap.put(fractionID, refMatIndex + 1); - fractionID = fractionID + "-" + String.valueOf(refMatIndex); - } + // specify fraction and turn off data points at ends + // calculate dates + String fractionID = fractionNames[fractionIndex - countIgnoredFractions]; + boolean isReferenceMaterial = (fractionID.toLowerCase().contains(referenceMaterialfractionID)); + if (referenceMaterialIncrementerMap.containsKey(fractionID)) { + int refMatIndex = referenceMaterialIncrementerMap.get(fractionID); + referenceMaterialIncrementerMap.put(fractionID, refMatIndex + 1); + fractionID = fractionID + "-" + String.valueOf(refMatIndex); + } - // peak stamp = timezero - long fractionPeakTimeStamp = runStartTime + 200l * sessionTimeZeroIndices.get(fractionIndex); - long fractionBackgroundTimeStamp = fractionPeakTimeStamp - 200l * (backgroundRightShade + backgroundWidth); + // peak stamp = timezero + long fractionPeakTimeStamp = runStartTime + 200l * sessionTimeZeroIndices.get(fractionIndex); + long fractionBackgroundTimeStamp = fractionPeakTimeStamp - 200l * (backgroundRightShade + backgroundWidth); - TripoliFraction tripoliFraction - = new TripoliFraction( // - fractionID, // - massSpec.getCommonLeadCorrectionHighestLevel(), // - isReferenceMaterial, - fractionBackgroundTimeStamp, // - fractionPeakTimeStamp, - peakAcquisitions.size()); + TripoliFraction tripoliFraction + = new TripoliFraction( // + // + fractionID, // + massSpec.getCommonLeadCorrectionHighestLevel(), // + isReferenceMaterial, false, + fractionBackgroundTimeStamp, // + fractionPeakTimeStamp, + peakAcquisitions.size()); - SortedSet rawRatios = massSpec.rawRatiosFactoryRevised(); + SortedSet rawRatios = massSpec.rawRatiosFactoryRevised(); - tripoliFraction.setRawRatios(rawRatios); + tripoliFraction.setRawRatios(rawRatios); - massSpec.setCountOfAcquisitions(peakAcquisitions.size()); + massSpec.setCountOfAcquisitions(peakAcquisitions.size()); - massSpec.processFractionRawRatiosII(// - backgroundAcquisitions, peakAcquisitions, usingFullPropagation, tripoliFraction, inLiveMode); + massSpec.processFractionRawRatiosII(// + backgroundAcquisitions, peakAcquisitions, usingFullPropagation, tripoliFraction, inLiveMode); - tripoliFraction.shadeDataActiveMapLeft(0); + tripoliFraction.shadeDataActiveMapLeft(0); - // turn off data point between time-zero and end background, start peak - for (int offDataIndex = 0; offDataIndex < peakLeftShade; offDataIndex++) { - tripoliFraction.toggleOneDataAquisition(offDataIndex, false); - } - // don't have system for background yet + // turn off data point between time-zero and end background, start peak + for (int offDataIndex = 0; offDataIndex < peakLeftShade; offDataIndex++) { + tripoliFraction.toggleOneDataAquisition(offDataIndex, false); + } + // don't have system for background yet - System.out.println("\n**** Element II FractionID " + fractionID + " refMat? " + isReferenceMaterial + " livemode = " + inLiveMode + " <<<<<<<<<<<<<<<<<<\n"); + System.out.println("\n**** Element II FractionID " + fractionID + " refMat? " + isReferenceMaterial + " livemode = " + inLiveMode + " <<<<<<<<<<<<<<<<<<\n"); - myTripoliFractions.add(tripoliFraction); + myTripoliFractions.add(tripoliFraction); - if (isReferenceMaterial) { - loadDataTask.firePropertyChange("refMaterialLoaded", 0, 1); - } + if (isReferenceMaterial) { + loadDataTask.firePropertyChange("refMaterialLoaded", 0, 1); + } + } else { + countIgnoredFractions++; + } } return myTripoliFractions; diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/LaserchronElementIIFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/LaserchronElementIIFileHandler.java index 6a1457bf..888d969f 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/LaserchronElementIIFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/LaserchronElementIIFileHandler.java @@ -57,6 +57,19 @@ public class LaserchronElementIIFileHandler extends AbstractRawDataFileHandler { private File[] analysisFiles; private String[] fractionNames; + // temp for july 2016 from Noah McLean eamil July 29 2016 + /* + Thanks. For the purposes of this comparison for George's C40 dataset from Dan, + can you please change the Arizona Laserchron Element2 parsing code? + There should be 73 integrations in each analysis. If the first integration + is indexed 1, use integrations 3-15 for the baseline and 20-54 for the on-peak. + Everything else can get rejected + */ + private static final int hardwiredStartOfBackground = 3-1; + private static final int hardwiredEndOfBackground = 15-1; + private static final int hardwiredStartOfPeak = 20-1; + private static final int hardwiredEndOfPeak = 54-1; + /** * * @param massSpec @@ -124,7 +137,7 @@ public void getAndLoadRawIntensityDataFile(SwingWorker loadDataTask, boolean usi if (analysisFiles.length > 0) { Arrays.sort(analysisFiles, new FractionFileModifiedComparator()); - + String onPeakFileContents = URIHelper.getTextFromURI(analysisFiles[0].getAbsolutePath()).substring(0, 32); if (isValidRawDataFileType(analysisFiles[0]) // && // @@ -202,7 +215,8 @@ public boolean isStandardFractionID(String fractionID * @param leftShadeCount the value of leftShadeCount * @param ignoreFirstFractions the value of ignoreFirstFractions * @param inLiveMode the value of inLiveMode - * @return the java.util.SortedSet + * @return the + * java.util.SortedSet */ @Override protected SortedSet loadRawDataFile(// @@ -212,7 +226,7 @@ protected SortedSet loadRawDataFile(// // assume we are golden // take first entry in fractionNames that came from scancsv file and confirm it is referenceMaterial (standard) - String referenceMaterialfractionID = fractionNames[0]; + String primaryReferenceMaterialfractionID = fractionNames[0]; // todo: need to confirm it is the standard - maybe do this at parameter manager for (int f = ignoreFirstFractions; f < analysisFiles.length; f++) { @@ -230,16 +244,16 @@ protected SortedSet loadRawDataFile(// } // needs to be more robust - boolean isReferenceMaterial = (fractionID.substring(0, 2).compareToIgnoreCase(referenceMaterialfractionID.substring(0, 2)) == 0); - // number the reference materials -// if (isReferenceMaterial) { -// fractionID = fractionID + "-" + String.valueOf(referenceMaterialIncrementer); -// referenceMaterialIncrementer++; -// } + boolean isPrimaryReferenceMaterial = (fractionID.substring(0, 2).compareToIgnoreCase(primaryReferenceMaterialfractionID.substring(0, 2)) == 0); + boolean isSecondaryReferenceMaterial = false; + + // number the reference material if (referenceMaterialIncrementerMap.containsKey(fractionID)) { int refMatIndex = referenceMaterialIncrementerMap.get(fractionID); referenceMaterialIncrementerMap.put(fractionID, refMatIndex + 1); fractionID = fractionID + "-" + String.valueOf(refMatIndex); + + isSecondaryReferenceMaterial = !isPrimaryReferenceMaterial; } // ************************************************************************************************ @@ -259,7 +273,6 @@ protected SortedSet loadRawDataFile(// List backgroundAcquisitions = new ArrayList<>(); List peakAcquisitions = new ArrayList<>(); - int hardwiredEndOfBackground = 24; // process time stamp from first scan as time stamp of file and background long fractionBackgroundTimeStamp = calculateTimeStamp(extractedData[0][1]); // process time stamp of first peak reading @@ -267,19 +280,20 @@ protected SortedSet loadRawDataFile(// for (int i = rawDataFileTemplate.getBlockStartOffset(); i < rawDataFileTemplate.getBlockSize(); i++) { if (rawDataFileTemplate instanceof LaserchronElementII_RawDataTemplate_A) { - processIntensities_A(i, hardwiredEndOfBackground, backgroundAcquisitions, peakAcquisitions, extractedData[i]); + processIntensities_A(i, backgroundAcquisitions, peakAcquisitions, extractedData[i]); } else if (rawDataFileTemplate instanceof LaserchronElementII_RawDataTemplate_B) { - processIntensities_B(i, hardwiredEndOfBackground, backgroundAcquisitions, peakAcquisitions, extractedData[i]); + processIntensities_B(i, backgroundAcquisitions, peakAcquisitions, extractedData[i]); } else if (rawDataFileTemplate instanceof LaserchronElementII_RawDataTemplate_C) { - processIntensities_C(i, hardwiredEndOfBackground, backgroundAcquisitions, peakAcquisitions, extractedData[i]); + processIntensities_C(i, backgroundAcquisitions, peakAcquisitions, extractedData[i]); } } // i loop TripoliFraction tripoliFraction - = new TripoliFraction( // + = new TripoliFraction( fractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isReferenceMaterial, + isPrimaryReferenceMaterial, + isSecondaryReferenceMaterial, fractionBackgroundTimeStamp, // fractionPeakTimeStamp, peakAcquisitions.size()); @@ -294,11 +308,11 @@ protected SortedSet loadRawDataFile(// backgroundAcquisitions, peakAcquisitions, usingFullPropagation, tripoliFraction, inLiveMode); tripoliFraction.shadeDataActiveMapLeft(leftShadeCount); - System.out.println("\n**** Element II FractionID " + fractionID + " refMat? " + isReferenceMaterial + " livemode = " + inLiveMode + " <<<<<<<<<<<<<<<<<<\n"); + System.out.println("\n**** Element II FractionID " + fractionID + " refMat? " + isPrimaryReferenceMaterial + " livemode = " + inLiveMode + " <<<<<<<<<<<<<<<<<<\n"); myTripoliFractions.add(tripoliFraction); - - if (isReferenceMaterial){ + + if (isPrimaryReferenceMaterial) { loadDataTask.firePropertyChange("refMaterialLoaded", 0, 1); } @@ -310,11 +324,25 @@ protected SortedSet loadRawDataFile(// return myTripoliFractions; } - private void processIntensities_A(int i, int hardwiredEndOfBackground, List backgroundAcquisitions, List peakAcquisitions, String[] extractedData) { + private boolean legalBackgroundIndex(int i){ + return ((i >= hardwiredStartOfBackground) && (i <= hardwiredEndOfBackground)); + } + private boolean legalPeakIndex(int i){ + return ((i >= hardwiredStartOfPeak) && (i <= hardwiredEndOfPeak)); + } + + /** + * + * @param i the value of i + * @param backgroundAcquisitions the value of backgroundAcquisitions + * @param peakAcquisitions the value of peakAcquisitions + * @param extractedData the value of extractedData + */ + private void processIntensities_A(int i, List backgroundAcquisitions, List peakAcquisitions, String[] extractedData) { // 202 204 206 Pb207 Pb208 Th232 U238 double[] backgroundIntensities = new double[7]; double[] peakIntensities = new double[7]; - if (i < hardwiredEndOfBackground) { + if (legalBackgroundIndex(i)) { backgroundAcquisitions.add(backgroundIntensities); backgroundIntensities[0] = calcAvgPulseOrAnalog(3, 6, extractedData); backgroundIntensities[1] = calcAvgPulseOrAnalog(8, 11, extractedData); @@ -323,7 +351,7 @@ private void processIntensities_A(int i, int hardwiredEndOfBackground, List= (hardwiredEndOfBackground)) { + } else if (legalPeakIndex(i)) { peakAcquisitions.add(peakIntensities); peakIntensities[0] = calcAvgPulseOrAnalog(3, 6, extractedData); peakIntensities[1] = calcAvgPulseOrAnalog(8, 11, extractedData); @@ -340,11 +368,18 @@ private void processIntensities_A(int i, int hardwiredEndOfBackground, List backgroundAcquisitions, List peakAcquisitions, String[] extractedData) { + /** + * + * @param i the value of i + * @param backgroundAcquisitions the value of backgroundAcquisitions + * @param peakAcquisitions the value of peakAcquisitions + * @param extractedData the value of extractedData + */ + private void processIntensities_B(int i, List backgroundAcquisitions, List peakAcquisitions, String[] extractedData) { // 202 204 206 Pb207 Pb208 Th232 U235 U238 double[] backgroundIntensities = new double[8]; double[] peakIntensities = new double[8]; - if (i < hardwiredEndOfBackground) { + if (legalBackgroundIndex(i)) { backgroundAcquisitions.add(backgroundIntensities); backgroundIntensities[0] = calcAvgPulseOrAnalog(3, 6, extractedData); backgroundIntensities[1] = calcAvgPulseOrAnalog(12, 15, extractedData); @@ -354,7 +389,7 @@ private void processIntensities_B(int i, int hardwiredEndOfBackground, List= (hardwiredEndOfBackground)) { + } else if (legalPeakIndex(i)) { peakAcquisitions.add(peakIntensities); peakIntensities[0] = calcAvgPulseOrAnalog(3, 6, extractedData); peakIntensities[1] = calcAvgPulseOrAnalog(12, 15, extractedData); @@ -384,11 +419,18 @@ private void processIntensities_B(int i, int hardwiredEndOfBackground, List backgroundAcquisitions, List peakAcquisitions, String[] extractedData) { + /** + * + * @param i the value of i + * @param backgroundAcquisitions the value of backgroundAcquisitions + * @param peakAcquisitions the value of peakAcquisitions + * @param extractedData the value of extractedData + */ + private void processIntensities_C(int i, List backgroundAcquisitions, List peakAcquisitions, String[] extractedData) { // 176 202 204 206 Pb207 Pb208 Th232 U235 U238 double[] backgroundIntensities = new double[9]; double[] peakIntensities = new double[9]; - if (i < hardwiredEndOfBackground) { + if (legalBackgroundIndex(i)) { backgroundAcquisitions.add(backgroundIntensities); backgroundIntensities[0] = calcAvgPulseOrAnalog(3, 6, extractedData); backgroundIntensities[1] = calcAvgPulseOrAnalog(12, 15, extractedData); @@ -399,7 +441,7 @@ private void processIntensities_C(int i, int hardwiredEndOfBackground, List= (hardwiredEndOfBackground)) { + } else if (legalPeakIndex(i)) { peakAcquisitions.add(peakIntensities); peakIntensities[0] = calcAvgPulseOrAnalog(3, 6, extractedData); peakIntensities[1] = calcAvgPulseOrAnalog(12, 15, extractedData); diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/MemUnivNewfoundlandElementIIFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/MemUnivNewfoundlandElementIIFileHandler.java index 67ae984e..6baa9f5a 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/MemUnivNewfoundlandElementIIFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/MemUnivNewfoundlandElementIIFileHandler.java @@ -247,9 +247,10 @@ protected SortedSet loadRawDataFile(// TripoliFraction tripoliFraction = // new TripoliFraction( // + // fractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isStandard, + isStandard, false, fractionBackgroundTimeStamp, // fractionPeakTimeStamp, peakAcquisitions.size()); diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/TexasAMElementIISingleCollFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/TexasAMElementIISingleCollFileHandler.java index b95ffef5..6f1aac65 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/TexasAMElementIISingleCollFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/TexasAMElementIISingleCollFileHandler.java @@ -226,9 +226,10 @@ protected SortedSet loadRawDataFile(SwingWorker loadDataTask, b TripoliFraction tripoliFraction = new TripoliFraction( // + // fractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isReferenceMaterial, + isReferenceMaterial, false, fractionBackgroundTimeStamp, // fractionPeakTimeStamp, peakAcquisitions.size()); diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/UnivKansasElementIIFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/UnivKansasElementIIFileHandler.java index 5533d25d..69384de1 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/UnivKansasElementIIFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/UnivKansasElementIIFileHandler.java @@ -271,9 +271,10 @@ protected SortedSet loadRawDataFile(// TripoliFraction tripoliFraction = // new TripoliFraction( // + // fractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isReferenceMaterial, + isReferenceMaterial, false, fractionBackgroundTimeStamp, // fractionPeakTimeStamp, peakAcquisitions.size()); diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/WashStateElementIISingleCollFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/WashStateElementIISingleCollFileHandler.java index 544ec19f..26009f2a 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/WashStateElementIISingleCollFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/Thermo/WashStateElementIISingleCollFileHandler.java @@ -268,9 +268,10 @@ protected SortedSet loadRawDataFile(SwingWorker loadDataTask, b TripoliFraction tripoliFraction = new TripoliFraction( // + // fractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isStandard, + isStandard, false, fractionBackgroundTimeStamp, // fractionPeakTimeStamp, peakAcquisitions.size()); diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/shrimp/ShrimpFileHandler.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/shrimp/ShrimpFileHandler.java index 687f25d8..604a55e9 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/shrimp/ShrimpFileHandler.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/handlers/shrimp/ShrimpFileHandler.java @@ -27,6 +27,7 @@ import javax.swing.JOptionPane; import javax.swing.SwingWorker; import javax.xml.bind.JAXBException; +import org.cirdles.calamari.core.PrawnFileHandler; import org.earthtime.Tripoli.dataModels.DataModelInterface; import org.earthtime.Tripoli.fractions.TripoliFraction; import org.earthtime.Tripoli.massSpecSetups.singleCollector.shrimp.ShrimpSetupUPb; @@ -157,8 +158,9 @@ protected SortedSet loadRawDataFile(// try { List myShrimpFractions = null; -// myShrimpFractions = org.cirdles.calamari.core.RawDataFileHandler.extractShrimpFractionsFromPrawnFile("/Users/sbowring/Google Drive/_ETRedux_ProjectData/SHRIMP/100142_G6147_10111109.43.xml"); - myShrimpFractions = org.cirdles.calamari.core.RawDataFileHandler.extractShrimpFractionsFromPrawnFile(// + + PrawnFileHandler prawnFileHandler = new org.cirdles.calamari.core.PrawnFileHandler(); + myShrimpFractions = prawnFileHandler.extractShrimpFractionsFromPrawnFile(// "https://raw.githubusercontent.com/bowring/XSD/master/SHRIMP/EXAMPLE_100142_G6147_10111109.43_10.33.37%20AM.xml", true, false); // send name to project @@ -243,9 +245,10 @@ private TripoliFraction processRunFraction(org.cirdles.calamari.shrimp.ShrimpFra TripoliFraction tripoliFraction = new TripoliFraction( // + // fractionID, // massSpec.getCommonLeadCorrectionHighestLevel(), // - isReferenceMaterial, + isReferenceMaterial, false, fractionPeakTimeStamp, // fractionPeakTimeStamp, peakAcquisitions.size()); diff --git a/src/main/java/org/earthtime/Tripoli/rawDataFiles/templates/NuPlasma/SantaBarbaraNUPlasmaMultiCollFaradayTRARawDataTemplate.java b/src/main/java/org/earthtime/Tripoli/rawDataFiles/templates/NuPlasma/SantaBarbaraNUPlasmaMultiCollFaradayTRARawDataTemplate.java index b052fb5e..e2a3dd47 100644 --- a/src/main/java/org/earthtime/Tripoli/rawDataFiles/templates/NuPlasma/SantaBarbaraNUPlasmaMultiCollFaradayTRARawDataTemplate.java +++ b/src/main/java/org/earthtime/Tripoli/rawDataFiles/templates/NuPlasma/SantaBarbaraNUPlasmaMultiCollFaradayTRARawDataTemplate.java @@ -50,7 +50,7 @@ private SantaBarbaraNUPlasmaMultiCollFaradayTRARawDataTemplate() { this.blockStartOffset = 0; // not used this.blockSize = 0;// determined from data values; not constant this.standardIDs = new String[]// - {"MZ_44069", "44069", "stern", "manangotry"}; + {"MZ_44069", "44069", "stern", "manangotry", "91500", "gj"}; this.timeZone = TimeZone.getTimeZone("PST"); this.defaultParsingOfFractionsBehavior = 1; this.massSpecSetup = CottlesNUPlasmaSetupUPbFarTRA.getInstance(); diff --git a/src/main/java/org/earthtime/Tripoli/samples/AbstractTripoliSample.java b/src/main/java/org/earthtime/Tripoli/samples/AbstractTripoliSample.java index 7f6ade41..f0d109da 100644 --- a/src/main/java/org/earthtime/Tripoli/samples/AbstractTripoliSample.java +++ b/src/main/java/org/earthtime/Tripoli/samples/AbstractTripoliSample.java @@ -214,14 +214,14 @@ public void setSampleName(String sampleName) { /** * @return the primaryStandard */ - public boolean isPrimaryStandard() { + public boolean isPrimaryReferenceMaterial() { return primaryStandard; } /** * @param primaryStandard the primaryStandard to set */ - public void setPrimaryStandard(boolean primaryStandard) { + public void setPrimaryReferenceMaterial(boolean primaryStandard) { this.primaryStandard = primaryStandard; } @@ -243,14 +243,14 @@ public void setSampleFractions(SortedSet sampleFractions) { /** * @return the secondaryStandard */ - public boolean isSecondaryStandard() { + public boolean isSecondaryReferenceMaterial() { return secondaryStandard; } /** * @param secondaryStandard the secondaryStandard to set */ - public void setSecondaryStandard(boolean secondaryStandard) { + public void setSecondaryReferenceMaterial(boolean secondaryStandard) { this.secondaryStandard = secondaryStandard; } diff --git a/src/main/java/org/earthtime/Tripoli/sessions/TripoliSession.java b/src/main/java/org/earthtime/Tripoli/sessions/TripoliSession.java index 2b3ea773..7967594f 100644 --- a/src/main/java/org/earthtime/Tripoli/sessions/TripoliSession.java +++ b/src/main/java/org/earthtime/Tripoli/sessions/TripoliSession.java @@ -171,11 +171,11 @@ public void updateFractionsToSampleMembership() { tripoliSamples.stream().forEach((tripoliSample) -> { SortedSet tripoliFractionsOfSample = tripoliSample.getSampleFractions(); for (TripoliFraction tf : tripoliFractionsOfSample) { - tf.setStandard(tripoliSample.isPrimaryStandard()); + tf.setStandard(tripoliSample.isPrimaryReferenceMaterial()); // nov 2014 tf.setSampleR238_235s(tripoliSample.getSampleR238_235s()); // april 2016 - tf.setSecondaryReferenceMaterial(tripoliSample.isSecondaryStandard()); + tf.setSecondaryReferenceMaterial(tripoliSample.isSecondaryReferenceMaterial()); } }); } diff --git a/src/main/java/org/earthtime/UPb_Redux/dateInterpretation/concordia/ConcordiaGraphPanel.java b/src/main/java/org/earthtime/UPb_Redux/dateInterpretation/concordia/ConcordiaGraphPanel.java index 73854d3b..a034e43b 100644 --- a/src/main/java/org/earthtime/UPb_Redux/dateInterpretation/concordia/ConcordiaGraphPanel.java +++ b/src/main/java/org/earthtime/UPb_Redux/dateInterpretation/concordia/ConcordiaGraphPanel.java @@ -2454,7 +2454,7 @@ public void mouseReleased(MouseEvent evt) { if (changingBestDateDivider) { ((AliquotForUPbInterface) curAliquot).setBestAgeDivider206_238(new BigDecimal(currentBestDate)); ((UPbReduxAliquot) curAliquot).updateBestAge(); - reportUpdater.updateReportTable(false, false); + reportUpdater.updateReportTable(false, false, ""); } } diff --git a/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/AbstractProjectManagerForRawData.java b/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/AbstractProjectManagerForRawData.java index dc9e687d..e69d5f8b 100644 --- a/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/AbstractProjectManagerForRawData.java +++ b/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/AbstractProjectManagerForRawData.java @@ -461,7 +461,7 @@ public void reProcessFractionRawRatios(boolean usingFullPropagation) { // jan 2015 moved to calculate sessionfittripoliSession.applyCorrections(); try { - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } catch (Exception e) { } diff --git a/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/ProjectManagerFor_LAICPMS_FromRawData.java b/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/ProjectManagerFor_LAICPMS_FromRawData.java index 5d62a37e..f8eb93ba 100644 --- a/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/ProjectManagerFor_LAICPMS_FromRawData.java +++ b/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/ProjectManagerFor_LAICPMS_FromRawData.java @@ -613,7 +613,7 @@ public void reProcessFractionRawRatios(boolean usingFullPropagation) { // jan 2015 moved to calcualte sessionfittripoliSession.applyCorrections(); try { - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } catch (Exception e) { } diff --git a/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/SampleFractionListDisplayPane.java b/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/SampleFractionListDisplayPane.java index 55b26199..54a9c177 100644 --- a/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/SampleFractionListDisplayPane.java +++ b/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/SampleFractionListDisplayPane.java @@ -108,7 +108,7 @@ public SampleFractionListDisplayPane( // this.projectManager = projectManager; - if (tripoliSample.isPrimaryStandard()) { + if (tripoliSample.isPrimaryReferenceMaterial()) { roleChooser = new JComboBox(); ArrayList mineralStandardModels = ReduxLabData.getInstance().getMineralStandardModels(); @@ -146,7 +146,7 @@ public SampleFractionListDisplayPane( // roleChooser = new JComboBox( new String[]{"Unknown", "Secondary RM"}); - if (tripoliSample.isSecondaryStandard()) { + if (tripoliSample.isSecondaryReferenceMaterial()) { roleChooser.setSelectedItem("Secondary RM"); } @@ -189,7 +189,7 @@ public SampleFractionListDisplayPane( // closeButton = new ET_JButton("X"); closeButton.setEnabled(list.getModel().getSize() == 0); closeButton.addActionListener(closeButtonActionListener); - if (!tripoliSample.isPrimaryStandard()) { + if (!tripoliSample.isPrimaryReferenceMaterial()) { this.add(closeButton, DEFAULT_LAYER); } @@ -266,11 +266,11 @@ public void saveChanges() { tripoliSample.setSampleName(sampleName); - if (!tripoliSample.isPrimaryStandard()) { + if (!tripoliSample.isPrimaryReferenceMaterial()) { if (((String) roleChooser.getSelectedItem()).compareToIgnoreCase("Secondary RM") == 0) { - tripoliSample.setSecondaryStandard(true); + tripoliSample.setSecondaryReferenceMaterial(true); } else { - tripoliSample.setSecondaryStandard(false); + tripoliSample.setSecondaryReferenceMaterial(false); } } diff --git a/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/SamplesCommonLeadPane.java b/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/SamplesCommonLeadPane.java index 984d6e60..20d893e1 100644 --- a/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/SamplesCommonLeadPane.java +++ b/src/main/java/org/earthtime/UPb_Redux/dialogs/projectManagers/SamplesCommonLeadPane.java @@ -129,7 +129,7 @@ public SamplesCommonLeadPane(// while (tripoliSamplesIterator.hasNext()) { // april 2014 - leave out primary standards AbstractTripoliSample ts = tripoliSamplesIterator.next(); - if (!ts.isPrimaryStandard()) { + if (!ts.isPrimaryReferenceMaterial()) { listOfSamplesForPbCorrectionModel.addElement(ts); } } diff --git a/src/main/java/org/earthtime/UPb_Redux/dialogs/sessionManagers/SessionAnalysisWorkflowManagerLAICPMS.java b/src/main/java/org/earthtime/UPb_Redux/dialogs/sessionManagers/SessionAnalysisWorkflowManagerLAICPMS.java index 1af0d74e..a0c3e123 100644 --- a/src/main/java/org/earthtime/UPb_Redux/dialogs/sessionManagers/SessionAnalysisWorkflowManagerLAICPMS.java +++ b/src/main/java/org/earthtime/UPb_Redux/dialogs/sessionManagers/SessionAnalysisWorkflowManagerLAICPMS.java @@ -292,7 +292,7 @@ public void adjustmentValueChanged(AdjustmentEvent evt) { tripoliSession.applyCorrections(false); // nov 2015 to update data - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } } // This method is called whenever the selected tab changes ); @@ -556,7 +556,7 @@ private void showSessionViewOfRawDataModels(FractionationTechniquesEnum fraction tripoliSession.calculateSessionFitFunctionsForPrimaryStandard(false); } try { - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } catch (Exception e) { } @@ -619,7 +619,7 @@ public void includeAllFractions() { // jan 2015 // moved to button may 2016 tripoliSession.calculateSessionFitFunctionsForPrimaryStandard(); try { - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } catch (Exception e) { } } @@ -633,7 +633,7 @@ public void includeAllAquisitions() { // jan 2015 // moved to button may 2016 tripoliSession.calculateSessionFitFunctionsForPrimaryStandard(); try { - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } catch (Exception e) { } } @@ -1619,7 +1619,7 @@ private void downholeCalculateRhos_buttonActionPerformed(java.awt.event.ActionEv // for now we have to undo internal acquisition rejecttions allowed by intercept but not by downhole tripoliSession.refitAllFractionsForDownhole(); - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); }//GEN-LAST:event_downholeCalculateRhos_buttonActionPerformed private void downholeFitEachStandard_radioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downholeFitEachStandard_radioButtonActionPerformed @@ -1633,7 +1633,7 @@ private void interceptCalculatePbcCorrAndRhos_button1ActionPerformed(java.awt.ev } catch (Exception e) { } - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); }//GEN-LAST:event_interceptCalculatePbcCorrAndRhos_button1ActionPerformed private void uniformYaxisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uniformYaxisActionPerformed @@ -1662,13 +1662,13 @@ private void setAllIndividualYAxisPanes_buttonActionPerformed(java.awt.event.Act private void refitInterceptSessionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refitInterceptSessionActionPerformed tripoliSession.calculateSessionFitFunctionsForPrimaryStandard(false); - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); tripoliSessionRawDataView.refreshPanel(true, false); }//GEN-LAST:event_refitInterceptSessionActionPerformed private void refitDownholeSessionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refitDownholeSessionActionPerformed tripoliSession.calculateSessionFitFunctionsForPrimaryStandard(false); - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); tripoliSessionRawDataView.refreshPanel(true, false); }//GEN-LAST:event_refitDownholeSessionActionPerformed diff --git a/src/main/java/org/earthtime/UPb_Redux/dialogs/sessionManagers/SessionAnalysisWorkflowManagerSHRIMP.java b/src/main/java/org/earthtime/UPb_Redux/dialogs/sessionManagers/SessionAnalysisWorkflowManagerSHRIMP.java index dbd78c5f..f414ba21 100644 --- a/src/main/java/org/earthtime/UPb_Redux/dialogs/sessionManagers/SessionAnalysisWorkflowManagerSHRIMP.java +++ b/src/main/java/org/earthtime/UPb_Redux/dialogs/sessionManagers/SessionAnalysisWorkflowManagerSHRIMP.java @@ -295,7 +295,7 @@ public void adjustmentValueChanged(AdjustmentEvent evt) { tripoliSession.applyCorrections(false); // nov 2015 to update data - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } } // This method is called whenever the selected tab changes ); @@ -559,7 +559,7 @@ private void showSessionViewOfRawDataModels(FractionationTechniquesEnum fraction tripoliSession.calculateSessionFitFunctionsForPrimaryStandard(false); } try { - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } catch (Exception e) { } @@ -622,7 +622,7 @@ public void includeAllFractions() { // jan 2015 tripoliSession.calculateSessionFitFunctionsForPrimaryStandard(false); try { - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } catch (Exception e) { } } @@ -636,7 +636,7 @@ public void includeAllAquisitions() { // jan 2015 tripoliSession.calculateSessionFitFunctionsForPrimaryStandard(false); try { - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); } catch (Exception e) { } } @@ -1602,7 +1602,7 @@ private void downholeCalculateRhos_buttonActionPerformed(java.awt.event.ActionEv // for now we have to undo internal acquisition rejecttions allowed by intercept but not by downhole tripoliSession.refitAllFractionsForDownhole(); - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); }//GEN-LAST:event_downholeCalculateRhos_buttonActionPerformed private void downholeFitEachStandard_radioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downholeFitEachStandard_radioButtonActionPerformed @@ -1616,7 +1616,7 @@ private void interceptCalculatePbcCorrAndRhos_button1ActionPerformed(java.awt.ev } catch (Exception e) { } - uPbReduxFrame.updateReportTable(true, false); + uPbReduxFrame.updateReportTable(true, false, ""); }//GEN-LAST:event_interceptCalculatePbcCorrAndRhos_button1ActionPerformed private void uniformYaxisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uniformYaxisActionPerformed diff --git a/src/main/java/org/earthtime/UPb_Redux/fractions/UPbReduxFractions/UPbFractionTableModel.java b/src/main/java/org/earthtime/UPb_Redux/fractions/UPbReduxFractions/UPbFractionTableModel.java index 42d03e90..a64cafa9 100644 --- a/src/main/java/org/earthtime/UPb_Redux/fractions/UPbReduxFractions/UPbFractionTableModel.java +++ b/src/main/java/org/earthtime/UPb_Redux/fractions/UPbReduxFractions/UPbFractionTableModel.java @@ -288,7 +288,7 @@ public void actionPerformed(ActionEvent e) { if ((e != null)) { // here we edit the fraction and refresh the table parentFrame.editFraction(fraction, 8);// kwikitab - parentFrame.updateReportTable(false, false); + parentFrame.updateReportTable(false, false, ""); } } } @@ -387,7 +387,7 @@ public void actionPerformed(ActionEvent e) { getSample().getFractions().get(myRow).// setRejected(!this.isSelected()); - getParentFrame().updateReportTable(false, false);//.rebuildFractionDisplays(false); + getParentFrame().updateReportTable(false, false, "");//.rebuildFractionDisplays(false); } // getParentFrame().updateReportTable( false);//.rebuildFractionDisplays(false); diff --git a/src/main/java/org/earthtime/UTh_Redux/fractions/fractionReduction/UThFractionReducer.java b/src/main/java/org/earthtime/UTh_Redux/fractions/fractionReduction/UThFractionReducer.java index 45cc61aa..15af5d5a 100644 --- a/src/main/java/org/earthtime/UTh_Redux/fractions/fractionReduction/UThFractionReducer.java +++ b/src/main/java/org/earthtime/UTh_Redux/fractions/fractionReduction/UThFractionReducer.java @@ -146,8 +146,8 @@ private static void calculateDatesFromLegacyData(UThLegacyFractionI fraction) { ValueModel r230Th_238Ufc = fraction.getRadiogenicIsotopeRatioByName(UThFractionationCorrectedIsotopicRatios.r230Th_238Ufc.getName()); ValueModel r232Th_238Ufc = fraction.getRadiogenicIsotopeRatioByName(UThFractionationCorrectedIsotopicRatios.r232Th_238Ufc.getName()); - // test for missing data - if (r234U_238Ufc.getValue().multiply(r230Th_238Ufc.getValue().multiply(r232Th_238Ufc.getValue())).compareTo(BigDecimal.ZERO) != 0) { + // test for missing data = need 2 of 3 + if ((r234U_238Ufc.getValue().signum() + r234U_238Ufc.getValue().signum() + r234U_238Ufc.getValue().signum()) >=2){ // matlab code meas.C Matrix covariance_fc = new Matrix(3, 3); diff --git a/src/main/java/org/earthtime/beans/ET_JButton.java b/src/main/java/org/earthtime/beans/ET_JButton.java index c4cb1502..22fd331e 100644 --- a/src/main/java/org/earthtime/beans/ET_JButton.java +++ b/src/main/java/org/earthtime/beans/ET_JButton.java @@ -67,7 +67,7 @@ public void mousePressed(MouseEvent evt) { super.mousePressed(evt); if (((Component) evt.getSource()).isEnabled()) { ((Component) evt.getSource()).setBackground(new Color(200, 200, 200)); - System.out.println("User clicked: " + getText()); +// System.out.println("User clicked: " + getText()); } } diff --git a/src/main/java/org/earthtime/dialogs/ReportSettingsManager.java b/src/main/java/org/earthtime/dialogs/ReportSettingsManager.java index ad24065e..71d58f16 100644 --- a/src/main/java/org/earthtime/dialogs/ReportSettingsManager.java +++ b/src/main/java/org/earthtime/dialogs/ReportSettingsManager.java @@ -860,7 +860,7 @@ private void apply_buttonActionPerformed (java.awt.event.ActionEvent evt) {//GEN //// String[][] reportFractions = ((UPbReduxFrame) parent).getTheSample().reportAllFractionsByNumberStyle( false ); - ((ReportPainterI) parent).loadAndShowReportTableData();//// reportFractions ); + ((ReportPainterI) parent).loadAndShowReportTableData("");//// reportFractions ); }//GEN-LAST:event_apply_buttonActionPerformed diff --git a/src/main/java/org/earthtime/projects/Project.java b/src/main/java/org/earthtime/projects/Project.java index 38c89921..2e0044d1 100644 --- a/src/main/java/org/earthtime/projects/Project.java +++ b/src/main/java/org/earthtime/projects/Project.java @@ -207,7 +207,7 @@ public void prepareSamplesForRedux() { ArrayList tripoliSamples = tripoliSession.getTripoliSamples(); for (AbstractTripoliSample tripoliSample : tripoliSamples) { // check for primary standard and leave it out - if (true) {//oct 2014 want to include standards now (!tripoliSample.isPrimaryStandard()) { + if (true) {//oct 2014 want to include standards now (!tripoliSample.isPrimaryReferenceMaterial()) { // june 2016 // determine if sample already processed diff --git a/src/main/java/org/earthtime/reportViews/ReportAliquotFractionsView.java b/src/main/java/org/earthtime/reportViews/ReportAliquotFractionsView.java index a24864cc..c8fd3d63 100644 --- a/src/main/java/org/earthtime/reportViews/ReportAliquotFractionsView.java +++ b/src/main/java/org/earthtime/reportViews/ReportAliquotFractionsView.java @@ -111,6 +111,7 @@ public class ReportAliquotFractionsView extends JLayeredPane implements ReportUp private JButton sortFractionsButton; private JButton toggleMeasButton; private ArrayList sortButtons; + private static TableRowObject lastAquiredTableRowObject; /** * @@ -181,15 +182,30 @@ private synchronized void prepareReportFractionsArrayForDisplay() { * * @param performReduction * @param inLiveMode the value of inLiveMode + * @param fractionIdToFocus the value of fractionIdToFocus */ @Override - public void updateReportTable(boolean performReduction, boolean inLiveMode) { - parentFrame.updateReportTable(performReduction, inLiveMode); + public void updateReportTable(boolean performReduction, boolean inLiveMode, String fractionIdToFocus) { + parentFrame.updateReportTable(performReduction, inLiveMode, fractionIdToFocus); prepareReportFractionsArrayForDisplay(); reSizeSortButtons(); repaint(); } + public void forceVerticalScrollToShowSpecificRow(String lastAcquiredFractionID) { + ((ReportPainter)reportBody).setLastAcquiredFractionID(lastAcquiredFractionID); + repaint(); + + if (lastAquiredTableRowObject != null){ + int bottomPixelCount = lastAquiredTableRowObject.getBottomPixelCount(); + + System.out.println("BOTTOM = " + bottomPixelCount); + } +// reportFractionIDsScrollPane.getVerticalScrollBar().setValue(reportFractionIDsScrollPane.getVerticalScrollBar().getMaximum()); +// reportFractionIDsScrollPane.validate(); +// repaint(); + } + /** * @param reportFractions the reportFractions to set */ @@ -218,6 +234,20 @@ class TableRowObject implements Comparable { public int compareTo(TableRowObject o) { return (new Integer(this.bottomPixelCount).compareTo(o.bottomPixelCount)); } + + /** + * @return the bottomPixelCount + */ + public int getBottomPixelCount() { + return bottomPixelCount; + } + + /** + * @return the rowObject + */ + public Object getRowObject() { + return rowObject; + } } /** @@ -273,7 +303,9 @@ private float calculateColumnWidth(int col) { } private void reSizeScrollPanes() { - reportBodyScrollPane.setSize(getWidth() - fractionColumnWidth, getHeight() - DATATABLE_TOP_HEIGHT); +// reportBodyScrollPane.setSize(getWidth() - fractionColumnWidth, getHeight() - DATATABLE_TOP_HEIGHT); + //July 2016 adapted to handle narrow tables per LiveData + reportBodyScrollPane.setSize(Math.min(reportWidth - fractionColumnWidth + fractionButtonMargin + 2 * (int) dividerWidth, getWidth() - fractionColumnWidth), getHeight() - DATATABLE_TOP_HEIGHT); reportBodyScrollPane.revalidate(); // -15 compensates for hidden scrollbar when coordinating scrolls @@ -281,6 +313,8 @@ private void reSizeScrollPanes() { reportFractionIDsScrollPane.setSize(fractionColumnWidth, getHeight() - DATATABLE_TOP_HEIGHT - offsetForScrollbar); reportFractionIDsScrollPane.revalidate(); + + repaint(); } private void reSizeSortButtons() { @@ -369,8 +403,7 @@ public void preparePanel() { // column #2 is the fractionID column fractionColumnWidth - = // - leftMargin + (int) (calculateColumnWidth(2) * COLUMN_WIDTH_ADJUST_FACTOR) + (int) dividerWidth; + = leftMargin + (int) (calculateColumnWidth(2) * COLUMN_WIDTH_ADJUST_FACTOR) + (int) dividerWidth; fractionColumnWidth += fractionButtonMargin; @@ -392,7 +425,8 @@ public void preparePanel() { reportHeader = new ReportPainter(this, "HEADER", false); reportHeader.setBackground(Color.white); reportHeader.setOpaque(true); - reportHeader.setBounds(fractionColumnWidth, 0, reportWidth + 5 - fractionColumnWidth, DATATABLE_TOP_HEIGHT); + reportHeader.setBounds(fractionColumnWidth, 0, Math.min(reportWidth - fractionColumnWidth + fractionButtonMargin + (int) dividerWidth, getWidth() - fractionColumnWidth), DATATABLE_TOP_HEIGHT); + reportHeader.setPreferredSize(new Dimension(Math.min(reportWidth - fractionColumnWidth + fractionButtonMargin + (int) dividerWidth, getWidth() - fractionColumnWidth), DATATABLE_TOP_HEIGHT)); add(reportHeader); // build sort buttons @@ -416,7 +450,7 @@ public void preparePanel() { public void actionPerformed(ActionEvent e) { sample.getReportSettingsModel().toggleMeasuredRatiosInCompositionCategory(); - parentFrame.loadAndShowReportTableData(); + parentFrame.loadAndShowReportTableData(""); } }); if (sample.isAnalysisTypeIDTIMS()) { @@ -674,6 +708,7 @@ private class ReportPainter extends JLayeredPane implements MouseInputListener { private final String paintType; // "BOTH", "HEADER", "BODY", "FRACTION", "FRACTION_HEADER" private ArrayList verticalPixelFractionMap; private TableRowObject lastSelectedTableRowObject; + private String lastAcquiredFractionID; public ReportPainter(ReportUpdaterInterface parent, String paintType, boolean showFractions) { super(); @@ -684,6 +719,8 @@ public ReportPainter(ReportUpdaterInterface parent, String paintType, boolean sh verticalPixelFractionMap = new ArrayList<>(); this.lastSelectedTableRowObject = new TableRowObject(0, new UPbFraction()); + this.lastAcquiredFractionID = ""; + setOpaque(true); setBackground(Color.white); @@ -853,15 +890,15 @@ public void paint(Graphics2D g2D) { accumulateDrawnHeight = 0; overallWidth = drawnWidth - 3; - reportWidth = (int) overallWidth;// + 200; +// reportWidth = (int) overallWidth + (int) dividerWidth;// + 200; // draw horizontal line under column titles g2D.setColor(Color.black); - g2D.drawLine(0, drawnHeight, reportWidth, drawnHeight); + g2D.drawLine(0, drawnHeight, reportWidth - fractionColumnWidth + fractionButtonMargin + (int) dividerWidth, drawnHeight); g2D.setColor(Color.black); // section for sort arrows - g2D.drawLine(0, drawnHeight + lineHeight, reportWidth, drawnHeight + lineHeight); + g2D.drawLine(0, drawnHeight + lineHeight, reportWidth - fractionColumnWidth + fractionButtonMargin + (int) dividerWidth, drawnHeight + lineHeight); g2D.setColor(Color.black); drawnHeight -= 2;//5; @@ -886,7 +923,6 @@ public void paint(Graphics2D g2D) { drawnWidth = leftMargin; // april 2012 reportFractions will contain only accepted OR rejected, thus here check for printing fractions -//// boolean showFractions = reportFractions[row][0].equalsIgnoreCase( "TRUE" ); if (showFractions) { grayRow++; // for each aliquot @@ -958,12 +994,14 @@ public void paint(Graphics2D g2D) { ETFractionInterface fraction = null; try { fraction = sample.getFractionByIDAndAliquotNumber(getReportFractions()[row][2].trim(), ((ReduxAliquotInterface) aliquot).getAliquotNumber()); - verticalPixelFractionMap.add( // - new TableRowObject( // + TableRowObject currentFractionTableRowObject + = new TableRowObject( // drawnHeight + topMargin + lineHeight + 1,// - fraction)); -// } catch (Exception e) { -// } + fraction); + verticalPixelFractionMap.add(currentFractionTableRowObject); + if (lastAcquiredFractionID.compareToIgnoreCase(fraction.getFractionID()) == 0) { + lastAquiredTableRowObject = currentFractionTableRowObject; + } if (((ReportRowGUIInterface) fraction).isSelectedInDataTable()) { // dec 2011 give some button characteristics for selected fraction @@ -1054,8 +1092,7 @@ public void paint(Graphics2D g2D) { // strip out footnote letter String[] footNote = item.split("&"); String footNoteLine - = // - " " // + = " " // + footNote[0] // + " " // + footNote[1]; @@ -1081,48 +1118,51 @@ public void mouseClicked(MouseEvent e) { int row = Collections.binarySearch(verticalPixelFractionMap, new TableRowObject(mouseY, null)); row = Math.abs(row + 1); - if (mouseY > verticalPixelFractionMap.get(verticalPixelFractionMap.size() - 1).bottomPixelCount) { + if (mouseY > verticalPixelFractionMap.get(verticalPixelFractionMap.size() - 1).getBottomPixelCount()) { row = -1; } if (row >= 0) { - Object fractionOrAliquot = verticalPixelFractionMap.get(row).rowObject; - - if (fractionOrAliquot instanceof ETFractionInterface) { - - if (e.getModifiers() == InputEvent.BUTTON1_MASK) { - // determine if note box or fraction name - if (mouseX < lineHeight) { - // show notes - JDialog notesDialog = new FractionNotesDialog(parentFrame, true, (ETFractionInterface) fractionOrAliquot); - notesDialog.setLocation(parentFrame.getX() + 300, parentFrame.getY() + 300); - notesDialog.setVisible(true); + try { + Object fractionOrAliquot = verticalPixelFractionMap.get(row).getRowObject(); + + if (fractionOrAliquot instanceof ETFractionInterface) { + + if (e.getModifiers() == InputEvent.BUTTON1_MASK) { + // determine if note box or fraction name + if (mouseX < lineHeight) { + // show notes + JDialog notesDialog = new FractionNotesDialog(parentFrame, true, (ETFractionInterface) fractionOrAliquot); + notesDialog.setLocation(parentFrame.getX() + 300, parentFrame.getY() + 300); + notesDialog.setVisible(true); + } else { + parentFrame.editFraction(((ETFractionInterface) verticalPixelFractionMap.get(row).getRowObject()), 8);// kwikitab + updateReportTable(false, false, ""); + } } else { - parentFrame.editFraction(((ETFractionInterface) verticalPixelFractionMap.get(row).rowObject), 8);// kwikitab - updateReportTable(false, false); - } - } else { - boolean isRejected = !((ETFractionInterface) verticalPixelFractionMap.get(row).rowObject).isRejected(); - ((ETFractionInterface) verticalPixelFractionMap.get(row).rowObject).setRejected(isRejected); - // dec 2015 for tripoli fractions - try { - ((UPbFractionI) verticalPixelFractionMap.get(row).rowObject).getTripoliFraction().setIncluded(!isRejected); - } catch (Exception noTF) { + boolean isRejected = !((ETFractionInterface) verticalPixelFractionMap.get(row).rowObject).isRejected(); + ((ETFractionInterface) verticalPixelFractionMap.get(row).getRowObject()).setRejected(isRejected); + // dec 2015 for tripoli fractions + try { + ((UPbFractionI) verticalPixelFractionMap.get(row).getRowObject()).getTripoliFraction().setIncluded(!isRejected); + } catch (Exception noTF) { + } + updateReportTable(false, false, ""); } - parent.updateReportTable(false, false); } - } - if (fractionOrAliquot instanceof AliquotInterface) { + if (fractionOrAliquot instanceof AliquotInterface) { - if (e.getModifiers() == InputEvent.BUTTON1_MASK) { - parentFrame.editAliquotByProjectType(((AliquotInterface) verticalPixelFractionMap.get(row).rowObject)); - } else { - AliquotInterface.toggleAliquotFractionsRejectedStatus(((ReduxAliquotInterface) verticalPixelFractionMap.get(row).rowObject)); - parent.updateReportTable(false, false); - } + if (e.getModifiers() == InputEvent.BUTTON1_MASK) { + parentFrame.editAliquotByProjectType(((AliquotInterface) verticalPixelFractionMap.get(row).getRowObject())); + } else { + AliquotInterface.toggleAliquotFractionsRejectedStatus(((ReduxAliquotInterface) verticalPixelFractionMap.get(row).getRowObject())); + updateReportTable(false, false, ""); + } + } + } catch (Exception e2) { } } } @@ -1147,7 +1187,7 @@ public void mouseEntered(MouseEvent e) { public void mouseExited(MouseEvent e) { if (paintType.equalsIgnoreCase("FRACTION")) { try { - ((ReportRowGUIInterface) lastSelectedTableRowObject.rowObject).setSelectedInDataTable(false); + ((ReportRowGUIInterface) lastSelectedTableRowObject.getRowObject()).setSelectedInDataTable(false); repaintTableRowElementButtonArea(lastSelectedTableRowObject); } catch (Exception ex) { } @@ -1173,7 +1213,7 @@ public void mouseMoved(MouseEvent e) { row--; } - if (mouseY > verticalPixelFractionMap.get(verticalPixelFractionMap.size() - 1).bottomPixelCount) { + if (mouseY > verticalPixelFractionMap.get(verticalPixelFractionMap.size() - 1).getBottomPixelCount()) { row = -1; } @@ -1181,7 +1221,7 @@ public void mouseMoved(MouseEvent e) { TableRowObject tableRowObject = verticalPixelFractionMap.get(row); - Object fractionOrAliquot = tableRowObject.rowObject; + Object fractionOrAliquot = tableRowObject.getRowObject(); if (fractionOrAliquot instanceof ETFractionInterface) { if (mouseX < lineHeight) { @@ -1201,9 +1241,9 @@ public void mouseMoved(MouseEvent e) { + "Right-Click to toggle active / rejected for all fractions in this aliquot."); } - if (tableRowObject.bottomPixelCount != lastSelectedTableRowObject.bottomPixelCount) { + if (tableRowObject.getBottomPixelCount() != lastSelectedTableRowObject.getBottomPixelCount()) { try { - ((ReportRowGUIInterface) lastSelectedTableRowObject.rowObject).setSelectedInDataTable(false); + ((ReportRowGUIInterface) lastSelectedTableRowObject.getRowObject()).setSelectedInDataTable(false); repaintTableRowElementButtonArea(lastSelectedTableRowObject); lastSelectedTableRowObject = tableRowObject; @@ -1219,7 +1259,7 @@ public void mouseMoved(MouseEvent e) { } private void repaintTableRowElementButtonArea(TableRowObject tableRowObject) { - repaint(0, tableRowObject.bottomPixelCount - lineHeight + 2, getWidth(), lineHeight + 3); + repaint(0, tableRowObject.getBottomPixelCount() - lineHeight + 2, getWidth(), lineHeight + 3); } /** @@ -1335,5 +1375,12 @@ public void outputToPDF(File file) { public void viewPDF(String fileURL) { BrowserControl.displayURL(fileURL); } + + /** + * @param lastAcquiredFractionID the lastAcquiredFractionID to set + */ + public void setLastAcquiredFractionID(String lastAcquiredFractionID) { + this.lastAcquiredFractionID = lastAcquiredFractionID; + } } } diff --git a/src/main/java/org/earthtime/reportViews/ReportPainterI.java b/src/main/java/org/earthtime/reportViews/ReportPainterI.java index a4c0b56d..a4f36592 100644 --- a/src/main/java/org/earthtime/reportViews/ReportPainterI.java +++ b/src/main/java/org/earthtime/reportViews/ReportPainterI.java @@ -29,8 +29,9 @@ public interface ReportPainterI { /** * + * @param fractionIdToFocus the value of fractionIdToFocus */ - public void loadAndShowReportTableData (); + public void loadAndShowReportTableData (String fractionIdToFocus); /** * diff --git a/src/main/java/org/earthtime/reportViews/ReportUpdaterInterface.java b/src/main/java/org/earthtime/reportViews/ReportUpdaterInterface.java index f6f12162..7515e74a 100644 --- a/src/main/java/org/earthtime/reportViews/ReportUpdaterInterface.java +++ b/src/main/java/org/earthtime/reportViews/ReportUpdaterInterface.java @@ -28,6 +28,7 @@ public interface ReportUpdaterInterface { * * @param performReduction * @param inLiveMode the value of inLiveMode + * @param fractionIdToFocus the value of fractionIdToFocus */ - public void updateReportTable( boolean performReduction, boolean inLiveMode); + public void updateReportTable( boolean performReduction, boolean inLiveMode, String fractionIdToFocus); } diff --git a/src/main/java/org/earthtime/reportViews/TabbedReportViews.java b/src/main/java/org/earthtime/reportViews/TabbedReportViews.java index d4acfba2..9f45dc05 100644 --- a/src/main/java/org/earthtime/reportViews/TabbedReportViews.java +++ b/src/main/java/org/earthtime/reportViews/TabbedReportViews.java @@ -21,6 +21,7 @@ import java.io.File; import javax.swing.JLayeredPane; import javax.swing.JTabbedPane; +import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import org.earthtime.ETReduxFrame; import org.earthtime.exceptions.ETException; @@ -45,6 +46,7 @@ public class TabbedReportViews extends JTabbedPane { public TabbedReportViews(ETReduxFrame parentFrame) { super(); this.parentFrame = parentFrame; + setBorder(new LineBorder(Color.black)); } /**