test_class.file: legacy/src/test/java/macrobase/analysis/stats/AutocorrelationTest.java
test_class.identifier: AutocorrelationTest
test_case.body: @Test
      public void testFindPeak() throws Exception {
          double[] test_correlations = {0, 0.9, 0.6, 0.7, 0.8, 0.5, 0, 0.1, 0.2, -0.5, -0.1, 0, -0.5, 0.8, 0, 0.8, 0.7, 0.6, 0.5, 0.4, 0.5};
          Autocorrelation acf = new Autocorrelation(test_correlations.length, 0);
          acf.correlations = new double[test_correlations.length];
          for (int i = 0; i < test_correlations.length; i ++) { acf.correlations[i] = test_correlations[i]; }
          List<Integer> peaks = acf.findPeaks();
          int[] expected_peaks = {4, 13, 15};
          assertEquals(expected_peaks.length, peaks.size());
          for (int i = 0; i < peaks.size(); i ++) {
              assertTrue(expected_peaks[i] == peaks.get(i));
          }
      }
test_case.class_method_signature: AutocorrelationTest.testFindPeak()
test_case.full_signature: @Test public void testFindPeak()
test_case.identifier: testFindPeak
test_case.invocations: findPeaks assertEquals size size assertTrue get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFindPeak()
focal_class.declarator: correlations
focal_class.modifier: public
focal_class.original_string: public double[] correlations;
focal_class.type: double[]
focal_class.var_name: correlations
focal_class.declarator: maxACF = 0
focal_class.modifier: public
focal_class.original_string: public double maxACF = 0;
focal_class.type: double
focal_class.var_name: maxACF
focal_class.declarator: fftTran = new FastFourierTransformer(DftNormalization.STANDARD)
focal_class.modifier: private
focal_class.original_string: private FastFourierTransformer fftTran = new FastFourierTransformer(DftNormalization.STANDARD);
focal_class.type: FastFourierTransformer
focal_class.var_name: fftTran
focal_class.declarator: ACF_THRESH = 0.2
focal_class.modifier: private
focal_class.original_string: private double ACF_THRESH = 0.2;
focal_class.type: double
focal_class.var_name: ACF_THRESH
focal_class.declarator: metricIdx = 1
focal_class.modifier: private
focal_class.original_string: private int metricIdx = 1;
focal_class.type: int
focal_class.var_name: metricIdx
focal_class.declarator: maxLag
focal_class.modifier: private
focal_class.original_string: private int maxLag;
focal_class.type: int
focal_class.var_name: maxLag
focal_class.file: legacy/src/main/java/macrobase/analysis/stats/Autocorrelation.java
focal_class.identifier: Autocorrelation
focal_class.class_method_signature: Autocorrelation.Autocorrelation(int maxLag, int metricIdx)
focal_class.full_signature: public  Autocorrelation(int maxLag, int metricIdx)
focal_class.identifier: Autocorrelation
focal_class.modifiers: public
focal_class.parameters: (int maxLag, int metricIdx)
focal_class.signature:  Autocorrelation(int maxLag, int metricIdx)
focal_class.class_method_signature: Autocorrelation.setMaxLag(int lag)
focal_class.full_signature: public void setMaxLag(int lag)
focal_class.identifier: setMaxLag
focal_class.modifiers: public
focal_class.parameters: (int lag)
focal_class.return: void
focal_class.signature: void setMaxLag(int lag)
focal_class.class_method_signature: Autocorrelation.setCorrelationThreshold(double thresh)
focal_class.full_signature: public void setCorrelationThreshold(double thresh)
focal_class.identifier: setCorrelationThreshold
focal_class.modifiers: public
focal_class.parameters: (double thresh)
focal_class.return: void
focal_class.signature: void setCorrelationThreshold(double thresh)
focal_class.class_method_signature: Autocorrelation.mean(double[] metrics)
focal_class.full_signature: private double mean(double[] metrics)
focal_class.identifier: mean
focal_class.modifiers: private
focal_class.parameters: (double[] metrics)
focal_class.return: double
focal_class.signature: double mean(double[] metrics)
focal_class.class_method_signature: Autocorrelation.stripDatum(List<Datum> datum)
focal_class.full_signature: private double[] stripDatum(List<Datum> datum)
focal_class.identifier: stripDatum
focal_class.modifiers: private
focal_class.parameters: (List<Datum> datum)
focal_class.return: double[]
focal_class.signature: double[] stripDatum(List<Datum> datum)
focal_class.class_method_signature: Autocorrelation.formatData(List<Datum> data)
focal_class.full_signature: private double[] formatData(List<Datum> data)
focal_class.identifier: formatData
focal_class.modifiers: private
focal_class.parameters: (List<Datum> data)
focal_class.return: double[]
focal_class.signature: double[] formatData(List<Datum> data)
focal_class.class_method_signature: Autocorrelation.evaluate(List<Datum> data)
focal_class.full_signature: public void evaluate(List<Datum> data)
focal_class.identifier: evaluate
focal_class.modifiers: public
focal_class.parameters: (List<Datum> data)
focal_class.return: void
focal_class.signature: void evaluate(List<Datum> data)
focal_class.class_method_signature: Autocorrelation.findPeaks()
focal_class.full_signature: public List<Integer> findPeaks()
focal_class.identifier: findPeaks
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Integer>
focal_class.signature: List<Integer> findPeaks()
focal_method.body: public List<Integer> findPeaks() {
          List<Integer> peaks = new ArrayList<>();
          int max = 1;
          maxACF = 0;
          if (correlations.length > 1) {
              boolean positive = (correlations[1] > correlations[0]);
              for (int i = 2; i < correlations.length; i++) {
                  if (!positive && correlations[i] > correlations[i - 1]) {
                      max = i;
                      positive = !positive;
                  } else if (positive && correlations[i] > correlations[max]) {
                      max = i;
                  } else if (positive && correlations[i] < correlations[i - 1]) {
                      if (max > 1 && correlations[max] > ACF_THRESH) {
                          peaks.add(max);
                          if (correlations[max] > maxACF) { maxACF = correlations[max]; }
                      }
                      positive = !positive;
                  }
              }
          }
          return peaks;
      }
focal_method.class_method_signature: Autocorrelation.findPeaks()
focal_method.full_signature: public List<Integer> findPeaks()
focal_method.identifier: findPeaks
focal_method.invocations: add
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: List<Integer>
focal_method.signature: List<Integer> findPeaks()