casa
$Rev:20696$
|
Virtual column engine to scale a table Complex array for Single Dish data. More...
#include <CompressComplex.h>
Public Member Functions | |
CompressComplexSD (const String &virtualColumnName, const String &storedColumnName, Float scale, Float offset=0) | |
Construct an engine to scale all arrays in a column with the given offset and scale factor. | |
CompressComplexSD (const String &virtualColumnName, const String &storedColumnName, const String &scaleColumnName, const String &offsetColumnName, Bool autoScale=True) | |
Construct an engine to scale the arrays in a column. | |
CompressComplexSD (const Record &spec) | |
Construct from a record specification as created by getmanagerSpec(). | |
~CompressComplexSD () | |
Destructor is mandatory. | |
virtual String | dataManagerType () const |
Return the type name of the engine (i.e. | |
Static Public Member Functions | |
static String | className () |
Return the name of the class. | |
static void | registerClass () |
Register the class name and the static makeObject "constructor". | |
static DataManager * | makeObject (const String &dataManagerType, const Record &spec) |
Define the "constructor" to construct this engine when a table is read back. | |
Private Member Functions | |
CompressComplexSD (const CompressComplexSD &) | |
Copy constructor is only used by clone(). | |
CompressComplexSD & | operator= (const CompressComplexSD &) |
Assignment is not needed and therefore forbidden (so it is made private and not implemented). | |
virtual DataManager * | clone () const |
Clone the engine object. | |
virtual void | create (uInt initialNrrow) |
Initialize the object for a new table. | |
virtual void | scaleOnGet (Float scale, Float offset, Array< Complex > &array, const Array< Int > &target) |
Scale and/or offset target to array. | |
virtual void | scaleOnPut (Float scale, Float offset, const Array< Complex > &array, Array< Int > &target) |
Scale and/or offset array to target. | |
virtual void | findMinMax (Float &minVal, Float &maxVal, const Array< Complex > &array) const |
Find minimum and maximum from the array data. |
Virtual column engine to scale a table Complex array for Single Dish data.
Public interface
CompressComplexSD is similar to CompressComplex, but compresses in a slighty different way optimized for single dish data. Usually the imaginary part of single dish data is 0, so the scaling is optimized for it.
If the imaginary part is 0, the real part is scaled with 15 bits extra to get a higher precision. The least significant bit is set to 0 indicating the imag==0.
If the imaginary part is not 0, the real part is scaled normally. The imaginary part is scaled with 1 bit less. The least significant bit is set to 1 indicating that imag!=0.
This class is created on top of CompressComplex to cope with SD data in a better way. Using CompressComplex often makes the imag part non-zero if it is scaled as 0.
// Create the table description and 2 columns with indirect arrays in it. // The Int column will be stored, while the double will be // used as virtual. TableDesc tableDesc ("", TableDesc::Scratch); tableDesc.addColumn (ArrayColumnDesc<Int> ("storedArray")); tableDesc.addColumn (ArrayColumnDesc<Complex> ("virtualArray")); tableDesc.addColumn (ScalarColumnDesc<Complex> ("scale")); tableDesc.addColumn (ScalarColumnDesc<Float> ("offset")); // Create a new table using the table description. SetupNewTable newtab (tableDesc, "tab.data", Table::New); // Create the array scaling engine (with auto-scale) // and bind it to the Complex column. CompressComplexSD scalingEngine("virtualArray", "storedArray", "scale", "offset"); newtab.bindColumn ("virtualArray", scalingEngine); // Create the table. Table table (newtab); // Store a 3-D array (with dim. 2,3,4) into each row of the column. // The shape of each array in the column is implicitly set by the put // function. This will also set the shape of the underlying Int array. ArrayColumn data (table, "virtualArray"); Array<double> someArray(IPosition(4,2,3,4)); someArray = 0; for (uInt i=0, i<10; i++) { // table will have 10 rows table.addRow(); data.put (i, someArray) }
Definition at line 414 of file CompressComplex.h.
casa::CompressComplexSD::CompressComplexSD | ( | const String & | virtualColumnName, |
const String & | storedColumnName, | ||
Float | scale, | ||
Float | offset = 0 |
||
) |
Construct an engine to scale all arrays in a column with the given offset and scale factor.
StoredColumnName is the name of the column where the scaled data will be put and must have data type Int. The virtual column using this engine must have data type Complex.
casa::CompressComplexSD::CompressComplexSD | ( | const String & | virtualColumnName, |
const String & | storedColumnName, | ||
const String & | scaleColumnName, | ||
const String & | offsetColumnName, | ||
Bool | autoScale = True |
||
) |
Construct an engine to scale the arrays in a column.
The scale and offset values are taken from a column with the given names. In that way each array has its own scale factor and offset value. An exception is thrown if these columns do not exist. VirtualColumnName is the name of the virtual column and is used to check if the engine gets bound to the correct column. StoredColumnName is the name of the column where the scaled data will be put and must have data type Int. The virtual column using this engine must have data type Complex.
casa::CompressComplexSD::CompressComplexSD | ( | const Record & | spec | ) |
Construct from a record specification as created by getmanagerSpec().
Destructor is mandatory.
casa::CompressComplexSD::CompressComplexSD | ( | const CompressComplexSD & | ) | [private] |
Copy constructor is only used by clone().
(so it is made private).
static String casa::CompressComplexSD::className | ( | ) | [static] |
Return the name of the class.
This includes the names of the template arguments.
Reimplemented from casa::CompressComplex.
virtual DataManager* casa::CompressComplexSD::clone | ( | ) | const [private, virtual] |
Clone the engine object.
Reimplemented from casa::CompressComplex.
virtual void casa::CompressComplexSD::create | ( | uInt | initialNrrow | ) | [private, virtual] |
Initialize the object for a new table.
It defines the keywords containing the engine parameters.
Reimplemented from casa::CompressComplex.
virtual String casa::CompressComplexSD::dataManagerType | ( | ) | const [virtual] |
virtual void casa::CompressComplexSD::findMinMax | ( | Float & | minVal, |
Float & | maxVal, | ||
const Array< Complex > & | array | ||
) | const [private, virtual] |
Find minimum and maximum from the array data.
NaN and infinite values and zero imaginary parts are ignored. If no values are finite, minimum and maximum are set to NaN.
Reimplemented from casa::CompressComplex.
static DataManager* casa::CompressComplexSD::makeObject | ( | const String & | dataManagerType, |
const Record & | spec | ||
) | [static] |
Define the "constructor" to construct this engine when a table is read back.
This "constructor" has to be registered by the user of the engine. If the engine is commonly used, its registration can be added to the registerAllCtor function in DataManager.cc. That function gets automatically invoked by the table system.
Reimplemented from casa::CompressComplex.
CompressComplexSD& casa::CompressComplexSD::operator= | ( | const CompressComplexSD & | ) | [private] |
Assignment is not needed and therefore forbidden (so it is made private and not implemented).
static void casa::CompressComplexSD::registerClass | ( | ) | [static] |
Register the class name and the static makeObject "constructor".
This will make the engine known to the table system.
Reimplemented from casa::CompressComplex.
virtual void casa::CompressComplexSD::scaleOnGet | ( | Float | scale, |
Float | offset, | ||
Array< Complex > & | array, | ||
const Array< Int > & | target | ||
) | [private, virtual] |
Scale and/or offset target to array.
This is meant when reading an array from the stored column. It optimizes for scale=1 and/or offset=0.
Reimplemented from casa::CompressComplex.
virtual void casa::CompressComplexSD::scaleOnPut | ( | Float | scale, |
Float | offset, | ||
const Array< Complex > & | array, | ||
Array< Int > & | target | ||
) | [private, virtual] |
Scale and/or offset array to target.
This is meant when writing an array into the stored column. It optimizes for scale=1 and/or offset=0.
Reimplemented from casa::CompressComplex.