source: trunk/src/RowAccumulator.h@ 1105

Last change on this file since 1105 was 1104, checked in by mar637, 18 years ago

added doxygen documentation

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