source: branches/asap-3.x/src/RowAccumulator.h@ 2908

Last change on this file since 2908 was 1569, checked in by Malte Marquarding, 16 years ago

Fix enum problem with WeightType enum value already defined somewhere by adding W_ prefix. ALso removed enums which are no longer in use

File size: 2.9 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#ifndef ASAPROWACCUMULATOR_H
13#define ASAPROWACCUMULATOR_H
14
15#include <casa/aips.h>
16#include <casa/Arrays/Vector.h>
17#include <casa/Arrays/MaskedArray.h>
18#include "STDefs.h"
19
20namespace asap {
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 */
28class RowAccumulator {
29
30public:
31
32 /**
33 * Constructor taking a weight type as defined in @ref STDefs
34 */
35 explicit RowAccumulator(WeightType wt = asap::W_NONE);
36
37 ~RowAccumulator();
38
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 time the time of the observation
46 */
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);
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 */
57 void setUserMask(const casa::Vector<casa::Bool>& m);
58 /**
59 * Get the spectrum. Applies the normalisation (averaging)
60 * @return the spectrum vector
61 */
62 casa::Vector<casa::Float> getSpectrum() const;
63 /**
64 * Get the Tsys. Applies the normalisation (averaging)
65 * @return the Tsys vector
66 */
67 casa::Vector<casa::Float> getTsys() const;
68 /**
69 * Get the spectrum's mask. Applies the normalisation (averaging)
70 * @return the mask vector
71 */
72 casa::Vector<casa::Bool> getMask() const;
73 /**
74 * Get the total interval.
75 * @return the integration time
76 */
77 casa::Double getInterval() const;
78 /**
79 * Get the time of the observation. Retrieves the "mean" time.
80 * @return the integration time
81 */
82 casa::Double getTime() const;
83 /**
84 * Reset the acummulator to the state at construction.
85 */
86 void reset();
87
88private:
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_;
99 //these are Vectors
100 casa::MaskedArray<casa::Float> spectrum_;
101 casa::MaskedArray<casa::Float> weightSum_;
102 casa::MaskedArray<casa::uInt> n_;
103
104 casa::Vector<casa::Bool> userMask_;
105
106 casa::Vector<casa::Float> tsysSum_;
107 casa::Double timeSum_;
108 casa::Double intervalSum_;
109};
110
111}
112#endif
Note: See TracBrowser for help on using the repository browser.