Skip to content

Commit

Permalink
Merge pull request #98 from bowring/laser
Browse files Browse the repository at this point in the history
Improvements for Laserchron Lab per requests.
  • Loading branch information
bowring authored Aug 1, 2016
2 parents de0e5a2 + e883292 commit b9b68f4
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 100 deletions.
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
<url>http://bits.netbeans.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>jcenter</id>
<url>http://jcenter.bintray.com/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
Expand All @@ -83,7 +87,7 @@
<dependency>
<groupId>org.netbeans.external</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>RELEASE701</version>
<version>RELEASE731</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ public class AbstractDataMonitorView extends AbstractRawDataView

private SampleTreeI dateTreeByAliquot;

private static transient boolean showSessions = false;

/**
*
*/
Expand Down Expand Up @@ -333,83 +335,12 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) {

this.add(rawDataFilePathTextArea, JLayeredPane.DEFAULT_LAYER);

int count = 0;

SortedSet<TripoliFraction> standardFractions = FractionsFilterInterface.getTripoliFractionsFiltered(tripoliFractions, FractionSelectionTypeEnum.STANDARD, IncludedTypeEnum.ALL);

if (tripoliFractions.size() > 0) {
SortedSet<DataModelInterface> dataModels = tripoliFractions.first().getNonPbRatiosForFractionFitting();
Iterator<DataModelInterface> dataModelsIterator = dataModels.iterator();

while (dataModelsIterator.hasNext()) {
DataModelInterface dm = dataModelsIterator.next();

AbstractRawDataView rawDataModelView
= new SessionOfStandardView( //
this,//
tripoliSession.getCurrentSessionForStandardsFractionation().get(dm.getRawRatioModelName()), //
standardFractions,//
dm, //
DataPresentationModeEnum.RATIO,//
new Rectangle(//
90, //
count * (160 + 50) + topMargin + 50, //
250,//
160));

rawDataModelView.preparePanel(doReScale, inLiveMode);

this.add(rawDataModelView, JLayeredPane.DEFAULT_LAYER);

double overallMinY = rawDataModelView.getMinY();
double overallMaxY = rawDataModelView.getMaxY();

// generate tics array for standards all
BigDecimal[] yAxisTics = null;

yAxisTics = TicGeneratorForAxes.generateTics(overallMinY, overallMaxY, (int) (160 / 20.0));
if (yAxisTics.length > 15) {
yAxisTics = TicGeneratorForAxes.generateTics(overallMinY, overallMaxY, (int) (160 / 32.0));
}

// create margins for y-values after axis tics calculated
double yMarginStretch = TicGeneratorForAxes.generateMarginAdjustment(overallMinY, overallMaxY, 12.0 / 160);
overallMinY -= yMarginStretch;
overallMaxY += yMarginStretch;

AbstractRawDataView yAxisPane = new YAxisView( //
new AbstractRawDataView[]{rawDataModelView},
this,//
Color.white, //
overallMinY,//
overallMaxY,//
new Rectangle( //
5, count * (160 + 50) + topMargin + 50, //
90, //
160),//
false, true);
yAxisPane.setTics(yAxisTics);

this.add(yAxisPane, JLayeredPane.DEFAULT_LAYER);

AbstractRawDataView sessionFitFunctionsPresentationView
= new SessionFitFunctionsPresentationView( //
this,//
tripoliSession.getCurrentSessionForStandardsFractionation().get(dm.getRawRatioModelName()), //
(FitFunctionDataInterface) rawDataModelView,//
DataPresentationModeEnum.RATIO, //
new Rectangle( //
345, //
count * (160 + 50) + topMargin + 50, //
250, //
180));

sessionFitFunctionsPresentationView.preparePanel(doReScale, inLiveMode);

this.add(sessionFitFunctionsPresentationView, JLayeredPane.DEFAULT_LAYER);

count++;
if (showSessions) {
prepareSessionViews(doReScale, inLiveMode);
}

prepareConcordia(inLiveMode);

preparePDF();
Expand All @@ -432,6 +363,86 @@ public void preparePanel(boolean doReScale, boolean inLiveMode) {

}

private void prepareSessionViews(boolean doReScale, boolean inLiveMode) {
SortedSet<TripoliFraction> standardFractions = FractionsFilterInterface.getTripoliFractionsFiltered(tripoliFractions, FractionSelectionTypeEnum.STANDARD, IncludedTypeEnum.ALL);
int count = 0;
int unitHeight = 158;

SortedSet<DataModelInterface> dataModels = tripoliFractions.first().getNonPbRatiosForFractionFitting();
Iterator<DataModelInterface> dataModelsIterator = dataModels.iterator();

while (dataModelsIterator.hasNext()) {
DataModelInterface dm = dataModelsIterator.next();

AbstractRawDataView rawDataModelView
= new SessionOfStandardView( //
this,//
tripoliSession.getCurrentSessionForStandardsFractionation().get(dm.getRawRatioModelName()), //
standardFractions,//
dm, //
DataPresentationModeEnum.RATIO,//
new Rectangle(//
90, //
count * (unitHeight + 50) + topMargin + 50, //
250,//
unitHeight));

rawDataModelView.preparePanel(doReScale, inLiveMode);

this.add(rawDataModelView, JLayeredPane.DEFAULT_LAYER);

double overallMinY = rawDataModelView.getMinY();
double overallMaxY = rawDataModelView.getMaxY();

// generate tics array for standards all
BigDecimal[] yAxisTics = null;

yAxisTics = TicGeneratorForAxes.generateTics(overallMinY, overallMaxY, (int) (unitHeight / 20.0));
if (yAxisTics.length > 15) {
yAxisTics = TicGeneratorForAxes.generateTics(overallMinY, overallMaxY, (int) (unitHeight / 32.0));
}

// create margins for y-values after axis tics calculated
double yMarginStretch = TicGeneratorForAxes.generateMarginAdjustment(overallMinY, overallMaxY, 12.0 / unitHeight);
overallMinY -= yMarginStretch;
overallMaxY += yMarginStretch;

AbstractRawDataView yAxisPane = new YAxisView( //
new AbstractRawDataView[]{rawDataModelView},
this,//
Color.white, //
overallMinY,//
overallMaxY,//
new Rectangle( //
5, count * (unitHeight + 50) + topMargin + 50, //
90, //
unitHeight),//
false, true);
yAxisPane.setTics(yAxisTics);

this.add(yAxisPane, JLayeredPane.DEFAULT_LAYER);

AbstractRawDataView sessionFitFunctionsPresentationView
= new SessionFitFunctionsPresentationView( //
this,//
tripoliSession.getCurrentSessionForStandardsFractionation().get(dm.getRawRatioModelName()), //
(FitFunctionDataInterface) rawDataModelView,//
DataPresentationModeEnum.RATIO, //
new Rectangle( //
345, //
count * (unitHeight + 50) + topMargin + 50, //
250, //
180));

sessionFitFunctionsPresentationView.preparePanel(doReScale, inLiveMode);

this.add(sessionFitFunctionsPresentationView, JLayeredPane.DEFAULT_LAYER);

count++;
}

}

private void rawDataFilePathTextFactory() throws IOException {
// show rawdatafile path
rawDataFilePathTextArea = new JTextArea(//
Expand All @@ -447,9 +458,9 @@ private void rawDataFilePathTextFactory() throws IOException {

private void showMostRecentFractionLabelFactory() {
// show rawdatafile path
mostRecentFractionData = new JLabel("Most Recent");
mostRecentFractionData = new JLabel("Latest:");

mostRecentFractionData.setBounds(leftMargin + 25, topMargin + 647, 500, 22);
mostRecentFractionData.setBounds(leftMargin -10, topMargin + 648, 650, 21);
mostRecentFractionData.setBorder(new LineBorder(Color.black));

mostRecentFractionData.setForeground(Color.blue);
Expand Down Expand Up @@ -501,8 +512,18 @@ private void buttonFactory() {
refreshButton.setEnabled(true);
this.add(refreshButton, LAYER_FIVE);

ET_JButton showSessionButton = new ET_JButton("Toggle Show Sessions");
showSessionButton.setBounds(leftMargin + 690, topMargin + 670, 135, 22);
showSessionButton.addActionListener((ActionEvent ae) -> {
showSessions = !showSessions;
preparePanel(true, false);
});

showSessionButton.setEnabled(true);
this.add(showSessionButton, LAYER_FIVE);

ET_JButton editReportSettingsButton = new ET_JButton("Edit Report Settings");
editReportSettingsButton.setBounds(602, topMargin + 600, 120, 22);
editReportSettingsButton.setBounds(showSessions ? 602 : leftMargin + 10, topMargin + 600, 120, 22);
editReportSettingsButton.addActionListener((ActionEvent ae) -> {
ReportSettingsInterface.EditReportSettings(project.getSuperSample().getReportSettingsModel(), uPbReduxFrame);
uPbReduxFrame.updateReportTable(false, true, "");
Expand All @@ -513,7 +534,7 @@ private void buttonFactory() {
this.add(editReportSettingsButton, LAYER_FIVE);

ET_JButton concordiaSettingsButton = new ET_JButton("Concordia Settings");
concordiaSettingsButton.setBounds(602, topMargin + 550, 120, 22);
concordiaSettingsButton.setBounds(showSessions ? 602 : leftMargin + 10, topMargin + 550, 120, 22);
concordiaSettingsButton.addActionListener((ActionEvent ae) -> {
((AliquotDetailsDisplayInterface) concordiaGraphPanel).showConcordiaDisplayOptionsDialog();
});
Expand Down Expand Up @@ -550,8 +571,6 @@ public void prepareConcordia(boolean inLiveMode) {

((ConcordiaGraphPanel) concordiaGraphPanel).setCurrentGraphAxesSetup(new GraphAxesSetup("C", 2));

setConcordiaBounds(725, 620, 625);

((ConcordiaGraphPanel) concordiaGraphPanel).setShowTitleBox(false);

((ConcordiaGraphPanel) concordiaGraphPanel).//
Expand All @@ -568,11 +587,13 @@ public void prepareConcordia(boolean inLiveMode) {

((ConcordiaGraphPanel) concordiaGraphPanel).setShowTightToEdges(true);

kwikiConcordiaToolBar = new KwikiConcordiaToolBar(//
940, topMargin + concordiaGraphPanel.getHeight() + topMargin + 50, concordiaGraphPanel, null);

}

setConcordiaBounds(showSessions ? 725 : leftMargin + 135, showSessions ? 620 : 900, 625);

kwikiConcordiaToolBar = new KwikiConcordiaToolBar(//
940, topMargin + concordiaGraphPanel.getHeight() + topMargin + 50, concordiaGraphPanel, null);

((ConcordiaGraphPanel) concordiaGraphPanel).setSample(project.getSuperSample());
((ConcordiaGraphPanel) concordiaGraphPanel).setViewOptions();
((ConcordiaGraphPanel) concordiaGraphPanel).setShowBestDateDivider206_238(true);
Expand Down Expand Up @@ -641,11 +662,11 @@ public void preparePDF() {
((DateProbabilityDensityPanel) probabilityPanel).//
setSelectedFractions(filterActiveUPbFractions(project.getSuperSample().getUpbFractionsUnknown()));

probabilityPanel.setBounds(1355, topMargin + 60, pdfWidth, pdfHeight - 5);
probabilityPanel.setBounds(showSessions ? 1355: leftMargin + 1050 , topMargin + 60, showSessions ? pdfWidth: 875, pdfHeight - 5);

((DateProbabilityDensityPanel) probabilityPanel).setChosenDateName("age206_238r");

((DateProbabilityDensityPanel) probabilityPanel).setGraphWidth(pdfWidth - 25);
((DateProbabilityDensityPanel) probabilityPanel).setGraphWidth((showSessions ? pdfWidth : 875) - 25);

((DateProbabilityDensityPanel) probabilityPanel).setGraphHeight(pdfHeight - 25);

Expand All @@ -661,8 +682,9 @@ public void preparePDF() {
public void prepareDateTree() {
// april 2016 TODO: move to own method
JScrollPane dateTreeByAliquot_ScrollPane = new javax.swing.JScrollPane();
dateTreeByAliquot_ScrollPane.setBounds(600, topMargin + 50, 125, 500);
dateTreeByAliquot_ScrollPane.setBounds(showSessions ? 600 : leftMargin + 10, topMargin + 50, 125, 500);
dateTreeByAliquot = new SampleTreeAnalysisMode(project.getSuperSample());

dateTreeByAliquot.setSampleTreeChange(this);
dateTreeByAliquot.buildTree();
dateTreeByAliquot.expandAllNodes();
Expand Down Expand Up @@ -817,10 +839,9 @@ public int compare(TripoliFraction tf1, TripoliFraction tf2) {
});

tripoliFractionsByDate.addAll(tripoliFractions);
System.out.println("Latest = " + tripoliFractionsByDate.first().getFractionID());
mostRecentFractionData.setText(tripoliFractionsByDate.first().getFractionID());

updateDisplays(tripoliFractionsByDate.first().getFractionID());
System.out.println("Latest = " + tripoliFractionsByDate.first().dateSummary());
mostRecentFractionData.setText("** LATEST: " + tripoliFractionsByDate.first().dateSummary());

((ReportAliquotFractionsView) ((TabbedReportViews) reportTableTabbedPane).getViewTabulatedAliquotActiveFractions())
.forceVerticalScrollToShowSpecificRow(tripoliFractionsByDate.first().getFractionID());
Expand Down Expand Up @@ -976,7 +997,7 @@ public void paint(Graphics2D g2d) {
paintInit(g2d);

// draw box around possibly missing pdf
g2d.drawRect(1350, topMargin + 50, pdfWidth + 5, pdfHeight + 5);
g2d.drawRect(showSessions ? 1350: leftMargin + 1045, topMargin + 50, (showSessions ? pdfWidth : 875 ) + 5, pdfHeight + 5);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/earthtime/Tripoli/fractions/TripoliFraction.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.earthtime.UPb_Redux.fractions.FractionI;
import org.earthtime.UPb_Redux.valueModels.ValueModel;
import org.earthtime.dataDictionaries.FractionationTechniquesEnum;
import org.earthtime.dataDictionaries.RadDates;
import org.earthtime.dataDictionaries.RadDatesForPbCorrSynchEnum;
import org.earthtime.dataDictionaries.RawRatioNames;
import org.earthtime.ratioDataModels.AbstractRatiosDataModel;
Expand Down Expand Up @@ -1624,4 +1625,17 @@ public boolean isCurrentlyFitted() {
public void setCurrentlyFitted(boolean currentlyFitted) {
this.currentlyFitted = currentlyFitted;
}

public String dateSummary(){
return fractionID
+ "> 206/238: "
+ uPbFraction.getRadiogenicIsotopeDateByName(RadDates.age206_238r)
.formatValueAndTwoSigmaForPublicationSigDigMode("ABS", -6, 2)
+ "> 207/235: "
+ uPbFraction.getRadiogenicIsotopeDateByName(RadDates.age207_235r)
.formatValueAndTwoSigmaForPublicationSigDigMode("ABS", -6, 2)
+ "> 207/206: "
+ uPbFraction.getRadiogenicIsotopeDateByName(RadDates.age207_206r)
.formatValueAndTwoSigmaForPublicationSigDigMode("ABS", -6, 2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private LaserchronElementIISetupUPb_A() {
BigDecimal.ZERO), //
IonCounterCollectorModel.CollectedDataStyle.COUNTS);

// fro GG Feb 2016
// from GG Feb 2016
// Dead Time should be 22 ns
//
// Not sure how you are counting the integration time. Note that values are measured four times on each peak. Values below are for each one of the four measurements:
Expand All @@ -96,12 +96,12 @@ private LaserchronElementIISetupUPb_A() {
isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Th232, singleCollector);
isotopeMappingModel.getIsotopeToIntegrationTimeMap().put( //
IsotopesEnum.Th232, 0.014);
IsotopesEnum.Th232, 0.0104);

isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Pb208, singleCollector);
isotopeMappingModel.getIsotopeToIntegrationTimeMap().put( //
IsotopesEnum.Pb208, 0.014);
IsotopesEnum.Pb208, 0.0104);

isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Pb207, singleCollector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ private LaserchronElementIISetupUPb_B() {
isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Th232, singleCollector);
isotopeMappingModel.getIsotopeToIntegrationTimeMap().put( //
IsotopesEnum.Th232, 0.014);
IsotopesEnum.Th232, 0.0104);

isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Pb208, singleCollector);
isotopeMappingModel.getIsotopeToIntegrationTimeMap().put( //
IsotopesEnum.Pb208, 0.014);
IsotopesEnum.Pb208, 0.0104);

isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Pb207, singleCollector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ private LaserchronElementIISetupUPb_C() {
isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Th232, singleCollector);
isotopeMappingModel.getIsotopeToIntegrationTimeMap().put( //
IsotopesEnum.Th232, 0.014);
IsotopesEnum.Th232, 0.0104);

isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Pb208, singleCollector);
isotopeMappingModel.getIsotopeToIntegrationTimeMap().put( //
IsotopesEnum.Pb208, 0.014);
IsotopesEnum.Pb208, 0.0104);

isotopeMappingModel.getIsotopeToCollectorMap().put(//
IsotopesEnum.Pb207, singleCollector);
Expand Down
Loading

0 comments on commit b9b68f4

Please sign in to comment.