Package org.aavso.tools.vstar.data

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


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


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

          // 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

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

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

      double magErr = Double.parseDouble(fields[2].trim());
      String flags = fields[3];

      ValidObservation ob = new ValidObservation();
      ob.setDateInfo(new DateInfo(jd));
      ob.setMagnitude(new Magnitude(mag, magErr));
      ob.setBand(series);
      ob.setRecordNumber(lineNum);
      ob.addDetail("FLAGS", flags, "Flags");
      collectObservation(ob);
    }
View Full Code Here

        SeriesType newType = type;

        List<ValidObservation> newObs = new ArrayList<ValidObservation>(
            obs);
        for (ValidObservation newOb : newObs) {
          Magnitude newMag = new Magnitude(newOb.getMag() + magDelta,
              newOb.getMagnitude().getUncertainty());
          newOb.setMagnitude(newMag);
        }

        SeriesCreationMessage msg = new SeriesCreationMessage(this,
View Full Code Here

    }

    private Magnitude getMag(Matcher magMatcher)
        throws ObservationValidationError {
      String magStr = magMatcher.group(1);
      Magnitude mag = magValidator.validate(magStr);

      // For magnitudes without a decimal point, divide by 10.
      if (!magStr.contains(".")) {
        MagnitudeModifier modifier = null;

        // Note: This shows that we need to be able to set all fields of
        // a Magnitude object for convenience and to reduce the number
        // of objects created.
        if (mag.isFainterThan()) {
          modifier = MagnitudeModifier.FAINTER_THAN;
        } else if (mag.isBrighterThan()) {
          modifier = MagnitudeModifier.BRIGHTER_THAN;
        } else {
          modifier = MagnitudeModifier.NO_DELTA;
        }

        mag = new Magnitude(mag.getMagValue() / 10, modifier, mag
            .isUncertain(), mag.getUncertainty());
      }

      return mag;
    }
View Full Code Here

      double magErr = Double.parseDouble(fields[2].trim());
      String flags = fields[3].trim();

      ValidObservation ob = new ValidObservation();
      ob.setDateInfo(new DateInfo(bjd));
      ob.setMagnitude(new Magnitude(mag, magErr));
      ob.setBand(series);
      ob.setRecordNumber(lineNum);
      ob.addDetail("FLAGS", flags, "Flags");
      collectObservation(ob);
    }
View Full Code Here

        double uncertainty = 0;

        ValidObservation ob = new ValidObservation();
        ob.setName("Cosine plus Noise");
        ob.setDateInfo(new DateInfo(jdBase + i));
        ob.setMagnitude(new Magnitude(mag, uncertainty));
        ob.setBand(Math.random() < 0.5 ? SeriesType.Visual
            : SeriesType.Johnson_V);
        ob.setRecordNumber(i);

        collectObservation(ob);
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.