Skip to content

Commit

Permalink
Small bugfix related to the size of x and t, which necessarily need t…
Browse files Browse the repository at this point in the history
…o be equal
  • Loading branch information
DetectiveKiwi committed Jun 30, 2024
1 parent 387cbab commit 178d4d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nsdmd/nsdmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def __init__(
self.filter_options[key] = filter_options[key]

def fit(self, x, t, sr, initial_freq_guess=None):
assert x.shape[1]==len(t), "Shape of x and t do not match."
self.fit_opt(x, t, sr, initial_freq_guess=initial_freq_guess)
if self.bandpass is not None:
x = x[:,self.bandpass_trim:self.bandpass_trim+self.windows_[-1,0]+self.opt_win]
Expand All @@ -189,6 +190,7 @@ def fit(self, x, t, sr, initial_freq_guess=None):
return self

def fit_opt(self, x, t, sr, initial_freq_guess=None):
assert x.shape[1]==len(t), "Shape of x and t do not match."
if self.verbose:
print("Starting OPT-DMD...")

Expand All @@ -214,6 +216,7 @@ def set_opt_values(self, freqs, phis, windows, offsets):
return self

def fit_reduction(self, x, t_len, sr):
assert x.shape[1]==t_len, "Shape of x and t do not match."
if self.verbose:
print("Gathering modes...")
group_idx = group_by_similarity(
Expand Down Expand Up @@ -295,6 +298,7 @@ def fit_reduction(self, x, t_len, sr):
return self

def fit_f(self, x, t_len, sr, idx_num):
assert x.shape[1]==t_len, "Shape of x and t do not match."
if np.any(self.num_modes_ == idx_num):
self.idx_hat_ = self.idx_red_[
np.argwhere(self.num_modes_ == idx_num)[-1, 0]
Expand Down

0 comments on commit 178d4d9

Please sign in to comment.