MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / test_framing

Function test_framing

numpy_ml/tests/test_preprocessing.py:196–214  ·  view source on GitHub ↗
(N=15)

Source from the content-addressed store, hash-verified

194
195
196def test_framing(N=15):
197 np.random.seed(12345)
198
199 i = 0
200 while i < N:
201 N = np.random.randint(500, 100000)
202 window_len = np.random.randint(10, 100)
203 stride_len = np.random.randint(1, 50)
204 signal = np.random.rand(N)
205
206 mine = to_frames(signal, window_len, stride_len, writeable=False)
207 theirs = frame(signal, frame_length=window_len, hop_length=stride_len).T
208
209 assert len(mine) == len(theirs), "len(mine) = {}, len(theirs) = {}".format(
210 len(mine), len(theirs)
211 )
212 np.testing.assert_almost_equal(mine, theirs)
213 print("PASSED")
214 i += 1
215
216
217def test_dft_bins(N=15):

Callers

nothing calls this directly

Calls 1

to_framesFunction · 0.90

Tested by

no test coverage detected