Package org.aavso.tools.vstar.data

Examples of org.aavso.tools.vstar.data.ValidObservation


          @Override
          public void execute() throws AlgorithmError {

            for (int i = 0; i < obs.size() && !interrupted; i++) {
              ValidObservation ob = obs.get(i);
              fitter.addObservedPoint(1.0,
                  ob.getJD() - zeroPoint, ob.getMag());
            }

            if (!interrupted) {
              try {
                function = fitter.fit();

                fit = new ArrayList<ValidObservation>();
                residuals = new ArrayList<ValidObservation>();
                double sumSqResiduals = 0;

                String comment = LocaleProps
                    .get("MODEL_INFO_POLYNOMIAL_DEGREE_DESC")
                    + degree;

                // Create fit and residual observations and
                // compute the sum of squares of residuals for
                // Akaike and Bayesean Information Criteria.
                for (int i = 0; i < obs.size() && !interrupted; i++) {
                  ValidObservation ob = obs.get(i);

                  double y = function.value(ob.getJD()
                      - zeroPoint);

                  ValidObservation fitOb = new ValidObservation();
                  fitOb.setDateInfo(new DateInfo(ob.getJD()));
                  fitOb.setMagnitude(new Magnitude(y, 0));
                  fitOb.setBand(SeriesType.Model);
                  fitOb.setComments(comment);
                  fit.add(fitOb);

                  ValidObservation resOb = new ValidObservation();
                  resOb.setDateInfo(new DateInfo(ob.getJD()));
                  double residual = ob.getMag() - y;
                  resOb.setMagnitude(new Magnitude(residual,
                      0));
                  resOb.setBand(SeriesType.Residuals);
                  resOb.setComments(comment);
                  residuals.add(resOb);

                  sumSqResiduals += (residual * residual);
                }

 
View Full Code Here


   *      int)
   */
  public Object getValueAt(int rowIndex, int columnIndex) {
    assert columnIndex < COLUMN_COUNT;

    ValidObservation ob = obs.get(rowIndex);

    Object value = null;

    switch (columnIndex) {
    case JD_COLUMN:
      value = NumericPrecisionPrefs.formatTime(ob.getDateInfo()
          .getJulianDay());
      break;
    case CALDATE_COLUMN:
      value = ob.getDateInfo().getCalendarDate();
      break;
    case MEAN_COLUMN:
      // The mean magnitude.
      value = NumericPrecisionPrefs.formatMag(ob.getMagnitude()
          .getMagValue());
      break;
    case STDERR_COLUMN:
      // The standard error of the average.
      value = NumericPrecisionPrefs.formatMag(ob.getMagnitude().getUncertainty());
      break;
    }

    return value;
  }
View Full Code Here

   */
  @Override
  public Object getValueAt(int rowIndex, int columnIndex) {
    assert columnIndex < COLUMN_COUNT;

    ValidObservation ob = obs.get(rowIndex % obs.size());

    Object value = null;

    switch (columnIndex) {
    case PHASE_COLUMN:
      if (rowIndex < obs.size() / 2) {
        value = NumericPrecisionPrefs.formatTime(ob
            .getPreviousCyclePhase());
      } else {
        value = NumericPrecisionPrefs.formatTime(ob.getStandardPhase());
      }
      break;
    case MAG_COLUMN:
      value = NumericPrecisionPrefs.formatMag(ob.getMagnitude()
          .getMagValue());
      break;
    }

    return value;
View Full Code Here

      magStdErrOfMean = 0;
    }

    // Create the mean observation, using an arbitrary observation
    // to obtain the object name.
    ValidObservation observation = new ValidObservation();
    observation.setMagnitude(new Magnitude(magMean, magStdErrOfMean));
    observation.setBand(SeriesType.MEANS);
    observation.setName(observations.get(0).getName());
    timeElementEntity.setTimeElement(observation, timeMean);

    // If bin data array contains only one element, we replace this
    // with a pair since some implementations of ANOVA (e.g. Apache
    // Commons Math) require all sample sizes to be greater than one.
View Full Code Here

        maxIndex = i - 1;

        Bin bin = createMeanObservationForRange(observations,
            timeElementEntity, minIndex, maxIndex);

        ValidObservation ob = bin.getMeanObservation();

        // If the mean magnitude value is NaN (e.g. because
        // there was no valid data in the range in question),
        // it doesn't make sense to include this observation.
        if (!Double.isNaN(ob.getMag())) {
          binnedObs.add(ob);
        }

        minIndex = i;
        minTimeElement = timeElementEntity.getTimeElement(observations,
            i);

        i++;
      }
    }

    // Ensure that if we have reached the end of the observations
    // that we include any left over data that would otherwise be
    // excluded by the less-than constraint?
    if (maxIndex < observations.size() - 1) {
      Bin bin = createMeanObservationForRange(observations,
          timeElementEntity, minIndex, observations.size() - 1);

      ValidObservation ob = bin.getMeanObservation();

      // If the mean magnitude value is NaN (e.g. because
      // there was no valid data in the range in question),
      // it doesn't make sense to include this observation.
      if (!Double.isNaN(ob.getMag())) {
        binnedObs.add(ob);
      }
    }

    return binnedObs;
