8 #ifndef SINGLEDISH_FILLER_NRO2MSREADER_H_
9 #define SINGLEDISH_FILLER_NRO2MSREADER_H_
11 #define STRING2CHAR(s) const_cast<char *>((s).c_str())
28 class NROOptionalTables;
38 virtual size_t getNumberOfRows();
53 casacore::Bool return_value = (*this.*get_observation_row_)(record);
106 return obs_header_.NBEAM;
109 return obs_header_.NPOL;
112 return obs_header_.NSPWIN;
116 return array_mapper_[array_id].isUsed();
120 return array_mapper_[array_id].getBeamId();
124 return array_mapper_[array_id].getPol();
128 return array_mapper_[array_id].getSpwId();
132 void initializeSpecific();
133 void finalizeSpecific();
138 void readObsHeader();
143 char volatile *
first =
reinterpret_cast<char volatile *
>(&
value) ;
144 char volatile *last = first +
sizeof(T) ;
145 std::reverse(first, last) ;
152 if ((
int)fread(&v, 1,
sizeof(T), fp_) !=
sizeof(T)) {
153 cout <<
"read failed." << endl;
162 for (
size_t i = 0; i < numArray; ++i) {
169 if (fread(
STRING2CHAR(v), 1, strLength, fp_) != strLength) {
170 cout <<
"read failed." << endl;
172 v.resize(strlen(v.c_str()));
175 void readHeader(
string *v,
size_t strLength,
size_t numArray) {
176 for (
size_t i = 0; i < numArray; ++i) {
177 readHeader(v[i], strLength);
187 void set(int16_t
const arr_data,
string const *pol_data) {
189 if (arr_data < 1101) {
198 beam_id =
static_cast<int>(arr_data/1000) - 1;
199 int pol_id =
static_cast<int>((arr_data % 1000)/100) - 1;
200 spw_id =
static_cast<int>(arr_data % 100) -1;
201 pol_name = pol_data[pol_id];
220 if (pol_name.size() == 0)
230 void constructArrayTable();
231 bool checkScanArray(
string const scan_array,
NROArrayData const *header_array);
234 for (
int iarr = 0; iarr < obs_header_.ARYNM0 ; ++iarr) {
235 if (spwid == array_mapper_[iarr].spw_id) {
240 throw casacore::AipsError(
"Internal ERROR: Could not find array ID corresponds to an SPW ID\n");
247 int const len_obs_header_ = 15136;
248 double getMJD(
string const &
time);
250 double getIntStartTimeSec(
int const scanno);
251 double getIntEndTimeSec(
int const scanno);
252 void getFullTimeRange();
253 double getMiddleOfTimeRangeSec();
259 double getRestFrequency(
int const spwno);
260 string convertVRefName(
string const &vref0);
261 void shiftFrequency(
string const &vdef,
263 std::vector<double> &freqs);
282 template<
class _Record>
294 Generate_NRO_ARRAY(table, reader);
void readHeader(string &v, size_t strLength)
virtual casacore::Bool isFloatData() const
Templated class to define columns of scalars in tables.
Create a new table - define shapes, data managers, etc.
ColumnDesc & addColumn(const ColumnDesc &)
Add a column to the table description.
Main interface class to a read/write table.
NROOptionalTables OptionalTables
new table, which gets marked for delete
int source_spw_id_counter_
Table asTable(const RecordFieldId &) const
Get the table from the given field.
void readHeader(string *v, size_t strLength, size_t numArray)
casacore::Stokes::StokesTypes getPol() const
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
virtual casacore::Bool getFieldRow(sdfiller::FieldRecord &record)
to get FIELD table
string getPolName() const
int getNRONumBeam() const
std::vector< NROArrayData > array_mapper_
void defineTable(const RecordFieldId &, const Table &value, RecordType type=Variable)
const String & tableName() const
Get the table name.
StokesTypes
The Stokes types are defined by this enum.
virtual casacore::Bool getAntennaRow(sdfiller::AntennaRecord &record)
to get ANTENNA table
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
int getNROArraySize() const
static void Generate_NRO_ARRAY(casacore::Table &table, NRO2MSReader const &reader)
virtual casacore::String getDataUnit() const
casacore::Vector< casacore::Double > time_range_sec_
OptionalTables class for NRO data.
static void Generate(casacore::Table &table, NRO2MSReader const &reader)
int getNROArrayBeamId(int array_id) const
static StokesTypes type(Int stokesNumber)
convert Int to StokesTypes, returns Stokes::Undefined if it is an invalid type
bool Bool
Define the standard types used by Casacore.
casacore::Bool noMoreRowImpl(_Record &)
TableRecord & rwKeywordSet()
Get read/write access to the table keyword set.
void readHeader(T *v, size_t numArray)
virtual casacore::Bool getSourceRow(sdfiller::SourceRecord &record)
to get SOURCE table
sdfiller::NRODataObsHeader obs_header_
void set(int16_t const arr_data, string const *pol_data)
virtual casacore::Bool getObservationRow(sdfiller::ObservationRecord &record)
to get OBSERVATION table
casacore::Stokes::StokesTypes getNROArrayPol(int array_id) const
bool isNROArrayUsed(int array_id) const
int getFirstArrayIdWithSpwID(int spwid)
Returns the first array ID whose SPW ID is spwid.
Base class for all Casacore library errors.
void convertEndian(T &value)
void put(uInt rownr, const T &value)
Put the value in a particular cell (i.e.
virtual casacore::Bool getProcessorRow(sdfiller::ProcessorRecord &record)
to get PROCESSOR table
int getNROArraySpwId(int array_id) const
String: the storage and methods of handling collections of characters.
Define the structure of a Casacore table.
Access to a scalar table column with arbitrary data type.
virtual casacore::Bool getSpectralWindowRow(sdfiller::SpectralWindowRecord &record)
to get SOURCE table
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.