#!/usr/bin/env python

import matplotlib.pyplot as plt
import numpy as np

import rapidtide.correlate as tide_corr
import rapidtide.miscmath as tide_math

arrlen = 1024
dsfac = 8

origvec = np.random.rand(arrlen)

thealiasedcorrelator = tide_corr.AliasedCorrelator(origvec, 1.0, dsfac, None)
normorig = tide_math.corrnormalize(origvec)
thecorr = tide_corr.fastcorrelate(normorig, normorig)
plt.plot(thecorr)
for offset in range(dsfac):
    print(offset)
    dsvec = origvec[offset::dsfac]
    thecorr = thealiasedcorrelator.apply(dsvec, offset, debug=True)
    plt.plot(thecorr)

plt.show()
