[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Fri Oct 24 21:06:52 CEST 2008
SVN commit 875535 by netterfield:
Fix initialization for a couple more data objects.
This might fix the crash on load bugs.
M +1 -13 libkstapp/commandlineparser.cpp
M +15 -13 libkstmath/csd.cpp
M +23 -17 libkstmath/psd.cpp
M +5 -12 libkstmath/psdfactory.cpp
M +1 -1 plugins/plugins.pro
--- branches/work/kst/portto4/kst/src/libkstapp/commandlineparser.cpp #875534:875535
@@ -378,19 +378,7 @@
Q_ASSERT(powerspectrum);
powerspectrum->writeLock();
- powerspectrum->setVector(pv);
- powerspectrum->setFrequency(_sampleRate);
- powerspectrum->setAverage(true);
- powerspectrum->setLength(14);
- powerspectrum->setApodize(true);
- powerspectrum->setRemoveMean(true);
- //powerspectrum->setVectorUnits();
- //powerspectrum->setRateUnits(_powerSpectrumTab->FFTOptionsWidget()->rateUnits());
- powerspectrum->setApodizeFxn(WindowOriginal);
- //powerspectrum->setGaussianSigma(_powerSpectrumTab->FFTOptionsWidget()->sigma());
- powerspectrum->setOutput(PSDAmplitudeSpectralDensity);
- powerspectrum->setInterpolateHoles(false);
-
+ powerspectrum->change(pv, _sampleRate, true, 14, true, true, QString(), QString());
powerspectrum->update();
powerspectrum->unlock();
--- branches/work/kst/portto4/kst/src/libkstmath/csd.cpp #875534:875535
@@ -43,6 +43,18 @@
: DataObject(store) {
_typeString = staticTypeString;
_type = "Cumulative Spectral Decay";
+
+ Q_ASSERT(store);
+ MatrixPtr outMatrix = store->createObject<Matrix>();
+ outMatrix->setProvider(this);
+ outMatrix->setSlaveName("SG");
+ outMatrix->change(1, 1);
+ _outMatrix = _outputMatrices.insert(OUTMATRIX, outMatrix).value();
+
+ _shortName = "G"+QString::number(_csdnum);
+ if (_csdnum>max_csdnum)
+ max_csdnum = _csdnum;
+ _csdnum++;
}
@@ -74,23 +86,13 @@
_frequency = 1.0;
}
- Q_ASSERT(store());
- MatrixPtr outMatrix = store()->createObject<Matrix>();
- outMatrix->setProvider(this);
- outMatrix->setSlaveName("SG");
- outMatrix->change(1, 1);
- outMatrix->setLabel(i18n("Power [%1/%2^{1/2}]").arg(_vectorUnits).arg(_rateUnits));
- outMatrix->setXLabel(i18n("%1 [%2]").arg(vecName).arg(_vectorUnits));
- outMatrix->setYLabel(i18n("Frequency [%1]").arg(_rateUnits));
- _outMatrix = _outputMatrices.insert(OUTMATRIX, outMatrix).value();
+ _outMatrix->setLabel(i18n("Power [%1/%2^{1/2}]").arg(_vectorUnits).arg(_rateUnits));
+ _outMatrix->setXLabel(i18n("%1 [%2]").arg(vecName).arg(_vectorUnits));
+ _outMatrix->setYLabel(i18n("Frequency [%1]").arg(_rateUnits));
updateMatrixLabels();
_outMatrix->setDirty();
setDirty();
- _shortName = "G"+QString::number(_csdnum);
- if (_csdnum>max_csdnum)
- max_csdnum = _csdnum;
- _csdnum++;
connect(_inputVectors[INVECTOR], SIGNAL(updated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
--- branches/work/kst/portto4/kst/src/libkstmath/psd.cpp #875534:875535
@@ -51,6 +51,26 @@
: DataObject(store) {
_typeString = staticTypeString;
_type = "PowerSpectrum";
+
+ Q_ASSERT(store);
+ VectorPtr ov = store->createObject<Vector>();
+ ov->setProvider(this);
+ ov->setSlaveName("f");
+ ov->resize(2);
+ _fVector = _outputVectors.insert(FVECTOR, ov).value();
+
+ ov = store->createObject<Vector>();
+ ov->setProvider(this);
+ ov->setSlaveName("psd");
+ ov->resize(2);
+ _sVector = _outputVectors.insert(SVECTOR, ov).value();
+
+ _shortName = "S"+QString::number(_psdnum);
+ if (_psdnum>max_psdnum)
+ max_psdnum = _psdnum;
+ _psdnum++;
+
+
}
@@ -81,26 +101,11 @@
_PSDLength = 1;
- Q_ASSERT(store());
- VectorPtr ov = store()->createObject<Vector>();
- ov->setProvider(this);
- ov->setSlaveName("f");
- ov->resize(_PSDLength);
- _fVector = _outputVectors.insert(FVECTOR, ov).value();
+ _fVector->resize(_PSDLength);
+ _sVector->resize(_PSDLength);
- ov = store()->createObject<Vector>();
- ov->setProvider(this);
- ov->setSlaveName("psd");
- ov->resize(_PSDLength);
- _sVector = _outputVectors.insert(SVECTOR, ov).value();
-
updateVectorLabels();
- _shortName = "S"+QString::number(_psdnum);
- if (_psdnum>max_psdnum)
- max_psdnum = _psdnum;
- _psdnum++;
-
setDirty();
}
@@ -289,6 +294,7 @@
VectorPtr PSD::vector() const {
+
return _inputVectors[INVECTOR];
}
--- branches/work/kst/portto4/kst/src/libkstmath/psdfactory.cpp #875534:875535
@@ -93,18 +93,11 @@
Q_ASSERT(powerspectrum);
powerspectrum->writeLock();
- powerspectrum->setVector(vector);
- powerspectrum->setFrequency(frequency);
- powerspectrum->setAverage(average);
- powerspectrum->setLength(length);
- powerspectrum->setApodize(apodize);
- powerspectrum->setRemoveMean(removeMean);
- powerspectrum->setVectorUnits(vectorUnits);
- powerspectrum->setRateUnits(rateUnits);
- powerspectrum->setApodizeFxn((ApodizeFunction)apodizeFunction);
- powerspectrum->setGaussianSigma(gaussianSigma);
- powerspectrum->setOutput((PSDType)outputType);
- powerspectrum->setInterpolateHoles(interpolateHoles);
+ powerspectrum->change(vector, frequency,
+ average, length, apodize, removeMean,
+ vectorUnits, rateUnits, (ApodizeFunction)apodizeFunction,
+ gaussianSigma, (PSDType)outputType, interpolateHoles);
+
powerspectrum->setDescriptiveName(descriptiveName);
powerspectrum->update();
--- branches/work/kst/portto4/kst/src/plugins/plugins.pro #875534:875535
@@ -2,7 +2,7 @@
CONFIG += ordered
SUBDIRS += \
- sampleplugin \
+ #sampleplugin \
filters \
fits \
dataobject
More information about the Kst
mailing list