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 | #include "Logger.h"
|
---|
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 : public Logger {
|
---|
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(casa::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, int whichIF=-1, int whichBeam=-1, casa::Bool getPt=casa::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 | casa::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 | casa::Bool fileCheck() ;
|
---|
112 |
|
---|
113 | private:
|
---|
114 |
|
---|
115 | PKSreader* reader_;
|
---|
116 | STHeader* header_;
|
---|
117 | casa::String filename_;
|
---|
118 | casa::CountedPtr< Scantable > table_;
|
---|
119 | casa::Int nIF_, nBeam_, nPol_, nChan_, nInDataRow;
|
---|
120 | casa::uInt ifOffset_, beamOffset_;
|
---|
121 | casa::Vector<casa::Bool> haveXPol_;
|
---|
122 | NROReader *nreader_ ;
|
---|
123 | casa::Bool isNRO_ ;
|
---|
124 | };
|
---|
125 |
|
---|
126 | } // namespace
|
---|
127 |
|
---|
128 | #endif
|
---|