Skip to content

Commit

Permalink
#204: first cut of fix for null dateinfo error seen by Max
Browse files Browse the repository at this point in the history
  • Loading branch information
dbenn committed Jan 28, 2025
1 parent 4e37db8 commit cfb2c9b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.aavso.tools.vstar.ui.dialog.period.PeriodAnalysis2DChartPane;
import org.aavso.tools.vstar.ui.dialog.period.PeriodAnalysisDataTablePane;
import org.aavso.tools.vstar.ui.dialog.period.PeriodAnalysisTopHitsTablePane;
import org.aavso.tools.vstar.ui.mediator.AnalysisType;
import org.aavso.tools.vstar.ui.mediator.Mediator;
import org.aavso.tools.vstar.ui.mediator.message.NewStarMessage;
import org.aavso.tools.vstar.ui.mediator.message.PeriodAnalysisSelectionMessage;
Expand Down Expand Up @@ -300,24 +301,30 @@ protected void modelAction(List<PeriodAnalysisDataPoint> dataPoints) {
try {
// Compute binning result again for selected top-hit period.
double period = dataPoints.get(0).getPeriod();

// Duplicate the obs (just JD and mag) so we can set phases
// without disturbing the original observation object.
List<ValidObservation> phObs = copyObs(obs);

double epoch = PhaseCalcs.epochStrategyMap.get("alpha").determineEpoch(phObs);
double epoch = PhaseCalcs.epochStrategyMap.get("alpha").determineEpoch(obs);

PhaseCalcs.setPhases(phObs, epoch, period);

Collections.sort(phObs, StandardPhaseComparator.instance);

Mediator.getInstance().createPhasePlot(period, epoch);
Mediator.getInstance().waitForJobCompletion();

Mediator.getInstance().changeAnalysisType(AnalysisType.PHASE_PLOT);
Mediator.getInstance().waitForJobCompletion();

// Note: 1 / bins = 1 cycle divided into N bins
BinningResult binningResult = DescStats.createSymmetricBinnedObservations(phObs,
PhaseTimeElementEntity.instance, 1.0 / bins);

List<ValidObservation> meanObs = binningResult.getMeanObservations();

PiecewiseLinearModel model = new PiecewiseLinearModel(this.obs, meanObs);
PiecewiseLinearModel model = new PiecewiseLinearModel(phObs, meanObs);

Mediator.getInstance().performModellingOperation(model);
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ public boolean canBeRemoved() {
@Override
protected void enableButtons() {
super.enableButtons();
refineButton.setEnabled(true);
if (refineButton != null) {
refineButton.setEnabled(true);
}
}

/**
Expand Down

0 comments on commit cfb2c9b

Please # to comment.