[805] | 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
|
---|
[2] | 14 |
|
---|
| 15 | #include <vector>
|
---|
| 16 | #include <string>
|
---|
| 17 |
|
---|
[81] | 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>
|
---|
[2] | 23 |
|
---|
[805] | 24 | #include "Scantable.h"
|
---|
[901] | 25 | #include "STHeader.h"
|
---|
[894] | 26 | #include "Logger.h"
|
---|
[2] | 27 |
|
---|
| 28 | class PKSreader;
|
---|
[1458] | 29 | class NROReader;
|
---|
[2] | 30 |
|
---|
[83] | 31 | namespace asap {
|
---|
[2] | 32 |
|
---|
[805] | 33 | /**
|
---|
| 34 | This class fills a Scantable from external data formats using the PKSReader class.
|
---|
| 35 |
|
---|
[846] | 36 | @brief A filler object for data import into Scantable
|
---|
[805] | 37 | @author Malte Marquarding
|
---|
| 38 | @date 2006/01/16
|
---|
| 39 | @version 2.0a
|
---|
| 40 | */
|
---|
[890] | 41 | class STFiller : public Logger {
|
---|
[2] | 42 | public:
|
---|
| 43 |
|
---|
[846] | 44 | /**
|
---|
| 45 | * Default constructor
|
---|
| 46 | */
|
---|
[805] | 47 | STFiller();
|
---|
[2] | 48 |
|
---|
[846] | 49 |
|
---|
| 50 | /**
|
---|
| 51 | * Constructor taking an existing Scantable to fill
|
---|
| 52 | * @param stbl
|
---|
| 53 | */
|
---|
[1353] | 54 | explicit STFiller(casa::CountedPtr< Scantable > stbl);
|
---|
[2] | 55 |
|
---|
| 56 |
|
---|
[805] | 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 | */
|
---|
[1353] | 63 | explicit STFiller( const std::string& filename, int whichIF=-1,
|
---|
[1458] | 64 | int whichBeam=-1 );
|
---|
[2] | 65 |
|
---|
[846] | 66 | /**
|
---|
| 67 | * Destructor
|
---|
| 68 | */
|
---|
[996] | 69 | virtual ~STFiller();
|
---|
[717] | 70 |
|
---|
[805] | 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 );
|
---|
| 79 |
|
---|
| 80 | /**
|
---|
[846] | 81 | * detach from file and clean up pointers
|
---|
[805] | 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
|
---|
[846] | 88 | *
|
---|
| 89 | * @li @c 0: ok
|
---|
| 90 | * @li >0: failed
|
---|
[805] | 91 | */
|
---|
| 92 | int read( );
|
---|
| 93 |
|
---|
| 94 | casa::CountedPtr<Scantable> getTable() const { return table_;}
|
---|
| 95 |
|
---|
[1458] | 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 |
|
---|
[2] | 113 | private:
|
---|
[805] | 114 |
|
---|
| 115 | PKSreader* reader_;
|
---|
[901] | 116 | STHeader* header_;
|
---|
[125] | 117 | casa::String filename_;
|
---|
[805] | 118 | casa::CountedPtr< Scantable > table_;
|
---|
[1388] | 119 | casa::Int nIF_, nBeam_, nPol_, nChan_, nInDataRow;
|
---|
[805] | 120 | casa::uInt ifOffset_, beamOffset_;
|
---|
[1060] | 121 | casa::Vector<casa::Bool> haveXPol_;
|
---|
[1458] | 122 | NROReader *nreader_ ;
|
---|
| 123 | casa::Bool isNRO_ ;
|
---|
[2] | 124 | };
|
---|
| 125 |
|
---|
[805] | 126 | } // namespace
|
---|
| 127 |
|
---|
[2] | 128 | #endif
|
---|