[Kst] kdeextragear-2/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Jul 6 04:39:33 CEST 2004
CVS commit by netterfield:
Make psd averaging/no-averaging work, and set averaging to the default.
M +2 -5 fftoptionswidget.ui 1.5
M +38 -21 kstpsdcurve.cpp 1.31
M +3 -2 kstpsdcurve.h 1.19
M +2 -1 main.cpp 1.67
--- kdeextragear-2/kst/kst/fftoptionswidget.ui #1.4:1.5
@@ -1,3 +1,3 @@
-<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>KstFFTOptions</class>
<widget class="QWidget">
@@ -10,5 +10,5 @@
<y>0</y>
<width>456</width>
- <height>127</height>
+ <height>129</height>
</rect>
</property>
@@ -216,7 +216,4 @@
<cstring>Interleaved</cstring>
</property>
- <property name="enabled">
- <bool>false</bool>
- </property>
<property name="text">
<string>Interleaved average</string>
--- kdeextragear-2/kst/kst/kstpsdcurve.cpp #1.30:1.31
@@ -38,4 +38,5 @@ static const QString SVECTOR = "S";
static const QString FVECTOR = "F";
+#define KSTPSDMAXLEN 27
KstPSDCurve::KstPSDCurve(const QString &in_tag, KstVectorPtr in_V,
double in_freq, bool in_average, int in_len,
@@ -139,16 +140,18 @@ void KstPSDCurve::commonConstructor(cons
RUnits = in_RUnits;
- if (Len<2) {
- Len = 2;
- }
- if (Freq<=0) {
- Freq = 1.0;
+ if (!Average) {
+ Len = int(ceil(log(double(_inputVectors[INVECTOR]->length())) / log(2.0)));
}
- if (!Average || Len>log(double(in_V->length()))/log(2.0)) {
- Len = int(ceil(log(double(in_V->length())) / log(2.0)));
if (Len<2) {
Len = 2;
}
+
+ if (Len>KSTPSDMAXLEN) {
+ Len = KSTPSDMAXLEN;
+ }
+
+ if (Freq<=0) {
+ Freq = 1.0;
}
@@ -229,4 +232,6 @@ KstObject::UpdateType KstPSDCurve::updat
}
+ _adjustLengths();
+
v_len = iv->sampleCount();
@@ -407,12 +412,16 @@ int KstPSDCurve::getLen() const {
}
-void KstPSDCurve::setLen(int in_len) {
- if (in_len >= 4 && in_len <= 27) {
- Len = in_len;
+void KstPSDCurve::_adjustLengths() {
+ int psdlen, len;
+
+ if (Average) {
+ psdlen = int(pow(2,Len-1));
} else {
- Len = 10;
+ len = int(ceil(log(double(_inputVectors[INVECTOR]->length())) / log(2.0)));
+ psdlen = int(pow(2,len-1));
}
- PSDLen = int(pow(2,Len-1));
+ if (PSDLen != psdlen) {
+ PSDLen = psdlen;
(*_sVector)->resize(PSDLen);
@@ -426,5 +435,13 @@ void KstPSDCurve::setLen(int in_len) {
last_f0 = 0;
last_n_subsets = 0;
+ }
+}
+void KstPSDCurve::setLen(int in_len) {
+ if (in_len >= 4 && in_len <= 27) {
+ Len = in_len;
+ } else {
+ Len = 10;
+ }
}
--- kdeextragear-2/kst/kst/kstpsdcurve.h #1.18:1.19
@@ -97,4 +97,5 @@ private:
const QColor &in_color);
+ void _adjustLengths();
bool Apodize;
bool RemoveMean;
--- kdeextragear-2/kst/kst/main.cpp #1.66:1.67
@@ -532,5 +532,5 @@ int main(int argc, char *argv[]) {
psdcurve = new KstPSDCurve(
QString("P") + QString::number(1+i_curve++) + "-" + yvector->getField(),
- KstVectorPtr(yvector), in.rate, false, in.len,
+ KstVectorPtr(yvector), in.rate, true, in.len,
true, true, in.VUnits, in.RUnits, color);
if (in.has_points) {
@@ -635,4 +635,5 @@ int main(int argc, char *argv[]) {
app.setMainWidget(kst);
kst->show();
+ kst->updateDialogs();
}
More information about the Kst
mailing list