From 38ad8f760261c330d5fe0c7f43fb9cdd19cf3394 Mon Sep 17 00:00:00 2001 From: dwarning Date: Mon, 2 Dec 2013 22:08:30 +0100 Subject: [PATCH] com_fft.c, rename variable `tlen' --> `length' --- src/frontend/com_fft.c | 78 +++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/frontend/com_fft.c b/src/frontend/com_fft.c index d2232742d..0704dc85f 100644 --- a/src/frontend/com_fft.c +++ b/src/frontend/com_fft.c @@ -30,7 +30,7 @@ com_fft(wordlist *wl) double **tdvec = NULL; double *freq, *win = NULL, *time; double span; - int fpts, i, j, tlen, ngood; + int fpts, i, j, length, ngood; struct dvec *f, *vlist, *lv = NULL, *vec; struct pnode *pn, *names = NULL; char window[BSIZE_SP]; @@ -57,25 +57,25 @@ com_fft(wordlist *wl) goto done; } - tlen = (plot_cur->pl_scale)->v_length; + length = (plot_cur->pl_scale)->v_length; time = (plot_cur->pl_scale)->v_realdata; - span = time[tlen-1] - time[0]; + span = time[length-1] - time[0]; #ifdef HAVE_LIBFFTW3 - fpts = tlen/2 + 1; + fpts = length/2 + 1; #else /* size of fft input vector is power of two and larger or equal than spice vector */ N = 1; M = 0; - while (N < tlen) { + while (N < length) { N <<= 1; M++; } fpts = N/2 + 1; #endif - win = TMALLOC(double, tlen); - maxt = time[tlen-1]; + win = TMALLOC(double, length); + maxt = time[length-1]; if (!cp_getvar("specwindow", CP_STRING, window)) strcpy(window, "blackman"); if (!cp_getvar("specwindoworder", CP_NUM, &order)) @@ -83,7 +83,7 @@ com_fft(wordlist *wl) if (order < 2) order = 2; - if (fft_windows(window, win, time, tlen, maxt, span, order) == 0) + if (fft_windows(window, win, time, length, maxt, span, order) == 0) goto done; names = ft_getpnames(wl, TRUE); @@ -93,9 +93,9 @@ com_fft(wordlist *wl) vec = ft_evaluate(pn); for (; vec; vec = vec->v_link2) { - if (vec->v_length != tlen) { + if (vec->v_length != length) { fprintf(cp_err, "Error: lengths of %s vectors don't match: %d, %d\n", - vec->v_name, vec->v_length, tlen); + vec->v_name, vec->v_length, length); continue; } @@ -142,7 +142,7 @@ com_fft(wordlist *wl) #ifdef HAVE_LIBFFTW3 freq[i] = i*1.0/span; #else - freq[i] = i*1.0/span*tlen/N; + freq[i] = i*1.0/span*length/N; #endif tdvec = TMALLOC(double *, ngood); @@ -163,22 +163,22 @@ com_fft(wordlist *wl) #ifdef HAVE_LIBFFTW3 - printf("FFT: Time span: %g s, input length: %d\n", span, tlen); + printf("FFT: Time span: %g s, input length: %d\n", span, length); printf("FFT: Frequency resolution: %g Hz, output length: %d\n", 1.0/span, fpts); for (i = 0; ipl_scale)->v_length; + length = (plot_cur->pl_scale)->v_length; time = (plot_cur->pl_scale)->v_realdata; - span = time[tlen-1] - time[0]; + span = time[length-1] - time[0]; // get filter length from parameter input s = wl->wl_word; @@ -288,20 +288,20 @@ com_psd(wordlist *wl) wl = wl->wl_next; #ifdef HAVE_LIBFFTW3 - fpts = tlen/2 + 1; + fpts = length/2 + 1; #else /* size of fft input vector is power of two and larger or equal than spice vector */ N = 1; M = 0; - while (N < tlen) { + while (N < length) { N <<= 1; M++; } fpts = N/2 + 1; #endif - win = TMALLOC(double, tlen); - maxt = time[tlen-1]; + win = TMALLOC(double, length); + maxt = time[length-1]; if (!cp_getvar("specwindow", CP_STRING, window)) strcpy(window, "blackman"); if (!cp_getvar("specwindoworder", CP_NUM, &order)) @@ -309,7 +309,7 @@ com_psd(wordlist *wl) if (order < 2) order = 2; - if (fft_windows(window, win, time, tlen, maxt, span, order) == 0) + if (fft_windows(window, win, time, length, maxt, span, order) == 0) goto done; names = ft_getpnames(wl, TRUE); @@ -319,9 +319,9 @@ com_psd(wordlist *wl) vec = ft_evaluate(pn); for (; vec; vec = vec->v_link2) { - if (vec->v_length != (int)tlen) { + if (vec->v_length != (int)length) { fprintf(cp_err, "Error: lengths of %s vectors don't match: %d, %d\n", - vec->v_name, vec->v_length, tlen); + vec->v_name, vec->v_length, length); continue; } @@ -369,7 +369,7 @@ com_psd(wordlist *wl) freq[i] = i*1./span; #else for (i = 0; i <= fpts; i++) - freq[i] = i*1./span*tlen/N; + freq[i] = i*1./span*length/N; #endif tdvec = TMALLOC(double*, ngood); @@ -390,26 +390,26 @@ com_psd(wordlist *wl) #ifdef HAVE_LIBFFTW3 - printf("PSD: Time span: %g s, input length: %d\n", span, tlen); + printf("PSD: Time span: %g s, input length: %d\n", span, length); printf("PSD: Frequency resolution: %g Hz, output length: %d\n", 1.0/span, fpts); reald = TMALLOC(double, fpts); - in = fftw_malloc(sizeof(double) * (unsigned int) tlen); + in = fftw_malloc(sizeof(double) * (unsigned int) length); out = fftw_malloc(sizeof(fftw_complex) * (unsigned int) fpts); for (i = 0; i