Loading...
Searching...
No Matches
UvwStManColumn.h
Go to the documentation of this file.
#ifndef CASACORE_STOKES_I_ST_MAN_COLUMN_H_
#define CASACORE_STOKES_I_ST_MAN_COLUMN_H_
#include <casacore/tables/DataMan/StManColumn.h>
#include <casacore/tables/Tables/ScalarColumn.h>
#include <casacore/casa/Arrays/Array.h>
#include <casacore/casa/Arrays/IPosition.h>
#include "UvwFile.h"
#include <optional>
namespace casacore {
class UvwStManColumn final : public StManColumn {
public:
explicit UvwStManColumn(UvwFile &file)
: StManColumn(DataType::TpDouble), file_(file) {}
Bool isWritable() const final { return true; }
void setShapeColumn(const IPosition &shape) final {
if (shape.size() != 1 || shape[0] != 3) {
throw std::runtime_error(
"UvwStMan can only be used for array columns with 1 dimension of "
"size 3");
}
}
IPosition shape(uInt) final { return IPosition{3}; }
IPosition shape(rownr_t) final { return IPosition{3}; }
void getArrayV(rownr_t row, ArrayBase &dataPtr) final {
Array<double> &array = static_cast<Array<double> &>(dataPtr);
bool ownership;
double *storage = array.getStorage(ownership);
const int antenna1 = antenna1_column_(row);
const int antenna2 = antenna2_column_(row);
file_.ReadUvw(row, antenna1, antenna2, storage);
array.putStorage(storage, ownership);
}
void putArrayV(rownr_t row, const ArrayBase &dataPtr) final {
const Array<double> &array = static_cast<const Array<double> &>(dataPtr);
bool ownership;
const double *storage = array.getStorage(ownership);
const int antenna1 = antenna1_column_(row);
const int antenna2 = antenna2_column_(row);
file_.WriteUvw(row, antenna1, antenna2, storage);
array.freeStorage(storage, ownership);
}
void Prepare(Table &table) {
antenna1_column_ = ScalarColumn<int>(table, "ANTENNA1");
antenna2_column_ = ScalarColumn<int>(table, "ANTENNA2");
}
private:
UvwStManColumn(const UvwStManColumn &source) = delete;
void operator=(const UvwStManColumn &source) = delete;
UvwFile &file_;
ScalarColumn<int> antenna1_column_;
ScalarColumn<int> antenna2_column_;
};
} // namespace casacore
#endif
UvwFile.h
casacore::ArrayBase
Non-templated base class for templated Array class.
Definition ArrayBase.h:71
casacore::Array
Definition Array.h:155
casacore::IPosition
Definition IPosition.h:117
casacore::ScalarColumn
Definition ScalarColumn.h:83
casacore::StManColumn::StManColumn
StManColumn(int dataType)
Default constructor.
Definition StManColumn.h:78
casacore::Table
Definition Table.h:157
casacore::UvwFile
Stores values of a UVW column in a compressed way.
Definition UvwFile.h:49
casacore::UvwStManColumn::UvwStManColumn
UvwStManColumn(UvwFile &file)
Definition UvwStManColumn.h:18
casacore::UvwStManColumn::shape
IPosition shape(rownr_t) final
Get the shape of the item in the given row.
Definition UvwStManColumn.h:34
casacore::UvwStManColumn::operator=
void operator=(const UvwStManColumn &source)=delete
casacore::UvwStManColumn::shape
IPosition shape(uInt) final
Definition UvwStManColumn.h:32
casacore::UvwStManColumn::file_
UvwFile & file_
Definition UvwStManColumn.h:70
casacore::UvwStManColumn::setShapeColumn
void setShapeColumn(const IPosition &shape) final
Set the dimensions of values in this column.
Definition UvwStManColumn.h:24
casacore::UvwStManColumn::antenna2_column_
ScalarColumn< int > antenna2_column_
Definition UvwStManColumn.h:72
casacore::UvwStManColumn::isWritable
Bool isWritable() const final
Test if data can be put into this column.
Definition UvwStManColumn.h:21
casacore::UvwStManColumn::getArrayV
void getArrayV(rownr_t row, ArrayBase &dataPtr) final
Get the array value in the given row.
Definition UvwStManColumn.h:36
casacore::UvwStManColumn::UvwStManColumn
UvwStManColumn(const UvwStManColumn &source)=delete
casacore::UvwStManColumn::antenna1_column_
ScalarColumn< int > antenna1_column_
Definition UvwStManColumn.h:71
casacore::UvwStManColumn::putArrayV
void putArrayV(rownr_t row, const ArrayBase &dataPtr) final
Write values into a particular row.
Definition UvwStManColumn.h:51
casacore::UvwStManColumn::Prepare
void Prepare(Table &table)
Definition UvwStManColumn.h:61
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::array
TYPE * array
the allocated array
Definition hdu.h:491
casacore::uInt
unsigned int uInt
Definition aipstype.h:49
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::rownr_t
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44