Skip to content

Commit

Permalink
Merge pull request #73 from butala/master
Browse files Browse the repository at this point in the history
Use scipy.signal.correlate for efficiency
  • Loading branch information
cokelaer authored Dec 8, 2024
2 parents 9afb2d7 + 0c81dda commit 822b3df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/spectrum/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"""
import numpy as np
import scipy.signal


__all__ = ['CORRELATION', 'xcorr']
Expand Down Expand Up @@ -208,7 +209,7 @@ def xcorr(x, y=None, maxlags=None, norm='biased'):
assert maxlags <= N, 'maxlags must be less than data length'
lags = np.arange(N-maxlags-1, N+maxlags)

res = np.correlate(x, y, mode='full')
res = scipy.signal.correlate(x, y, mode='full')

if norm == 'biased':
Nf = float(N)
Expand Down

0 comments on commit 822b3df

Please sign in to comment.