Skip to content

Commit

Permalink
Refactor torch_coherence function to include linear detrend option
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieHakim committed Apr 17, 2024
1 parent e671a6f commit a89c12d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bnpm/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,9 @@ def detrend_constant(y, axis):
y = y - torch.mean(y, axis=axis, keepdim=True)
return y

X_linearDetrendPrep = torch.ones(nfft, 2, dtype=y.dtype, device=y.device)
X_linearDetrendPrep[:, 1] = torch.arange(nfft, dtype=y.dtype, device=y.device)
if detrend == 'linear':
X_linearDetrendPrep = torch.ones(nfft, 2, dtype=y.dtype, device=y.device)
X_linearDetrendPrep[:, 1] = torch.arange(nfft, dtype=y.dtype, device=y.device)
def detrend_linear(y, axis):
"""
Uses least squares approach to remove linear trend.
Expand Down

0 comments on commit a89c12d

Please sign in to comment.