source: trunk/src/RowAccumulator.h@ 2011

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

New Development: No

JIRA Issue: No (merge alma branch to trunk)

Ready for Test: Yes

Interface Changes: No

Test Programs: regressions may work

Module(s): all single dish modules

Description:

Merged all changes in alma (r1386:1818) and newfiller (r1774:1818) branch.


File size: 2.9 KB
RevLine 
[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
20namespace 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]28class RowAccumulator {
29
30public:
31
[1104]32 /**
33 * Constructor taking a weight type as defined in @ref STDefs
34 */
[1569]35 explicit RowAccumulator(WeightType wt = asap::W_NONE);
[814]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
[1295]45 * @param time the time of the observation
[1114]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();
[1819]87 /**
88 * check the initialization state
89 */
90 casa::Bool state() const;
[814]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_;
[1104]103 //these are Vectors
[814]104 casa::MaskedArray<casa::Float> spectrum_;
[1398]105 casa::MaskedArray<casa::Float> weightSum_;
106 casa::MaskedArray<casa::uInt> n_;
[814]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}
[1114]116#endif
Note: See TracBrowser for help on using the repository browser.