[814] | 1 | //
|
---|
| 2 | // C++ Interface: RowAccumulator
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | //
|
---|
| 7 | // Author: Malte Marquarding <Malte.Marquarding@csiro.au>, (C) 2005
|
---|
| 8 | //
|
---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
[1114] | 12 | #ifndef ASAPROWACCUMULATOR_H
|
---|
| 13 | #define ASAPROWACCUMULATOR_H
|
---|
[814] | 14 |
|
---|
| 15 | #include <casa/aips.h>
|
---|
| 16 | #include <casa/Arrays/Vector.h>
|
---|
| 17 | #include <casa/Arrays/MaskedArray.h>
|
---|
[831] | 18 | #include "STDefs.h"
|
---|
[814] | 19 |
|
---|
| 20 | namespace asap {
|
---|
[1104] | 21 | /**
|
---|
| 22 | * This class accumulates spectra and weights and returns the averaged data
|
---|
| 23 | * @brief Class for averaging of spectra
|
---|
| 24 | * @author Malte Marquarding
|
---|
| 25 | * @date $Date:$
|
---|
| 26 | * @version
|
---|
| 27 | */
|
---|
[814] | 28 | class RowAccumulator {
|
---|
| 29 |
|
---|
| 30 | public:
|
---|
| 31 |
|
---|
[1104] | 32 | /**
|
---|
| 33 | * Constructor taking a weight type as defined in @ref STDefs
|
---|
| 34 | */
|
---|
[814] | 35 | RowAccumulator(WeightType wt = asap::NONE);
|
---|
| 36 |
|
---|
| 37 | ~RowAccumulator();
|
---|
| 38 |
|
---|
[1114] | 39 | /**
|
---|
| 40 | * add a new "row" to the accumulator
|
---|
| 41 | * @param v the spectrum
|
---|
| 42 | * @param m the mask for the spectrum
|
---|
| 43 | * @param tsys the Tsys corresponing to the spectrum
|
---|
| 44 | * @param interval the intergration time
|
---|
| 45 | * @param the time of the observation
|
---|
| 46 | */
|
---|
[814] | 47 | void add(const casa::Vector<casa::Float>& v,
|
---|
| 48 | const casa::Vector<casa::Bool>& m,
|
---|
| 49 | const casa::Vector<casa::Float>& tsys,
|
---|
| 50 | casa::Double interval,
|
---|
| 51 | casa::Double time);
|
---|
[1114] | 52 | /**
|
---|
| 53 | * Also set a user mask which get combined with the individual masks
|
---|
| 54 | * from the spectra
|
---|
| 55 | * @param m a boolean mask of teh same length as the spectrum
|
---|
| 56 | */
|
---|
[814] | 57 | void setUserMask(const casa::Vector<casa::Bool>& m);
|
---|
[1114] | 58 | /**
|
---|
| 59 | * Get the spectrum. Applies the normalisation (averaging)
|
---|
| 60 | * @return the spectrum vector
|
---|
| 61 | */
|
---|
[814] | 62 | casa::Vector<casa::Float> getSpectrum() const;
|
---|
[1114] | 63 | /**
|
---|
| 64 | * Get the Tsys. Applies the normalisation (averaging)
|
---|
| 65 | * @return the Tsys vector
|
---|
| 66 | */
|
---|
[814] | 67 | casa::Vector<casa::Float> getTsys() const;
|
---|
[1114] | 68 | /**
|
---|
| 69 | * Get the spectrum's mask. Applies the normalisation (averaging)
|
---|
| 70 | * @return the mask vector
|
---|
| 71 | */
|
---|
[814] | 72 | casa::Vector<casa::Bool> getMask() const;
|
---|
[1114] | 73 | /**
|
---|
| 74 | * Get the total interval.
|
---|
| 75 | * @return the integration time
|
---|
| 76 | */
|
---|
[814] | 77 | casa::Double getInterval() const;
|
---|
[1114] | 78 | /**
|
---|
| 79 | * Get the time of the observation. Retrieves the "mean" time.
|
---|
| 80 | * @return the integration time
|
---|
| 81 | */
|
---|
[814] | 82 | casa::Double getTime() const;
|
---|
[1114] | 83 | /**
|
---|
| 84 | * Reset the acummulator to the state at construction.
|
---|
| 85 | */
|
---|
[814] | 86 | void reset();
|
---|
| 87 |
|
---|
| 88 | private:
|
---|
| 89 | void addSpectrum( const casa::Vector<casa::Float>& v,
|
---|
| 90 | const casa::Vector<casa::Bool>& m,
|
---|
| 91 | casa::Float weight);
|
---|
| 92 |
|
---|
| 93 | casa::Float addTsys(const casa::Vector<casa::Float>& v);
|
---|
| 94 | casa::Float addInterval(casa::Double inter);
|
---|
| 95 | void addTime(casa::Double t);
|
---|
| 96 |
|
---|
| 97 | WeightType weightType_;
|
---|
| 98 | casa::Bool initialized_;
|
---|
[1104] | 99 | //these are Vectors
|
---|
[814] | 100 | casa::MaskedArray<casa::Float> spectrum_;
|
---|
| 101 | casa::MaskedArray<casa::Float> n_, weightSum_;
|
---|
| 102 |
|
---|
| 103 | casa::Vector<casa::Bool> userMask_;
|
---|
| 104 |
|
---|
| 105 | casa::Vector<casa::Float> tsysSum_;
|
---|
| 106 | casa::Double timeSum_;
|
---|
| 107 | casa::Double intervalSum_;
|
---|
| 108 | };
|
---|
| 109 |
|
---|
| 110 | }
|
---|
[1114] | 111 | #endif
|
---|