Package org.aavso.tools.vstar.util.model

Examples of org.aavso.tools.vstar.util.model.Harmonic


      double period2 = dcdft.getTopHits().get(
          PeriodAnalysisCoordinateType.PERIOD).get(1);
      assertEquals("2.6828", String.format("%1.4f", period2));

      List<Harmonic> harmonics = new ArrayList<Harmonic>();
      harmonics.add(new Harmonic(freq1));
      harmonics.add(new Harmonic(freq2));

      // Specify the expected model parameters (generated by the model
      // creation process).
      List<PeriodFitParameters> expectedParams = new ArrayList<PeriodFitParameters>();
      expectedParams.add(new PeriodFitParameters(new Harmonic(freq1),
          0.1998, -0.1018, -0.1720, 3.9249, 2450446.0));
      expectedParams.add(new PeriodFitParameters(new Harmonic(freq2),
          0.0767, -0.0484, -0.0595, 3.9249, 2450446.0));

      // Drum roll please...
      commonTest(dcdft, harmonics, expectedParams,
          TwoPeriodModelExpectedData.expectedModelData,
View Full Code Here


      double topPeriod = dcdft.getTopHits().get(
          PeriodAnalysisCoordinateType.PERIOD).get(0);
      assertEquals("435.7435", String.format("%1.4f", topPeriod));

      List<Harmonic> harmonics = new ArrayList<Harmonic>();
      harmonics.add(new Harmonic(topFreq));

      // Specify the expected model parameters (generated by the model
      // creation process).
      List<PeriodFitParameters> expectedParams = new ArrayList<PeriodFitParameters>();
      expectedParams.add(new PeriodFitParameters(new Harmonic(topFreq), 1.7075,
          0.5359, 1.6213, 9.7440, 48680.0));

      // Drum roll please...
      commonTest(dcdft, harmonics, expectedParams, expectedModelData,
          expectedResidualData);
View Full Code Here

   *            The data in which to search; assumed to be frequencies.
   * @return A list of harmonic objects.
   */
  protected List<Harmonic> findHarmonics(double freq, List<Double> data) {
    List<Harmonic> harmonics = new ArrayList<Harmonic>();
    harmonics.add(new Harmonic(freq, Harmonic.FUNDAMENTAL));
    int n = Harmonic.FUNDAMENTAL + 1;

    for (int i = 0; i < data.size(); i++) {
      // Try it both ways in case of round-off errors.
      // TODO: could multiply by precision factor, truncate/round and
      // compare after division by n.
      if (data.get(i) / n == freq || data.get(i) == freq * n) {
        harmonics.add(new Harmonic(freq * n, n));
        n++;
      }
    }

    return harmonics;
View Full Code Here

   * @return A harmonic object corresponding to the frequency and harmonic
   *         count selection, or null if the frequency is null.
   */
  public Harmonic getHarmonic() {
    Double frequency = getFrequency();
    return frequency != null ? new Harmonic(frequency,
        getNumberOfHarmonics()) : null;
  }
View Full Code Here

    for (int i = 1; i <= getNumberOfHarmonics(); i++) {
      Double frequency = getFrequency();
      if (frequency == null) {
        return Collections.EMPTY_LIST;
      }
      harmonics.add(new Harmonic(frequency * i, i));
    }

    return harmonics;
  }
View Full Code Here

      int index = harmonicList.getSelectedIndex();
      if (index != -1) {
        int selectedModelIndex = harmonicList.getSelectedIndex();
        String desc = (String) harmonicListModel
            .get(selectedModelIndex);
        Harmonic harmonic = harmonicMap.get(desc);
        plotPane
            .setCrossHair(harmonic.getFrequency(),
                findNthRangeValueFromFrequency(harmonic
                    .getFrequency()));
      }
    }
  }
View Full Code Here

  // with a method that returns a frequency from a sequence. Then
  // List<Double> or List<WWZStatistic> can be wrapped in an object
  // that implements that interface. Then this method can go away.
  protected List<Harmonic> findHarmonicsFromWWZStats(double freq) {
    List<Harmonic> harmonics = new ArrayList<Harmonic>();
    harmonics.add(new Harmonic(freq, Harmonic.FUNDAMENTAL));
    int n = Harmonic.FUNDAMENTAL + 1;

    List<WWZStatistic> data = wwt.getStats();

    for (int i = 0; i < data.size(); i++) {
      double candidateFreq = data.get(i).getFrequency();
      // Try it both ways in case of round-off errors.
      if (candidateFreq / n == freq || candidateFreq == freq * n) {
        harmonics.add(new Harmonic(freq * n, n));
        n++;
      }
    }

    return harmonics;
View Full Code Here

TOP

Related Classes of org.aavso.tools.vstar.util.model.Harmonic

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.