casa
$Rev:20696$
|
templated primary array base class of given type More...
#include <hdu.h>
Public Types | |
typedef TYPE | ElementType |
Public Member Functions | |
PrimaryArray (FitsInput &, FITSErrorHandler=FITSError::defaultHandler) | |
constructor from a FitsInput | |
PrimaryArray (FitsKeywordList &, FITSErrorHandler=FITSError::defaultHandler) | |
constructor from a FitsKeywordList | |
PrimaryArray (FITSErrorHandler=FITSError::defaultHandler) | |
constructor does not require a FitsKeywordList. | |
virtual | ~PrimaryArray () |
destructor | |
double | bscale () const |
General access routines for a primary array. | |
double | bzero () const |
char * | bunit () const |
Bool | isablank () const |
Int | blank () const |
char * | ctype (int n) const |
double | crpix (int n) const |
double | crota (int n) const |
double | crval (int n) const |
double | cdelt (int n) const |
double | datamax () const |
double | datamin () const |
OFF_T | nelements () const |
double | operator() (int, int, int, int, int) const |
The overloaded operator functions `()' all return physical data, i. | |
double | operator() (int, int, int, int) const |
double | operator() (int, int, int) const |
double | operator() (int, int) const |
double | operator() (int) const |
TYPE & | data (int, int, int, int, int) |
The various `data()' functions allow one to access and set the raw data itself. | |
TYPE & | data (int, int, int, int) |
TYPE & | data (int, int, int) |
TYPE & | data (int, int) |
TYPE & | data (int) |
int | store (const TYPE *source, FITS::FitsArrayOption=FITS::NoOpt) |
The `store()', `move()' and `copy()' functions allow bulk data transfer between the internal FITS array and an external data storage area. | |
void | copy (double *target, FITS::FitsArrayOption=FITS::NoOpt) const |
void | copy (float *target, FITS::FitsArrayOption=FITS::NoOpt) const |
void | move (TYPE *target, FITS::FitsArrayOption=FITS::NoOpt) const |
int | store (const TYPE *source, int npixels) |
Use these versions if you are reading/writing "chunk by chunk. | |
void | copy (double *target, int npixels) const |
void | copy (float *target, int npixels) const |
void | move (TYPE *target, int npixels) const |
int | write_priArr_hdr (FitsOutput &fout, int simple, int bitpix, int naxis, long naxes[], int extend) |
virtual int | read () |
The `read()' and `write()' functions control reading and writing data from the external FITS I/O medium into the FITS array. | |
virtual int | read (int) |
virtual int | write (FitsOutput &) |
virtual OFF_T | set_next (OFF_T) |
Protected Member Functions | |
PrimaryArray (FitsInput &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler) | |
PrimaryArray (FitsKeywordList &, FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler) | |
construct from a FitsKeywordList with given HDU type | |
PrimaryArray (FITS::HDUType, FITSErrorHandler errhandler=FITSError::defaultHandler) | |
construct witout FitsKeywordList for given HDU type( for ImageExtension and PrimaryGroup) | |
int | offset (int, int) const |
compute a linear offset from array indicies | |
int | offset (int, int, int) const |
int | offset (int, int, int, int) const |
int | offset (int, int, int, int, int) const |
void | pa_assign () |
Protected Attributes | |
double | bscale_x |
double | bzero_x |
char * | bunit_x |
Bool | isablank_x |
Int | blank_x |
char ** | ctype_x |
double * | crpix_x |
double * | crota_x |
double * | crval_x |
double * | cdelt_x |
double | datamax_x |
double | datamin_x |
OFF_T | totsize |
int * | factor |
OFF_T | alloc_elems |
OFF_T | beg_elem |
OFF_T | end_elem |
TYPE * | array |
the allocated array |
templated primary array base class of given type
A Primary Data Array is represented by the following:
<Type> data_array [NAXIS1][NAXIS2]...[NAXISN]
For a PrimaryArray, dims() gives the number of dimensions and dim(i) gives the value of the i-th dimension
WARNING! Multi-dimensional arrays are stored in FORTRAN order, NOT in C order. Options on the store, copy, and move functions exist to convert from one order to the other, if that is necessary.
It is important to understand the proper sequence of operations with respect to I/O and data access. For input, the `read()' functions allocate an internal buffer of the appropriate size, if not already allocated, as well as reading and converting data; a `read()' function must be performed prior to accessing the data, i. e. before executing any `()', `data()', `copy()', or `move()' function. For output, the `store()' function similarly allocates an internal buffer before transfering data, and must be executed prior to any data access or `write()' function. Note: If you call any version of store(), do not call set_next().
Writing portions of an array at a time, rather than the entire array, is a special case. The `set_next()' function is provided for this purpose. It declares the intention to write out the next N elements and must be executed prior to any `data()' function. It allocates a buffer of appropriate size, if not already allocated. Again, via the `data()' functions, one accesses the array as if the entire array were in memory. The `write()' function always writes the number of current elements in the internal buffer. The sequence of operations for each portion of the array written would be:
The `set_next()' function must NOT be used with `read()' or `store()' functions; unpredictable results will occur.
The following example illustrates the output cases.
Suppose we have an image array with 512 rows and 1024 columns stored in C-order. The C declaration would be:
int source[1024][512];
To write out the entire array:
FitsOutput fout; // some properly constructed FitsOutput PrimaryArray<FitsLong> pa; // some properly constructed PrimaryArray pa.store(source,CtoF); pa.write(fout);
Suppose we wanted to write out the two-dimensional image array a column at a time, rather than write out the entire array. For FITS, dim(0) is 512, dim(1) is 1024. The following code fragment writes one column at a time in the proper FITS Fortran-order.
typedef TYPE casa::PrimaryArray< TYPE >::ElementType |
casa::PrimaryArray< TYPE >::PrimaryArray | ( | FitsInput & | , |
FITSErrorHandler | = FITSError::defaultHandler |
||
) |
constructor from a FitsInput
casa::PrimaryArray< TYPE >::PrimaryArray | ( | FitsKeywordList & | , |
FITSErrorHandler | = FITSError::defaultHandler |
||
) |
constructor from a FitsKeywordList
casa::PrimaryArray< TYPE >::PrimaryArray | ( | FITSErrorHandler | = FITSError::defaultHandler | ) |
constructor does not require a FitsKeywordList.
call write_priArr_hdr() after construction.
virtual casa::PrimaryArray< TYPE >::~PrimaryArray | ( | ) | [virtual] |
destructor
casa::PrimaryArray< TYPE >::PrimaryArray | ( | FitsInput & | , |
FITS::HDUType | , | ||
FITSErrorHandler | errhandler = FITSError::defaultHandler |
||
) | [protected] |
construct from a FitsInput with given HDU type
casa::PrimaryArray< TYPE >::PrimaryArray | ( | FitsKeywordList & | , |
FITS::HDUType | , | ||
FITSErrorHandler | errhandler = FITSError::defaultHandler |
||
) | [protected] |
construct from a FitsKeywordList with given HDU type
casa::PrimaryArray< TYPE >::PrimaryArray | ( | FITS::HDUType | , |
FITSErrorHandler | errhandler = FITSError::defaultHandler |
||
) | [protected] |
construct witout FitsKeywordList for given HDU type( for ImageExtension and PrimaryGroup)
Int casa::PrimaryArray< TYPE >::blank | ( | ) | const [inline] |
double casa::PrimaryArray< TYPE >::bscale | ( | ) | const [inline] |
char* casa::PrimaryArray< TYPE >::bunit | ( | ) | const [inline] |
double casa::PrimaryArray< TYPE >::bzero | ( | ) | const [inline] |
double casa::PrimaryArray< TYPE >::cdelt | ( | int | n | ) | const [inline] |
Definition at line 366 of file hdu.h.
Referenced by casa::MSPrimaryTableHolder::cdelt(), and casa::MSPrimaryGroupHolder::cdelt().
void casa::PrimaryArray< TYPE >::copy | ( | double * | target, |
FITS::FitsArrayOption | = FITS::NoOpt |
||
) | const |
void casa::PrimaryArray< TYPE >::copy | ( | float * | target, |
FITS::FitsArrayOption | = FITS::NoOpt |
||
) | const |
void casa::PrimaryArray< TYPE >::copy | ( | double * | target, |
int | npixels | ||
) | const |
void casa::PrimaryArray< TYPE >::copy | ( | float * | target, |
int | npixels | ||
) | const |
double casa::PrimaryArray< TYPE >::crota | ( | int | n | ) | const [inline] |
double casa::PrimaryArray< TYPE >::crpix | ( | int | n | ) | const [inline] |
Definition at line 363 of file hdu.h.
Referenced by casa::MSPrimaryTableHolder::crpix(), and casa::MSPrimaryGroupHolder::crpix().
double casa::PrimaryArray< TYPE >::crval | ( | int | n | ) | const [inline] |
Definition at line 365 of file hdu.h.
Referenced by casa::MSPrimaryTableHolder::crval(), and casa::MSPrimaryGroupHolder::crval().
char* casa::PrimaryArray< TYPE >::ctype | ( | int | n | ) | const [inline] |
Definition at line 362 of file hdu.h.
Referenced by casa::MSPrimaryTableHolder::ctype(), and casa::MSPrimaryGroupHolder::ctype().
TYPE& casa::PrimaryArray< TYPE >::data | ( | int | , |
int | , | ||
int | , | ||
int | , | ||
int | |||
) |
The various `data()' functions allow one to access and set the raw data itself.
TYPE& casa::PrimaryArray< TYPE >::data | ( | int | , |
int | , | ||
int | , | ||
int | |||
) |
TYPE& casa::PrimaryArray< TYPE >::data | ( | int | , |
int | , | ||
int | |||
) |
TYPE& casa::PrimaryArray< TYPE >::data | ( | int | , |
int | |||
) |
TYPE& casa::PrimaryArray< TYPE >::data | ( | int | ) |
double casa::PrimaryArray< TYPE >::datamax | ( | ) | const [inline] |
double casa::PrimaryArray< TYPE >::datamin | ( | ) | const [inline] |
Bool casa::PrimaryArray< TYPE >::isablank | ( | ) | const [inline] |
void casa::PrimaryArray< TYPE >::move | ( | TYPE * | target, |
FITS::FitsArrayOption | = FITS::NoOpt |
||
) | const |
void casa::PrimaryArray< TYPE >::move | ( | TYPE * | target, |
int | npixels | ||
) | const |
OFF_T casa::PrimaryArray< TYPE >::nelements | ( | ) | const [inline] |
int casa::PrimaryArray< TYPE >::offset | ( | int | , |
int | |||
) | const [protected] |
compute a linear offset from array indicies
int casa::PrimaryArray< TYPE >::offset | ( | int | , |
int | , | ||
int | |||
) | const [protected] |
int casa::PrimaryArray< TYPE >::offset | ( | int | , |
int | , | ||
int | , | ||
int | |||
) | const [protected] |
int casa::PrimaryArray< TYPE >::offset | ( | int | , |
int | , | ||
int | , | ||
int | , | ||
int | |||
) | const [protected] |
double casa::PrimaryArray< TYPE >::operator() | ( | int | , |
int | , | ||
int | , | ||
int | , | ||
int | |||
) | const |
double casa::PrimaryArray< TYPE >::operator() | ( | int | , |
int | , | ||
int | , | ||
int | |||
) | const |
double casa::PrimaryArray< TYPE >::operator() | ( | int | , |
int | , | ||
int | |||
) | const |
double casa::PrimaryArray< TYPE >::operator() | ( | int | , |
int | |||
) | const |
double casa::PrimaryArray< TYPE >::operator() | ( | int | ) | const |
void casa::PrimaryArray< TYPE >::pa_assign | ( | ) | [protected] |
virtual int casa::PrimaryArray< TYPE >::read | ( | ) | [virtual] |
The `read()' and `write()' functions control reading and writing data from the external FITS I/O medium into the FITS array.
Appropriate conversions are made between FITS and local data representations. One can read the entire array into memory, or one can only read portions of the array. In the latter case, one must specify that the next N elements are to be read or written. Note that the number of elements must be specified, NOT the number of bytes. If one reads portions of the array, as opposed to the entire array, only that portion is in memory at a given time. One can still access the elements of the array via the `()' and `data()' functions, as if the entire array was in memory; obviously care must be taken in this case to access only those portions that are actually in memory.
Reimplemented in casa::PrimaryTable< TYPE >, casa::PrimaryTable< FitsLong >, casa::PrimaryTable< Float >, casa::PrimaryTable< uChar >, casa::PrimaryTable< Short >, casa::PrimaryGroup< TYPE >, casa::PrimaryGroup< FitsLong >, casa::PrimaryGroup< Float >, and casa::PrimaryGroup< Short >.
virtual int casa::PrimaryArray< TYPE >::read | ( | int | ) | [virtual] |
Reimplemented in casa::PrimaryGroup< TYPE >, casa::PrimaryGroup< FitsLong >, casa::PrimaryGroup< Float >, and casa::PrimaryGroup< Short >.
virtual OFF_T casa::PrimaryArray< TYPE >::set_next | ( | OFF_T | ) | [virtual] |
Reimplemented in casa::PrimaryGroup< TYPE >, casa::PrimaryGroup< FitsLong >, casa::PrimaryGroup< Float >, and casa::PrimaryGroup< Short >.
int casa::PrimaryArray< TYPE >::store | ( | const TYPE * | source, |
FITS::FitsArrayOption | = FITS::NoOpt |
||
) |
The `store()', `move()' and `copy()' functions allow bulk data transfer between the internal FITS array and an external data storage area.
The external storage must have already been allocated and it is assumed that the entire data array is in memory. `store()' transfers raw data at `source' into the FITS array; an allowable option is CtoF, which specifies to convert the array from C-order to Fortran-order. `move()' is the opposite of `store()'. `move()' transfers raw data from the FITS array to `target'; an allowable option is FtoC, which specifies to convert the array from Fortran-order to C-order. `copy()' is similar to `move()' except that what is copied is physical data and not raw data; the physical data can be either double or float. copy() also turns blanks into NaN's.
int casa::PrimaryArray< TYPE >::store | ( | const TYPE * | source, |
int | npixels | ||
) |
Use these versions if you are reading/writing "chunk by chunk.
" No FtoC option is available. You are responsible for ensuring that npixels corresponds to he number actually read or written. Note that copy() turns blanks into NaN's.
virtual int casa::PrimaryArray< TYPE >::write | ( | FitsOutput & | ) | [virtual] |
int casa::PrimaryArray< TYPE >::write_priArr_hdr | ( | FitsOutput & | fout, |
int | simple, | ||
int | bitpix, | ||
int | naxis, | ||
long | naxes[], | ||
int | extend | ||
) |
OFF_T casa::PrimaryArray< TYPE >::alloc_elems [protected] |
TYPE* casa::PrimaryArray< TYPE >::array [protected] |
OFF_T casa::PrimaryArray< TYPE >::beg_elem [protected] |
Int casa::PrimaryArray< TYPE >::blank_x [protected] |
Definition at line 470 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::blank().
double casa::PrimaryArray< TYPE >::bscale_x [protected] |
Reimplemented in casa::PrimaryTable< TYPE >, casa::PrimaryTable< FitsLong >, casa::PrimaryTable< Float >, casa::PrimaryTable< uChar >, and casa::PrimaryTable< Short >.
Definition at line 466 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::bscale().
char* casa::PrimaryArray< TYPE >::bunit_x [protected] |
Reimplemented in casa::PrimaryTable< TYPE >, casa::PrimaryTable< FitsLong >, casa::PrimaryTable< Float >, casa::PrimaryTable< uChar >, and casa::PrimaryTable< Short >.
Definition at line 468 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::bunit().
double casa::PrimaryArray< TYPE >::bzero_x [protected] |
Reimplemented in casa::PrimaryTable< TYPE >, casa::PrimaryTable< FitsLong >, casa::PrimaryTable< Float >, casa::PrimaryTable< uChar >, and casa::PrimaryTable< Short >.
Definition at line 467 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::bzero().
double* casa::PrimaryArray< TYPE >::cdelt_x [protected] |
Definition at line 475 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::cdelt().
double* casa::PrimaryArray< TYPE >::crota_x [protected] |
Definition at line 473 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::crota().
double* casa::PrimaryArray< TYPE >::crpix_x [protected] |
Definition at line 472 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::crpix().
double* casa::PrimaryArray< TYPE >::crval_x [protected] |
Definition at line 474 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::crval().
char** casa::PrimaryArray< TYPE >::ctype_x [protected] |
Definition at line 471 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::ctype().
double casa::PrimaryArray< TYPE >::datamax_x [protected] |
Definition at line 476 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::datamax().
double casa::PrimaryArray< TYPE >::datamin_x [protected] |
Definition at line 477 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::datamin().
OFF_T casa::PrimaryArray< TYPE >::end_elem [protected] |
int* casa::PrimaryArray< TYPE >::factor [protected] |
Bool casa::PrimaryArray< TYPE >::isablank_x [protected] |
Definition at line 469 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::isablank().
OFF_T casa::PrimaryArray< TYPE >::totsize [protected] |
Definition at line 478 of file hdu.h.
Referenced by casa::PrimaryArray< Short >::nelements().