Skip to content

Commit

Permalink
window attr of FCDecimation now accessed via stft
Browse files Browse the repository at this point in the history
  • Loading branch information
kkappler committed Jan 4, 2025
1 parent a0a46d1 commit e737ac5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ def __init__(self, **kwargs):
logger.debug(msg)
self.short_time_fourier_transform.per_window_detrend_type = ""

@property
def window(self):
return self.stft.window

def __len__(self) -> int:
return len(self.channels)

Expand Down Expand Up @@ -427,14 +423,14 @@ def is_valid_for_time_series_length(self, n_samples_ts: int) -> bool:
"""
required_num_samples = (
self.window.num_samples
+ (self.stft.min_num_stft_windows - 1) * self.window.num_samples_advance
self.stft.window.num_samples
+ (self.stft.min_num_stft_windows - 1) * self.stft.window.num_samples_advance
)
if n_samples_ts < required_num_samples:
msg = (
f"{n_samples_ts} not enough samples for minimum of "
f"{self.stft.min_num_stft_windows} stft windows of length "
f"{self.window.num_samples} and overlap {self.window.overlap}"
f"{self.stft.window.num_samples} and overlap {self.stft.window.overlap}"
)
self.logger.warning(msg)
return False
Expand All @@ -444,7 +440,7 @@ def is_valid_for_time_series_length(self, n_samples_ts: int) -> bool:
@property
def fft_frequencies(self) -> np.ndarray:
""" Returns the one-sided fft frequencies (without Nyquist)"""
return self.window.fft_harmonics(self.sample_rate)
return self.stft.window.fft_harmonics(self.sample_rate)


def fc_decimations_creator(
Expand Down
2 changes: 1 addition & 1 deletion tests/tf/processing/fcs/test_decimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_update(self):
def test_fft_frequencies(self):
dl1 = self.dl.copy()
freqs = dl1.fft_frequencies
assert (len(freqs) == dl1.window.num_samples/2)
assert (len(freqs) == dl1.stft.window.num_samples/2)


def test_update_with_match(self):
Expand Down

0 comments on commit e737ac5

Please sign in to comment.