Package org.aavso.tools.vstar.data

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


   
    List<ValidObservation> observations = new ArrayList<ValidObservation>();
   
    for (int i=0;i < mags.length;i++) {
      ValidObservation obs = new ValidObservation();
      obs.setMagnitude(new Magnitude(mags[i], MagnitudeModifier.NO_DELTA,
          false));
      obs.setDateInfo(new DateInfo(jds[i]));
      observations.add(obs);
    }
View Full Code Here


  private List<ValidObservation> populateObservations(double[] mags) {
    double jd = 0;
    List<ValidObservation> observations = new ArrayList<ValidObservation>();
    for (double mag : mags) {
      ValidObservation obs = new ValidObservation();
      obs.setMagnitude(new Magnitude(mag, MagnitudeModifier.NO_DELTA,
          false));
      obs.setDateInfo(new DateInfo(jd));
      observations.add(obs);
      jd += 0.5;
    }
View Full Code Here

    List<ValidObservation> observations = new ArrayList<ValidObservation>();

    for (int i = 0; i < times.length; i++) {
      ValidObservation obs = new ValidObservation();
      obs.setMagnitude(new Magnitude(mags[i], MagnitudeModifier.NO_DELTA,
          false));
      obs.setDateInfo(new DateInfo(times[i]));
      observations.add(obs);
    }
View Full Code Here

    super(name);
    this.obs = new ArrayList<ValidObservation>();
    for (double[] jdAndMag : jdAndMagPairs) {
      ValidObservation ob = new ValidObservation();
      ob.setDateInfo(new DateInfo(jdAndMag[0]));
      ob.setMagnitude(new Magnitude(jdAndMag[1], 0));
      obs.add(ob);
    }
  }
View Full Code Here

                  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);
View Full Code Here

    }

    // 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
View Full Code Here

    boolean isUncertain = source.getInt("uncertain") != 0;

    Double uncertainty = getNextPossiblyNullDouble("uncertainty");

    return new Magnitude(source.getDouble("magnitude"), modifier,
        isUncertain, uncertainty != null ? uncertainty : 0);
  }
View Full Code Here

          double mag = Double.parseDouble(fields[1]);
          double error = Double.parseDouble(fields[2]);

          ValidObservation ob = new ValidObservation();
          ob.setDateInfo(new DateInfo(jd));
          ob.setMagnitude(new Magnitude(mag, error));
          ob.setBand(series);
          ob.setRecordNumber(reader.getLineNumber());
          collectObservation(ob);
        }
View Full Code Here

        // Create model and residual "observations".

        ValidObservation modelOb = new ValidObservation();
        modelOb.setDateInfo(new DateInfo(tt + dt0));
        modelOb.setMagnitude(new Magnitude(xm, 0));
        modelOb.setComments(model.getDescription());
        modelOb.setBand(SeriesType.Model);
        modelObs.add(modelOb);

        ValidObservation residualOb = new ValidObservation();
        residualOb.setDateInfo(new DateInfo(tt + dt0));
        residualOb.setMagnitude(new Magnitude(resid, 0));
        residualOb.setComments(model.getDescription());
        residualOb.setBand(SeriesType.Residuals);
        residualObs.add(residualOb);

        // }
View Full Code Here

    this.magnitudeValueValidator = new MagnitudeValueValidator(
        new InclusiveRangePredicate(-10, 25));
  }

  public Magnitude validate(String str) throws ObservationValidationError {
    Magnitude mag = null;

    String[] fields = this.regexValidator.validate(str);

    // Here we determine the parts present in the magnitude field.
    // The magnitude value itself is non-optional whereas the magnitude
    // modifier (fainter/brighter-than) and uncertainty parts are both
    // optional, so we test for combinations of these two optional parts.

    double magnitude = this.magnitudeValueValidator
        .validate(fields[MAG_INDEX]);

    if (fields[MAG_MODIFIER_INDEX] != null
        && fields[UNCERTAINTY_INDEX] != null) {
      // All 3 parts are present.
      mag = new Magnitude(magnitude,
          getMagModValue(fields[MAG_MODIFIER_INDEX]),
          Magnitude.IS_UNCERTAIN);
    } else if (fields[MAG_MODIFIER_INDEX] != null
        && fields[UNCERTAINTY_INDEX] == null) {
      // Magnitude modifier and magnitude parts are present.
      mag = new Magnitude(magnitude,
          getMagModValue(fields[MAG_MODIFIER_INDEX]),
          !Magnitude.IS_UNCERTAIN);
    } else if (fields[MAG_MODIFIER_INDEX] == null
        && fields[UNCERTAINTY_INDEX] != null) {
      // Magnitude and uncertainty parts are present.
      mag = new Magnitude(magnitude, MagnitudeModifier.NO_DELTA,
          Magnitude.IS_UNCERTAIN);
    } else if (fields[MAG_MODIFIER_INDEX] == null
        && fields[UNCERTAINTY_INDEX] == null) {
      // Only the magnitude part is present.
      mag = new Magnitude(magnitude, MagnitudeModifier.NO_DELTA,
          !Magnitude.IS_UNCERTAIN);
    }

    return mag;
  }
View Full Code Here

TOP

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

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.