1 | //
|
---|
2 | // C++ Interface: STFiller
|
---|
3 | //
|
---|
4 | // Description:
|
---|
5 | //
|
---|
6 | //
|
---|
7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2006
|
---|
8 | //
|
---|
9 | // Copyright: See COPYING file that comes with this distribution
|
---|
10 | //
|
---|
11 | //
|
---|
12 | #ifndef STFILLER_H
|
---|
13 | #define STFILLER_H
|
---|
14 |
|
---|
15 | #include <vector>
|
---|
16 | #include <string>
|
---|
17 |
|
---|
18 | #include <casa/aips.h>
|
---|
19 | #include <casa/iostream.h>
|
---|
20 | #include <casa/Utilities/CountedPtr.h>
|
---|
21 | #include <casa/BasicSL/String.h>
|
---|
22 | #include <casa/Arrays/Vector.h>
|
---|
23 |
|
---|
24 | #include "Scantable.h"
|
---|
25 | #include "STHeader.h"
|
---|
26 |
|
---|
27 |
|
---|
28 | class PKSreader;
|
---|
29 | class NROReader;
|
---|
30 |
|
---|
31 | namespace asap {
|
---|
32 |
|
---|
33 | /**
|
---|
34 | This class fills a Scantable from external data formats using the PKSReader class.
|
---|
35 |
|
---|
36 | @brief A filler object for data import into Scantable
|
---|
37 | @author Malte Marquarding
|
---|
38 | @date 2006/01/16
|
---|
39 | @version 2.0a
|
---|
40 | */
|
---|
41 | class STFiller {
|
---|
42 | public:
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Default constructor
|
---|
46 | */
|
---|
47 | STFiller();
|
---|
48 |
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Constructor taking an existing Scantable to fill
|
---|
52 | * @param stbl
|
---|
53 | */
|
---|
54 | explicit STFiller(casacore::CountedPtr< Scantable > stbl);
|
---|
55 |
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * A constructor for a filler with associated input file
|
---|
59 | * @param filename the input file (rpf,sdfite or ms)
|
---|
60 | * @param whichIF read a specific IF only (default -1 means all IFs)
|
---|
61 | * @param whichBeam read a specific beam only (default -1 means all beams)
|
---|
62 | */
|
---|
63 | explicit STFiller( const std::string& filename, int whichIF=-1,
|
---|
64 | int whichBeam=-1 );
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Destructor
|
---|
68 | */
|
---|
69 | virtual ~STFiller();
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * associate the Filler with a file on disk
|
---|
73 | * @param filename the input file (rpf,sdfite or ms)
|
---|
74 | * @param whichIF read a specific IF only (default -1 means all IFs)
|
---|
75 | * @param whichBeam read a specific beam only (default -1 means all beams)
|
---|
76 | * @exception AipsError Creation of PKSreader failed
|
---|
77 | */
|
---|
78 | void open( const std::string& filename, const std::string& antenna, int whichIF=-1, int whichBeam=-1, casacore::Bool getPt=casacore::False );
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * detach from file and clean up pointers
|
---|
82 | */
|
---|
83 | void close( );
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * Read in "rows" from the source file attached with open()
|
---|
87 | * @return a status flag passed on by PKSreader
|
---|
88 | *
|
---|
89 | * @li @c 0: ok
|
---|
90 | * @li >0: failed
|
---|
91 | */
|
---|
92 | int read( );
|
---|
93 |
|
---|
94 | casacore::CountedPtr<Scantable> getTable() const { return table_;}
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * For NRO data
|
---|
98 | *
|
---|
99 | * 2008/11/11 Takeshi Nakazato
|
---|
100 | *
|
---|
101 | * openNRO : NRO version of open(), which performs to open file and
|
---|
102 | * read header data.
|
---|
103 | *
|
---|
104 | * readNRO : NRO version of read(), which performs to read scan
|
---|
105 | * records.
|
---|
106 | *
|
---|
107 | * fileCheck: Identify a type (NRO data or not) of filename_.
|
---|
108 | **/
|
---|
109 | void openNRO( int whichIF=-1, int whichBeam=-1 ) ;
|
---|
110 | int readNRO() ;
|
---|
111 | casacore::Bool fileCheck() ;
|
---|
112 |
|
---|
113 | void setReferenceExpr(const std::string& rx) { refRx_ = rx; }
|
---|
114 |
|
---|
115 | private:
|
---|
116 |
|
---|
117 | PKSreader* reader_;
|
---|
118 | STHeader* header_;
|
---|
119 | casacore::String filename_;
|
---|
120 | casacore::CountedPtr< Scantable > table_;
|
---|
121 | casacore::Int nIF_, nBeam_, /* nPol_, nChan_,*/ nInDataRow;
|
---|
122 | casacore::uInt ifOffset_, beamOffset_;
|
---|
123 | casacore::Vector<casacore::Bool> haveXPol_;
|
---|
124 | casacore::String refRx_;
|
---|
125 | NROReader *nreader_ ;
|
---|
126 | casacore::Bool isNRO_ ;
|
---|
127 | };
|
---|
128 |
|
---|
129 | } // namespace
|
---|
130 |
|
---|
131 | #endif
|
---|