Create a vector thdnm from THD calculation, e.g. thd11
New vector fournosave: if set, suppress creation of vectors thd11 and fourier, usefull when writing a raw file.
This commit is contained in:
parent
83d3890490
commit
16fbe0fb8b
|
|
@ -50,6 +50,7 @@ fourier(wordlist *wl, struct plot *current_plot)
|
||||||
char xbuf[20];
|
char xbuf[20];
|
||||||
int shift;
|
int shift;
|
||||||
int rv = 1;
|
int rv = 1;
|
||||||
|
bool foursave = TRUE;
|
||||||
|
|
||||||
struct dvec *n;
|
struct dvec *n;
|
||||||
int newveccount = 1;
|
int newveccount = 1;
|
||||||
|
|
@ -71,6 +72,8 @@ fourier(wordlist *wl, struct plot *current_plot)
|
||||||
polydegree = 1;
|
polydegree = 1;
|
||||||
if (!cp_getvar("fourgridsize", CP_NUM, &fourgridsize, 0) || fourgridsize < 1)
|
if (!cp_getvar("fourgridsize", CP_NUM, &fourgridsize, 0) || fourgridsize < 1)
|
||||||
fourgridsize = DEF_FOURGRIDSIZE;
|
fourgridsize = DEF_FOURGRIDSIZE;
|
||||||
|
if (cp_getvar("fournosave", CP_BOOL, NULL, 0))
|
||||||
|
foursave = FALSE;
|
||||||
|
|
||||||
time = current_plot->pl_scale;
|
time = current_plot->pl_scale;
|
||||||
if (!isreal(time)) {
|
if (!isreal(time)) {
|
||||||
|
|
@ -188,6 +191,19 @@ fourier(wordlist *wl, struct plot *current_plot)
|
||||||
}
|
}
|
||||||
fputs("\n", cp_out);
|
fputs("\n", cp_out);
|
||||||
|
|
||||||
|
if (foursave) {
|
||||||
|
/* create a vector for THD */
|
||||||
|
n = dvec_alloc(tprintf("thd%d%d", callstof, newveccount),
|
||||||
|
SV_NOTYPE,
|
||||||
|
VF_REAL | VF_PERMANENT,
|
||||||
|
1, NULL);
|
||||||
|
|
||||||
|
n->v_numdims = 1;
|
||||||
|
|
||||||
|
vec_new(n);
|
||||||
|
|
||||||
|
n->v_realdata[0] = thd;
|
||||||
|
|
||||||
/* create and assign a new vector n */
|
/* create and assign a new vector n */
|
||||||
/* with size 3 * nfreqs in current plot */
|
/* with size 3 * nfreqs in current plot */
|
||||||
/* generate name for new vector, using vec->name */
|
/* generate name for new vector, using vec->name */
|
||||||
|
|
@ -218,6 +234,7 @@ fourier(wordlist *wl, struct plot *current_plot)
|
||||||
data = NULL;
|
data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
callstof++;
|
callstof++;
|
||||||
rv = 0;
|
rv = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue