1 /*************************************************************************** 2 * * 3 * copyright : (C) 2007 The University of Toronto * 4 * netterfield@astro.utoronto.ca * 5 * copyright : (C) 2005 by University of British Columbia * 6 * dscott@phas.ubc.ca * 7 * * 8 * This program is free software; you can redistribute it and/or modify * 9 * it under the terms of the GNU General Public License as published by * 10 * the Free Software Foundation; either version 2 of the License, or * 11 * (at your option) any later version. * 12 * * 13 ***************************************************************************/ 14 15 /** A class for handling cumulative spectral decay for kst 16 */ 17 18 #ifndef CSD_H 19 #define CSD_H 20 21 #include "dataobject.h" 22 #include "psdcalculator.h" 23 #include "kstmath_export.h" 24 25 namespace Kst { 26 27 class KSTMATH_EXPORT CSD : public DataObject { 28 Q_OBJECT 29 30 public: 31 static const QString staticTypeString; typeString()32 const QString& typeString() const { return staticTypeString; } 33 static const QString staticTypeTag; 34 35 virtual void save(QXmlStreamWriter &s); 36 virtual QString propertyString() const; 37 38 void setVector(VectorPtr); 39 VectorPtr vector() const; 40 41 virtual bool slaveVectorsUsed() const; 42 43 virtual void showNewDialog(); 44 virtual void showEditDialog(); 45 46 bool apodize() const; 47 void setApodize(bool in_apodize); 48 49 bool removeMean() const; 50 void setRemoveMean(bool in_removeMean); 51 52 bool average() const; 53 void setAverage(bool in_average); 54 55 double frequency() const; 56 void setFrequency(double in_frequency); 57 58 ApodizeFunction apodizeFxn() const; 59 void setApodizeFxn(ApodizeFunction in_fxn); 60 61 double gaussianSigma() const; 62 void setGaussianSigma(double in_sigma); 63 64 int windowSize() const; 65 void setWindowSize(int in_size); 66 67 int length() const; 68 void setLength(int in_length); 69 70 const QString& vectorUnits() const; 71 void setVectorUnits(const QString& units); 72 73 const QString& rateUnits() const; 74 void setRateUnits(const QString& units); 75 76 PSDType output() const; 77 void setOutput(PSDType in_outputType); 78 79 MatrixPtr outputMatrix() const; 80 81 virtual DataObjectPtr makeDuplicate() const; 82 83 void change(VectorPtr in_V, double in_freq, bool in_average, 84 bool in_removeMean, bool in_apodize, ApodizeFunction in_apodizeFxn, 85 int in_windowSize, int in_length, double in_gaussianSigma, 86 PSDType in_outputType, const QString& in_vectorUnits, 87 const QString& in_rateUnits); 88 virtual QString descriptionTip() const; 89 90 virtual void internalUpdate(); 91 protected: 92 CSD(ObjectStore *store); 93 virtual ~CSD(); 94 95 friend class ObjectStore; 96 97 virtual QString _automaticDescriptiveName() const; 98 virtual void _initializeShortName(); 99 100 private: 101 void updateMatrixLabels(); 102 103 double _frequency; 104 bool _average; 105 bool _removeMean; 106 bool _apodize; 107 ApodizeFunction _apodizeFxn; 108 PSDType _outputType; 109 double _gaussianSigma; 110 int _windowSize; 111 int _averageLength; 112 int _length; 113 QString _vectorUnits; 114 QString _rateUnits; 115 116 PSDCalculator _psdCalculator; 117 118 // output matrix 119 MatrixPtr _outMatrix; 120 }; 121 122 typedef SharedPtr<CSD> CSDPtr; 123 typedef ObjectList<CSD> CSDList; 124 125 126 } 127 128 #endif 129 // vim: ts=2 sw=2 et 130