Package org.aavso.tools.vstar.data

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


  /**
   * @see javax.swing.table.TableModel#getValueAt(int, int)
   */
  public Object getValueAt(int rowIndex, int columnIndex) {
    assert columnIndex < columnCount;
    ValidObservation validOb = this.validObservations.get(rowIndex);
    return this.columnInfoSource.getTableColumnValue(columnIndex, validOb);
  }
View Full Code Here


      // https://sourceforge.net/tracker/?func=detail&aid=2964224&group_id=263306&atid=1152052
      // for more detail.
      if (Mediator.getInstance().getAnalysisType() == AnalysisType.RAW_DATA) {

        // Toggle "is-discrepant" checkbox and value.
        ValidObservation ob = this.validObservations.get(rowIndex);
        boolean discrepant = ob.isDiscrepant();
        ob.setDiscrepant(!discrepant);
        // Tell anyone who's listening about the change.
        DiscrepantObservationMessage message = new DiscrepantObservationMessage(
            ob, this);
        Mediator.getInstance().getDiscrepantObservationNotifier()
            .notifyListeners(message);
View Full Code Here

   * @throws ObservationValidationError
   */
  public ValidObservation validate(String line)
      throws IOException, ObservationValidationError, ObservationValidationWarning {

    ValidObservation observation = super.validate();
   
    // TODO: assert which fields should not be null

    return observation;
  }
View Full Code Here

   *         created from the current record's fields.
   */
  public ValidObservation validate() throws IOException,
      ObservationValidationError, ObservationValidationWarning {

    ValidObservation observation = null;

    // Get an array of fields split on the expected delimiter.
    fields = fieldSplitter.getFields();

    if (fields.length != 0) {
      // Create a new valid observation, making the assumption
      // that validation will pass.
      observation = new ValidObservation();

      // Validate the fields.
      DateInfo dateInfo = julianDayValidator
          .validate(fields[fieldIndexMap.get("JD_FIELD")]);
      observation.setDateInfo(dateInfo);

      Magnitude magnitude = magnitudeFieldValidator
          .validate(fields[fieldIndexMap.get("MAGNITUDE_FIELD")]);

      Double uncertaintyMag = uncertaintyValueValidator
          .validate(fields[fieldIndexMap.get("UNCERTAINTY_FIELD")]);

      if (uncertaintyMag != null) {
        magnitude.setUncertainty(uncertaintyMag);
      }

      if (magnitude.isBrighterThan()) {
        throw new ObservationValidationError(
            "Was '>' intended (brighter than) or '<'?");
      }

      observation.setMagnitude(magnitude);

      if (observation.getBand() == null) {
        observation.setBand(SeriesType.Unspecified);
      }

      observation
          .setObsCode(observerCodeValidator
              .validate(fields[fieldIndexMap
                  .get("OBSERVER_CODE_FIELD")]));

      String valflag = fields[fieldIndexMap.get("VALFLAG_FIELD")];
      observation.setValidationType(valflagValidator.validate(valflag));
    }

    return observation;
  }
View Full Code Here

   * @return The validated ValidObservation object.
   */
  public ValidObservation validate() throws IOException,
      ObservationValidationError, ObservationValidationWarning {

    ValidObservation observation = super.validate();

    // Validate the fields.

    Double hqUncertaintyMag = uncertaintyValueValidator
        .validate(fields[fieldIndexMap.get("HQ_UNCERTAINTY_FIELD")]);
    observation.setHqUncertainty(hqUncertaintyMag);

    // TODO: we should use a specific band validator that returns SeriesType
    String band = nonOptionalFieldValidator.validate(fields[fieldIndexMap
        .get("BAND_FIELD")]);
    observation.setBand(SeriesType.getSeriesFromShortName(band));

    String commentCode = commentCodeValidator.validate(fields[fieldIndexMap
        .get("COMMENT_CODE_FIELD")]);
    observation.setCommentCode(commentCode);

    String compStar1 = compStarValidator.validate(fields[fieldIndexMap
        .get("COMP_STAR_1_FIELD")]);
    observation.setCompStar1(compStar1);

    String compStar2 = compStarValidator.validate(fields[fieldIndexMap
        .get("COMP_STAR_2_FIELD")]);
    observation.setCompStar2(compStar2);

    String charts = optionalFieldValidator.validate(fields[fieldIndexMap
        .get("CHARTS_FIELD")]);
    observation.setCharts(charts);

    String comments = optionalFieldValidator.validate(fields[fieldIndexMap
        .get("COMMENTS_FIELD")]);
    observation.setComments(comments);

    boolean isTransformed = transformedValidator
        .validate(fields[fieldIndexMap.get("TRANSFORMED_FIELD")]);
    observation.setTransformed(isTransformed);

    String airmass = optionalFieldValidator.validate(fields[fieldIndexMap
        .get("AIRMASS_FIELD")]);
    observation.setAirmass(airmass);

    String cMag = cMagValidator.validate(fields[fieldIndexMap
        .get("CMAG_FIELD")]);
    observation.setCMag(cMag);

    String kMag = kMagValidator.validate(fields[fieldIndexMap
        .get("KMAG_FIELD")]);
    observation.setKMag(kMag);

    DateInfo hjdInfo = hjdValidator.validate(fields[fieldIndexMap
        .get("HJD_FIELD")]);
    observation.setHJD(hjdInfo);

    String name = nameFieldValidator.validate(fields[fieldIndexMap
        .get("NAME_FIELD")]);
    observation.setName(name);

    MTypeType mType = magTypeValidator.validate(fields[fieldIndexMap
        .get("MTYPE_FIELD")]);
    if (mType != null) {
      observation.setMType(mType);
    }

    // TODO: add group and affiliation fields and getters

    return observation;
View Full Code Here

  private static final double DEFAULT_BIN_PHASE_INCREMENTS = 0.1;

  public static final PhaseTimeElementEntity instance = new PhaseTimeElementEntity();

  public double getTimeElement(List<ValidObservation> obs, int index) {
    ValidObservation ob = obs.get(index);
    Double phase = null;

    if (index < obs.size() / 2) {
      phase = ob.getPreviousCyclePhase();
    } else {
      phase = ob.getStandardPhase();
    }

    assert phase != null;

    return phase;
View Full Code Here

    // TODO: fix wrt locale
    String comment = "From polynomial fit of degree " + degree;

    for (n = 1; n <= numred; n++) {
      // write(1,222)tfit(n)+dt0,xfit(n),ds9*sfit(n)
      ValidObservation fitOb = new ValidObservation();
      fitOb.setDateInfo(new DateInfo(tfit[n] + dt0));
      // double uncertainty = ds9*sfit[n]; // TODO: ask Matt about this;
      // uncertainty?
      fitOb.setMagnitude(new Magnitude(xfit[n], 0));
      fitOb.setComments(comment);
      fitOb.setBand(SeriesType.Model);
      fit.add(fitOb);
    }

    if (fit.isEmpty()) {
      throw new AlgorithmError("No observations in fit list.");
    }

    // Note: save residuals (to list)

    // 40 write(6,*) 'Residuals filename?'
    // read*,ftmp;
    // 41 open(unit=9,file=ftmp,status='unknown',err=42);
    // 42 write(6,*) 'Could not open file.'

    // Store the residuals resulting from the polynomial fit operation as
    // "residual observations".
    residuals = new ArrayList<ValidObservation>();

    for (n = nlolim; n <= nuplim; n++) {
      if (wvec[n] > 0.0) {
        dtime = tvec[n];
        dx = smooth(dtime);
        res = xvec[n] - dx;
        for (nb = 1; nb <= nbias; nb++) {
          if (obs[n] == obias[nb])
            res = res - dcoef[npoly + nb];
        }
        // write(9,240) tvec(n)+dt0,res
        ValidObservation residualOb = new ValidObservation();
        residualOb.setDateInfo(new DateInfo(tvec[n] + dt0));
        residualOb.setMagnitude(new Magnitude(res, 0));
        residualOb.setComments(comment);
        residualOb.setBand(SeriesType.Residuals);
        residuals.add(residualOb);
      }
    }

    // 211 format(7hTime0= ,f12.4)
View Full Code Here

          String comment = "From WWZ, period "
              + NumericPrecisionPrefs.formatOther(period);

          // Create a fit observation from the average magnitude for
          // this time-frequency/period combination.
          ValidObservation fitOb = new ValidObservation();
          fitOb.setDateInfo(new DateInfo(stat.getTau()));
          fitOb.setMagnitude(new Magnitude(stat.getMave(), 0));
          fitOb.setBand(SeriesType.Model);
          fitOb.setComments(comment);
          fit.add(fitOb);

          // Create a residual observation for each observation since
          // the previous period. TODO: sanity check this approach,
          // i.e. does it actually make sense for a tau value to
          // represent a range of observation time values for the
          // purpose of residual creation?
          while (i < obs.size()
              && obs.get(i).getJD() <= stat.getTau()) {
            double residual = obs.get(i).getMag() - stat.getMave();
            ValidObservation residualOb = new ValidObservation();
            residualOb
                .setDateInfo(new DateInfo(obs.get(i).getJD()));
            residualOb.setMagnitude(new Magnitude(residual, 0));
            residualOb.setBand(SeriesType.Residuals);
            residualOb.setComments(comment);
            residuals.add(residualOb);
            i++;
          }
        }
View Full Code Here

                  minMagErr = magErr;
                } else if (magErr > maxMagErr) {
                  maxMagErr = magErr;
                }

                ValidObservation ob = new ValidObservation();
                ob.setDateInfo(new DateInfo(hjd));
                ob.setMagnitude(new Magnitude(mag, magErr));
                ob.setBand(keplerSeries);
                ob.setRecordNumber(row);
                collectObservation(ob);
              }
            } catch (Exception e) {
              String input = tableHDU.getRow(row).toString();
              String error = e.getLocalizedMessage();
              InvalidObservation ob = new InvalidObservation(
                  input, error);
              ob.setRecordNumber(row);
              addInvalidObservation(ob);
            }
          }
        }
      }
View Full Code Here

                  minMagErr = magErr;
                } else if (magErr > maxMagErr) {
                  maxMagErr = magErr;
                }

                ValidObservation ob = new ValidObservation();
                ob.setDateInfo(new DateInfo(hjd));
                ob.setMagnitude(new Magnitude(mag, magErr));
                ob.setBand(superWaspSeries);
                ob.setRecordNumber(row);
                ob.addDetail("IMAGE_ID", imageId, "Image ID");
                ob.addDetail("CCDX", ccdX + "", "CCD X");
                ob.addDetail("CCDY", ccdY + "", "CCD Y");
                ob.addDetail("FLUX", tamFlux + "", "Flux");
                ob.addDetail("FLUXERR", tamFluxErr + "",
                    "Flux Error");
//                ob.addDetail("FLAG", flag + "", "Flag");
                obs.add(ob);
              }
            } catch (Exception e) {
              String input = tableHDU.getRow(row).toString();
              String error = e.getLocalizedMessage();
              InvalidObservation ob = new InvalidObservation(
                  input, error);
              ob.setRecordNumber(row);
              addInvalidObservation(ob);
            }
          }
        }
      }
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.