source: branches/newfiller/src/RowAccumulator.h@ 2881

Last change on this file since 2881 was 1757, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


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 /**
88 * check the initialization state
89 */
90 casa::Bool state() const;
91
92private:
93 void addSpectrum( const casa::Vector<casa::Float>& v,
94 const casa::Vector<casa::Bool>& m,
95 casa::Float weight);
96
97 casa::Float addTsys(const casa::Vector<casa::Float>& v);
98 casa::Float addInterval(casa::Double inter);
99 void addTime(casa::Double t);
100
101 WeightType weightType_;
102 casa::Bool initialized_;
103 //these are Vectors
104 casa::MaskedArray<casa::Float> spectrum_;
105 casa::MaskedArray<casa::Float> weightSum_;
106 casa::MaskedArray<casa::uInt> n_;
107
108 casa::Vector<casa::Bool> userMask_;
109
110 casa::Vector<casa::Float> tsysSum_;
111 casa::Double timeSum_;
112 casa::Double intervalSum_;
113};
114
115}
116#endif
Note: See TracBrowser for help on using the repository browser.