Mercurial > hg > may
changeset 560:9a40a9eedba7
Better error reporting
author | Chris Cannam |
---|---|
date | Wed, 30 Apr 2014 10:35:13 +0100 |
parents | ab85dfc45e3f |
children | c5afeb185539 |
files | src/may/matrix.yeti src/may/stream/framer.yeti src/may/transform/fft.yeti |
diffstat | 3 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/may/matrix.yeti Sat Apr 05 16:02:24 2014 +0100 +++ b/src/may/matrix.yeti Wed Apr 30 10:35:13 2014 +0100 @@ -132,6 +132,7 @@ //!!! better as getXx or just xx? +//!!! arguably getRow, getColumn, getDiagonal should have m as first arg for symmetry with at getColumn j m = case m.data of DenseCols cols: cols[j];
--- a/src/may/stream/framer.yeti Sat Apr 05 16:02:24 2014 +0100 +++ b/src/may/stream/framer.yeti Wed Apr 30 10:35:13 2014 +0100 @@ -234,6 +234,7 @@ Hop h: hop := h; Padded p: padded := p; Window w: winopt := Some w; + FrequencyDomain f: failWith "Cannot stream from real input with FrequencyDomain true (need to use complexStreamed)"; esac; window = case winopt of @@ -253,6 +254,7 @@ streamOverlapping rate { framesize, hop, window } frames; fi); +//!!! todo: this is not yet tested complexStreamed rate framesize options frames = (streamOptions = array []; var rowTransform = complex.magnitudes; @@ -282,7 +284,7 @@ overlapAdd, - streamed, - complexStreamed, + streamed is number -> number -> list?<opt_t> -> list<mat.matrix_t> -> stream_t, + complexStreamed is number -> number -> list?<opt_t> -> list<cm.complexmatrix_t> -> stream_t, }
--- a/src/may/transform/fft.yeti Sat Apr 05 16:02:24 2014 +0100 +++ b/src/may/transform/fft.yeti Wed Apr 30 10:35:13 2014 +0100 @@ -71,12 +71,17 @@ realForwardMagnitude n = complex.magnitudes . (realForward n); -//!!! doc: input requires n/2+1 complex values (or should test and throw?) +//!!! doc: input requires n/2+1 complex values //!!! doc: powers of two only? check with jtransforms +//!!! this function fails if the input is the wrong length (and that is the right thing to do I think) but the other functions just resize it. Should they fail too? realInverse n = (d = new DoubleFFT_1D(n); do cplx: - arr = complexToPacked (array cplx); + carr = array cplx; + if length carr != 1 + int (n/2) then + failWith "Complex-to-real inverse FFT of size \(n) expects \(1 + int (n/2)) complex values as input (DC to Nyquist only), not \(length carr) as supplied"; + fi; + arr = complexToPacked carr; d#realInverse(arr, true); vec.vector arr; done);