[Kst] branches/work/kst/portto4/kst/src/libkstmath
Barth Netterfield
netterfield at astro.utoronto.ca
Thu Jul 12 16:09:00 UTC 2012
SVN commit 1305486 by netterfield:
PSDs now update when in average mode with count-from-end vectors (they
already updated in other cases). This is a critical bug fix!
M +8 -4 psd.cpp
M +1 -0 psd.h
--- branches/work/kst/portto4/kst/src/libkstmath/psd.cpp #1305485:1305486
@@ -99,6 +99,7 @@
_last_n_subsets = 0;
_last_n_new = 0;
+ _last_n_new = 0;
_PSDLength = 1;
@@ -124,7 +125,6 @@
void PSD::internalUpdate() {
-
writeLockInputsAndOutputs();
VectorPtr iv = _inputVectors[INVECTOR];
@@ -134,15 +134,18 @@
_last_n_new += iv->numNew();
assert(_last_n_new >= 0);
- int n_subsets = v_len/_PSDLength;
+ int n_subsets = (v_len)/_PSDLength;
// determine if the PSD needs to be updated.
// if not using averaging, then we need at least _PSDLength/16 new data points.
// if averaging, then we want enough new data for a complete subset.
- if ( ((_last_n_new < _PSDLength/16) || (_Average && (n_subsets - _last_n_subsets < 1))) &&
+ // ... unless we are counting from end at fixed length (scrolling data).
+ bool scrolling_data = (_last_n == iv->length());
+ if ( ((_last_n_new < _PSDLength/16) ||
+ (_Average && scrolling_data && (_last_n_new < _PSDLength/16)) ||
+ (_Average && !scrolling_data && (n_subsets - _last_n_subsets < 1))) &&
iv->length() != iv->numNew()) {
unlockInputsAndOutputs();
-
return;
}
@@ -161,6 +164,7 @@
_last_n_subsets = n_subsets;
_last_n_new = 0;
+ _last_n = iv->length();
updateVectorLabels();
--- branches/work/kst/portto4/kst/src/libkstmath/psd.h #1305485:1305486
@@ -121,6 +121,7 @@
PSDType _prevOutput;
int _last_n_subsets;
int _last_n_new;
+ int _last_n;
double _Frequency;
int _PSDLength;
More information about the Kst
mailing list