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

Function __DCT2

numpy_ml/preprocessing/dsp.py:212–221  ·  view source on GitHub ↗

Currently broken

(frame)

Source from the content-addressed store, hash-verified

210
211
212def __DCT2(frame):
213 """Currently broken"""
214 N = len(frame) # window length
215
216 k = np.arange(N, dtype=float)
217 F = k.reshape(1, -1) * k.reshape(-1, 1)
218 K = np.divide(F, k, out=np.zeros_like(F), where=F != 0)
219
220 FC = np.cos(F * np.pi / N + K * np.pi / 2 * N)
221 return 2 * (FC @ frame)
222
223
224def DFT(frame, positive_only=True):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected