Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
ssolson committed Jan 15, 2024
1 parent fd9f9c3 commit 6e3d11a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
9 changes: 3 additions & 6 deletions mhkit/tests/dolfyn/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ def test_fft_frequency(self):
assert_equal(len(freq_full), nfft)

# Check symmetry of positive and negative frequencies, ignoring the zero frequency
positive_freqs = freq_full[1:int(nfft / 2)]
negative_freqs = freq_full[int(nfft / 2) + 1:]
positive_freqs = freq_full[1 : int(nfft / 2)]
negative_freqs = freq_full[int(nfft / 2) + 1 :]
assert_allclose(positive_freqs, -negative_freqs[::-1])

# Test for half frequency range
freq_half = tools.fft.fft_frequency(nfft, fs, full=False)
freq_half = tools.fft.fft_frequency(nfft, fs, full=False)
assert_equal(len(freq_half), int(nfft / 2) - 1)
# TODO Fix based on james response
# assert_allclose(freq_half, positive_freqs) # Ignore the zero frequency
Expand Down Expand Up @@ -316,20 +316,17 @@ def test_cpsd_quasisync_1D(self):
cpsd = tools.fft.cpsd_quasisync_1D(a, b, nfft, fs)
self.assertEqual(cpsd.shape, (nfft // 2,))


# Test with signals of different lengths
a = np.random.normal(0, 1, 1500)
b = np.random.normal(0, 1, 1000)
cpsd = tools.fft.cpsd_quasisync_1D(a, b, nfft, fs)
self.assertEqual(cpsd.shape, (nfft // 2,))


# Test with different window types
for window in [None, 1, "hann"]:
cpsd = tools.fft.cpsd_quasisync_1D(a, b, nfft, fs, window=window)
self.assertEqual(cpsd.shape, (nfft // 2,))


# Test with a custom window
# TODO Fix based on james response
# custom_window = np.hamming(nfft)
Expand Down
1 change: 0 additions & 1 deletion mhkit/tests/river/test_io_d3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def test_convert_time_from_tidal(self):
seconds_run_expected = 120
self.assertEqual(seconds_run, seconds_run_expected)


def test_layer_data(self):
data = self.d3d_flume_data
variable = ["ucx", "s1"]
Expand Down
1 change: 0 additions & 1 deletion mhkit/tests/river/test_io_usgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class TestIO(unittest.TestCase):
def setUpClass(self):
pass


@classmethod
def tearDownClass(self):
pass
Expand Down

0 comments on commit 6e3d11a

Please sign in to comment.