File indexing completed on 2024-12-22 04:17:51

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *   copyright : (C) 2005 by University of British Columbia                *
0006  *                   dscott@phas.ubc.ca                                    *
0007  *                                                                         *
0008  *   This program is free software; you can redistribute it and/or modify  *
0009  *   it under the terms of the GNU General Public License as published by  *
0010  *   the Free Software Foundation; either version 2 of the License, or     *
0011  *   (at your option) any later version.                                   *
0012  *                                                                         *
0013  ***************************************************************************/
0014 
0015 /** A class for handling cumulative spectral decay for kst
0016  */
0017 
0018 #ifndef CSD_H
0019 #define CSD_H
0020 
0021 #include "dataobject.h"
0022 #include "psdcalculator.h"
0023 #include "kstmath_export.h"
0024 
0025 namespace Kst {
0026 
0027 class KSTMATH_EXPORT CSD : public DataObject {
0028   Q_OBJECT
0029 
0030   public:
0031     static const QString staticTypeString;
0032     const QString& typeString() const { return staticTypeString; }
0033     static const QString staticTypeTag;
0034 
0035     virtual void save(QXmlStreamWriter &s);
0036     virtual QString propertyString() const;
0037 
0038     void setVector(VectorPtr);
0039     VectorPtr vector() const;
0040 
0041     virtual bool slaveVectorsUsed() const;
0042 
0043     virtual void showNewDialog();
0044     virtual void showEditDialog();
0045 
0046     bool apodize() const;
0047     void setApodize(bool in_apodize);
0048 
0049     bool removeMean() const;
0050     void setRemoveMean(bool in_removeMean);
0051 
0052     bool average() const;
0053     void setAverage(bool in_average);
0054 
0055     double frequency() const;
0056     void setFrequency(double in_frequency);
0057 
0058     ApodizeFunction apodizeFxn() const;
0059     void setApodizeFxn(ApodizeFunction in_fxn);
0060 
0061     double gaussianSigma() const;
0062     void setGaussianSigma(double in_sigma);
0063 
0064     int windowSize() const;
0065     void setWindowSize(int in_size);
0066 
0067     int length() const;
0068     void setLength(int in_length);
0069 
0070     const QString& vectorUnits() const;
0071     void setVectorUnits(const QString& units);
0072 
0073     const QString& rateUnits() const;
0074     void setRateUnits(const QString& units);
0075 
0076     PSDType output() const;
0077     void setOutput(PSDType in_outputType);
0078 
0079     MatrixPtr outputMatrix() const;
0080 
0081     virtual DataObjectPtr makeDuplicate() const;
0082 
0083     void change(VectorPtr in_V, double in_freq, bool in_average,
0084         bool in_removeMean, bool in_apodize, ApodizeFunction in_apodizeFxn,
0085         int in_windowSize, int in_length, double in_gaussianSigma,
0086         PSDType in_outputType, const QString& in_vectorUnits,
0087         const QString& in_rateUnits);
0088     virtual QString descriptionTip() const;
0089 
0090     virtual void internalUpdate();
0091   protected:
0092     CSD(ObjectStore *store);
0093     virtual ~CSD();
0094 
0095     friend class ObjectStore;
0096 
0097     virtual QString _automaticDescriptiveName() const;
0098     virtual void _initializeShortName();
0099 
0100   private:
0101     void updateMatrixLabels();
0102 
0103     double _frequency;
0104     bool _average;
0105     bool _removeMean;
0106     bool _apodize;
0107     ApodizeFunction _apodizeFxn;
0108     PSDType _outputType;
0109     double _gaussianSigma;
0110     int _windowSize;
0111     int _averageLength;
0112     int _length;
0113     QString _vectorUnits;
0114     QString _rateUnits;
0115 
0116     PSDCalculator _psdCalculator;
0117 
0118     // output matrix
0119     MatrixPtr _outMatrix;
0120 };
0121 
0122 typedef SharedPtr<CSD> CSDPtr;
0123 typedef ObjectList<CSD> CSDList;
0124 
0125 
0126 }
0127 
0128 #endif
0129 // vim: ts=2 sw=2 et