Class WeightedWaveletZTransform

java.lang.Object
org.aavso.tools.vstar.util.period.wwz.WeightedWaveletZTransform
All Implemented Interfaces:
IAlgorithm, IInteruptible

public class WeightedWaveletZTransform extends Object implements IAlgorithm

This is a Java translation of the Fortran version of Grant Foster's WWZ algorithm. The original (C) notice from the Fortran code is included below. As per the documentation accompanying the program, written (email) permission was sought, and granted, from the AAVSO Director to use the Fortran code in this way. Note that the comment about maximum data points below does not apply here, since we dynamically allocate the arrays based upon the number of observations.

WEIGHTED WAVELET Z-TRANSFORM This is a fortran version of Grant Foster's WWZ1.1.BAS BASIC program, stripped down for speed and readability improvements. It is modestly less flexible than the basic code (esp regarding varying input file formats), but will be easy to modify to suit your needs. In the event you have more than 100000 data points, you can resize all arrays to meet your needs -- the only limitation is your free memory. (Note that all variables are double precision, though.) A description of the mathematics can be found in G. Foster, "Wavelets for Period Analysis of Unevenly Sampled Time Series", Astronomical Journal 112, 1709 (Oct 1996).
-Matthew Templeton, August 15, 2002

(C) Copyright 1996, 2002 by the American Association of Variable Star Observers; all rights reserved.

  • Constructor Details

    • WeightedWaveletZTransform

      public WeightedWaveletZTransform(List<ValidObservation> observations, double decay, double timeDivisions)
      Constructor
      Parameters:
      observations - The observations over which to perform a period analysis.
      minFreq - The minimum frequency to test.
      maxFreq - The maximum frequency to test.
      deltaFreq - The frequency step.
      decay - The decay constant of the wavelet window. This determines how wide the window is. Smaller values yield wider windows.
      timeDivisions - The number of time divisions.
    • WeightedWaveletZTransform

      public WeightedWaveletZTransform(List<ValidObservation> observations, double timeDivisions)
      Construct a WWZ algorithm object with a default decay value.
      Parameters:
      observations - The observations over which to perform a period analysis.
      timeDivisions - The number of time divisions.
  • Method Details

    • getObs

      public List<ValidObservation> getObs()
      Returns:
      the obs
    • execute

      public void execute() throws AlgorithmError
      Execute the WWZ algorithm on the specified observations with the specified frequency range and window size.
      Specified by:
      execute in interface IAlgorithm
      Throws:
      AlgorithmError - in case of an algorithm error.
    • interrupt

      public void interrupt()
      Description copied from interface: IInteruptible
      Signals that a task has been interrupted.
      Specified by:
      interrupt in interface IInteruptible
    • setThreadCount

      public void setThreadCount(int threadCount)
      Number of threads (cores) to use for WWZ execution.

      This controls threaded WWZ execution. Values are clamped to [1, maxAvailableThreads]. A workload heuristic may still run effectively single-threaded for small jobs.

      Parameters:
      threadCount - desired number of threads/cores
    • getThreadCount

      public int getThreadCount()
      Returns:
      configured number of threads (cores) for WWZ execution.
    • isCancelled

      public boolean isCancelled()
      Returns:
      true if the last execute() call was cancelled/interrupted.
    • getMaxAvailableThreads

      public int getMaxAvailableThreads()
      Returns:
      maximum available threads (cores) detected at runtime.
    • getRecommendedThreadCount

      public static int getRecommendedThreadCount()
      Recommended thread count for UI defaults. This reflects machine capacity; execute() applies a workload heuristic and may still choose fewer threads.
    • getStats

      public List<WWZStatistic> getStats()
      Returns:
      the stats
    • getMaximalStats

      public List<WWZStatistic> getMaximalStats()
      Returns:
      the maximalStats
    • getMaxFreq

      public double getMaxFreq()
      Returns:
      the maximum frequency
    • getMinFreq

      public double getMinFreq()
      Returns:
      the minimum frequency
    • getMinPeriod

      public double getMinPeriod()
      Returns:
      the minPeriod
    • getMaxPeriod

      public double getMaxPeriod()
      Returns:
      the maxPeriod
    • getMinAmp

      public double getMinAmp()
      Returns:
      the minAmp
    • getMaxAmp

      public double getMaxAmp()
      Returns:
      the maxAmp
    • getMinWWZ

      public double getMinWWZ()
      Returns:
      the minWWZ
    • getMaxWWZ

      public double getMaxWWZ()
      Returns:
      the maxWWZ
    • make_freqs_from_freq_range

      public void make_freqs_from_freq_range(double minFreq, double maxFreq, double deltaFreq)
      Create the array of frequencies to test per time period given a frequency range and frequency step.
      Parameters:
      minFreq - The minimum frequency to test.
      maxFreq - The maximum frequency to test.
      deltaFreq - The frequency step with respect to the range.
    • make_freqs_from_period_range

      public void make_freqs_from_period_range(double minPer, double maxPer, double deltaPeriod)
      Create the array of frequencies to test per time period given a period range and period step.
      Parameters:
      minPer - The minimum period to test.
      maxPer - The maximum period to test.
      deltaPeriod - The period step with respect to the range.