View Full Code Here

  private Listener<ObservationSelectionMessage> createObservationSelectionListener() {
    final JPanel parent = this;
    return new Listener<ObservationSelectionMessage>() {
      public void update(ObservationSelectionMessage message) {
        if (message.getSource() != parent) {
          ValidObservation ob = message.getObservation();
          Integer rowIndex = obsTableModel
              .getRowIndexFromObservation(ob);
          if (rowIndex != null && rowIndex >= 0) {
            try {
              // Convert to view index!
View Full Code Here

        && !e.getValueIsAdjusting()) {
      int row = obsTable.getSelectedRow();

      if (row >= 0) {
        row = obsTable.convertRowIndexToModel(row);
        ValidObservation ob = obsTableModel.getObs().get(row);
        ObservationSelectionMessage message = new ObservationSelectionMessage(
            ob, this);
        lastObSelected = ob;
        Mediator.getInstance().getObservationSelectionNotifier()
            .notifyListeners(message);
View Full Code Here

  public boolean include(
      javax.swing.RowFilter.Entry<? extends IOrderedObservationSource, ? extends Integer> entry) {

    int id = entry.getIdentifier();
    IOrderedObservationSource model = entry.getModel();
    ValidObservation ob = model.getObservations().get(id);

    SeriesType series = ob.getBand();

    if (ob.isDiscrepant()) {
      series = SeriesType.DISCREPANT;
    } else if (ob.isExcluded()) {
      series = SeriesType.Excluded;
    } else if (ob.getMagnitude().isFainterThan()) {
      series = SeriesType.FAINTER_THAN;
    }

    boolean visible = visibleSeries.contains(series);
View Full Code Here

  @Override
  public boolean include(
      RowFilter.Entry<? extends IOrderedObservationSource, ? extends Integer> entry) {
    int id = entry.getIdentifier();
    IOrderedObservationSource model = entry.getModel();
    ValidObservation ob = model.getObservations().get(id);
    return filteredObsMsg.getFilteredObs().contains(ob);
  }
View Full Code Here

   */
  @Override
  public Object getValueAt(int rowIndex, int columnIndex) {
    assert columnIndex < COLUMN_COUNT;

    ValidObservation ob = obs.get(rowIndex);

    Object value = null;

    switch (columnIndex) {
    case JD_COLUMN:
      value = NumericPrecisionPrefs.formatTime(ob.getDateInfo()
          .getJulianDay());
      break;
    case CALDATE_COLUMN:
      value = ob.getDateInfo().getCalendarDate();
      break;
    case MAG_COLUMN:
      value = NumericPrecisionPrefs.formatMag(ob.getMagnitude()
          .getMagValue());
      break;
    }

    return value;
View Full Code Here

TOP

Related Classes of org.aavso.tools.vstar.data.ValidObservation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.