#include <fits.h>
Public Methods | |
Fits () | |
Fits (Fits &) | |
~Fits () | |
bool | create (int x, int y, FitsBitpix t=R4) |
bool | create (int x, int y, int z, FitsBitpix t=R4) |
bool | recreate (int x, int y) |
bool | recreate (int x, int y, int z) |
bool | copy (const Fits &) |
void | copyIndex (ULONG, ULONG) |
void | swapIndex (ULONG, ULONG) |
void | operator= (const Fits &a) |
bool | OpenFITS (const char *fname) |
bool | CreateFITS (const char *fname) |
void | CloseFITS () |
bool | ReadFITSData (ULONG=0, ULONG=0, ULONG=0, ULONG=0, ULONG=0, ULONG=0) |
bool | ReadFITSCubeImage (int which) |
bool | WriteFITSData (void) |
bool | ReadFITS (const char *fname, ULONG=0, ULONG=0, ULONG=0, ULONG=0, ULONG=0, ULONG=0) |
bool | ReadFITSExtension (const char *fname, int ext, ULONG=0, ULONG=0, ULONG=0, ULONG=0, ULONG=0, ULONG=0) |
bool | WriteFITS (const char *fname) |
bool | updateHeader (void) |
bool | getHeaderInformation () |
bool | isSHARPIdata () |
void | convertSHARPIdata () |
bool | WriteBMP (const char *fname) |
void | InitHeader (void) |
bool | SetIntKey (const char *, int, const char *=NULL) |
bool | SetIntKeys (const char *, int *, int) |
bool | SetFloatKey (const char *, double, const char *=NULL) |
bool | SetFloatKeys (const char *, double *, int) |
bool | SetStringKey (const char *, const char *, const char *=NULL) |
bool | SetStringKeys (const char *, char **, int) |
bool | GetIntKey (const char *, int *) |
bool | GetIntKeys (const char *, int *, int) |
bool | GetFloatKey (const char *, double *) const |
bool | GetFloatKeys (const char *, double *, int) |
bool | GetStringKey (const char *, char *) |
bool | GetStringKeys (const char *, char **, int) |
bool | DeleteKey (const char *) |
bool | InsertLine (const char *) |
int | ReadFitsHeader (gzFile gfd) |
int | ReadFitsExtensionHeader (gzFile gfd, int extendNumber) |
bool | WriteFitsHeader (FILE *fd) |
void | CopyHeader (const Fits &) |
char * | GetHeader () const |
bool | GetHeaderExtend () |
bool | allocateMemory (size_t=0) |
void | setCasts () |
bool | matches (const Fits &a) |
ULONG | Nelements (void) const |
long | Naxis (const UCHAR which) const |
void | setNaxis (const UCHAR which, const long what) |
double | ValueAt (const ULONG index) const |
bool | fits_error (char *msg) |
void | Progress (int percent) |
int | at (const int x, const int y, const int z=1) const |
bool | setValue (double v, int x, int y, int z=1) |
bool | add (const double &a) |
bool | sub (const double &a) |
bool | mul (const double &a) |
bool | div (const double &a) |
bool | power (const double &a) |
bool | ipower (const double &a) |
bool | add (const Fits &a) |
bool | sub (const Fits &a) |
bool | mul (const Fits &a) |
bool | div (const Fits &a) |
bool | power (const Fits &a) |
double | operator[] (const ULONG &a) |
double | operator() (const ULONG &a) |
double | operator() (const ULONG &a, const ULONG &b) |
double | operator() (const ULONG &a, const ULONG &b, const ULONG &c) |
void | operator= (const double &a) |
Fits & | operator^= (const float &r) |
bool | Sin (bool=TRUE) |
bool | Cos (bool=TRUE) |
bool | Tan (bool=TRUE) |
bool | Sinh (bool=TRUE) |
bool | Cosh (bool=TRUE) |
bool | Tanh (bool=TRUE) |
bool | Asin (bool=TRUE) |
bool | Acos (bool=TRUE) |
bool | Atan (bool=TRUE) |
bool | Asinh (bool=TRUE) |
bool | Acosh (bool=TRUE) |
bool | Atanh (bool=TRUE) |
bool | Exp () |
bool | Log (const double &base=10.0) |
bool | Ln () |
bool | Sqrt () |
bool | Abs () |
bool | ginvert () |
Fits & | invert () |
bool | checkRange (int *, int *, int *, int *, int *, int *) |
bool | setRange (double value, int x1, int x2, int y1, int y2, int z1=1, int z2=-1) |
bool | setRange (Fits &value, int x1, int x2, int y1, int y2, int z1=1, int z2=-1) |
bool | extractRange (Fits &result, int x1, int x2, int y1, int y2, int z1, int z2) |
bool | extractRange (Fits &result, Fits &indices) |
bool | addRange (double v, int n, long *x) |
bool | addRange (const Fits &f, int n, long *x) |
void | deflate (void) |
bool | norm (void) |
bool | norf (int nfact) |
bool | clip (double lo, double hi) |
bool | inclip (double lo, double hi, double value) |
void | limits (long *, long *, long *=NULL, long *=NULL, long *=NULL, long *=NULL) |
void | max_pixel (int *x, int *y, int r) |
double | max_pos (int *x, int *y, int *z=NULL) |
void | max_pos_in_mask (int *x, int *y, const Fits &mask) |
void | min_pos (int *x, int *y, int *z=NULL) |
void | centroid (double *x, double *y, double *z=NULL) |
bool | centroids (Fits &result, Fits &positions, int radius) |
bool | maxima (Fits &positions, int radius, int flag=0, float fraction=1.0) |
double | get_max (void) |
double | get_min (void) |
void | get_minmax (double *min, double *max) |
void | get_minmax (double *min, double *max, double ignore) |
double | get_flux (bool check=FALSE, ULONG *nv=NULL) |
bool | histogram (Fits &data, double min, double max, double binsize=0.0) |
bool | histeq (Fits &data, double min, double max) |
bool | sort (Fits &result, bool=FALSE) |
bool | createFitsIndex (const Fits &array, bool reverse=FALSE) |
bool | createStringIndex (const QString &, bool=FALSE) |
bool | createStringArrayIndex (const QStringList &stringarray, bool reverse=FALSE) |
void | makeStat (double *min, double *max, double *flux, double *avg) |
bool | qgauss (int n1, int n2, float xcen, float ycen, float fwhm, int speed) |
bool | gauss (int n1, int n2, float xcen, float ycen, float fwhm1, float fwhm2=-1.0, float angle=0.0) |
bool | ellipse (int n1, int n2, float xcen, float ycen, float fwhm1, float fwhm2=-1.0, float angle=0.0) |
bool | circle (int n1, int n2, float xcen, float ycen, float radius) |
bool | airy (int n1, int n2, float dia, float scl, float wav) |
bool | lftf (int n1, int n2, float x1) |
bool | hftf (int n1, int n2, float x1) |
bool | cosbell (int n1, int n2, float xcen, float ycen, float radius1, float radius2) |
bool | chinese_hat (int n1, int n2, float xcen, float ycen, float r) |
bool | rect (int n1, int n2, int xcen, int ycen, int width, int height) |
bool | delta (int n1, int n2, int x, int y) |
void | conj (void) |
bool | rot90 (int angle) |
bool | flip (int axes) |
bool | reass (void) |
bool | fft (void) |
bool | mosaic (const char *fname) |
bool | mosaic (QStringList, float *, float *, float *=NULL) |
bool | ishift (int ssx, int ssy, int ssz) |
bool | fshift (float ssx, float ssy, int flag) |
bool | lineshift (int line, float s, int axis) |
bool | wrap (int ssx, int ssy, int ssz) |
bool | CubeMedian (const Fits &cube) |
bool | CubeMedian (const Fits &cube, float reject) |
bool | CubeMedian (const char *, int=1, int=0) |
bool | CubeMedian (const char *, double reject) |
bool | enlarge (int scale, int flag=0) |
void | shrink (int fact=2) |
bool | resize (int new1=-1, int new2=-1, int new3=-1) |
bool | rebin (int new1, int new2) |
void | cblank (double v=0.0) |
void | czero (double v=0.0) |
bool | CubeAverage (const QStringList &) |
bool | CubeMinimum (const Fits &) |
bool | CubeMaximum (const Fits &) |
bool | CubeSum (const Fits &, int first=1, int last=0) |
bool | CubeMerge (const char *outname, QStringList &innames) |
bool | ravg (char *templ, int first, int last) |
bool | sssa (const char *fname, Fits stats, int method, Fits *sky, Fits *flat, Fits *dpl, Fits *mask) |
int | F_I (long x, long y=1, long z=1) const |
int | C_I (long x, long y=0, long z=0) |
Static Public Methods | |
bool | WriteBMP (const char *fname, Fits &red, Fits &green, Fits &blue) |
Private Attributes | |
char * | header |
int | HeaderLength |
The FITS class provides all the standard operations on matrices. Those include addition, subtraction, multiplication, division, but also taking sine, cosine, ... of a complete matrix.
Filter creation functions are provided for circular, elliptical, ... filters.
|
Constructor; we only supply one since constructors don't allow for reporting errors |
|
Constructor; We need to supply this one in order to be able to use temporary classes |
|
Destructor |
|
Absolute value of all array elements. If the array is of complex type (C16), it will be changed to double (R8). If the array is of integer type, it will be changed to float (R4).
|
|
Arcus Cosine of all array elements. If the array is of integer type, it will be changed to float (R4). If the minimum value of array elements is < -1.0 or the maximum is > 1.0, the array type will be changed to complex (C16).
|
|
Arcus Cosine hyperbolicus of all array elements. If the array is of integer type, it will be changed to float (R4). If the minimum value of array elements is < 1.0 the array type will be changed to complex (C16).
|
|
Add an array to the array (Pixel by pixel). If the number of axes in the current array is exactly one greater than in a, we will loop over the current array. If membits of the current array is I1, I2, or I4, it will be changed to at least R4, or to whatever a.membits is. This is in order to assure no loss in data. |
|
Add a constant to the array. If the array is of integer type (i.e. membits = I1, I2 or I4), this is very fast since only the bzero entry is modified. |
|
Add the Fits f to a part of the array. |
|
Add the constant v to a part of the array. |
|
Create an airy function at the center of the array. |
|
(Re)allocate of memory and update the pointers to data. |
|
Arcus Sine of all array elements. If the array is of integer type, it will be changed to float (R4). If the minimum value of array elements is < -1.0 or the maximum is > 1.0, the array type will be changed to complex (C16).
|
|
Arcus Sine hyperbolicus of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
Return linear index of array element x, y, z (fortran-notation) |
|
Arcus Tangent of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
Arcus Tangent hyperbolicus of all array elements. If the array is of integer type, it will be changed to float (R4). If the minimum value of array elements is <= -1.0 or the maximum is >= 1.0, the array type will be changed to complex (C16).
|
|
Return the linear index of the array element at [x, y, z] (C-notation) |
|
Replace all values which do not represent a value (i.e. which are NaN or INF) by v. |
|
Return the centroid of the array (fortran-notation). |
|
Return an array of centroids around given pixel coordinates. |
|
Check the range given by integer arguments, and replace -1's by correct values |
|
Create a chinese hat function |
|
create a 2-dimensional circle with bitpix = 8 |
|
Clip: All values below lo will be set to lo, all values above hi will be set to hi. If hi < lo, only values lower than lo will be clipped. |
|
Close a previously opened FITS file. If the file was opened for read/write, append enough 0's so its total length is an integer multiple of 2880 bytes (FITS standard). |
|
If a complex array, replace all values by its complex conjugate. Does nothing for any other array type. |
|
Convert SHARP I data to valid FITS format: SHARP I data is unsigned short, which does not exist in FITS standard. So we subtract 32767 from each pixel and typecast to signed short. The data values represent the correct values if we also set bzero to 32767 and bscale to 1.0. |
|
Copies a Fits. |
|
Copies a FITS header |
|
Copy the value at array index source to array index dest. |
|
Cosine of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
Create a cosine bell function |
|
Cosine hyperbolicus of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
Create a Fits cube (3-dimensional). |
|
Create a Fits image (2-dimensional). |
|
Open a FITS file for WRITING |
|
Create an index table of the array in ascending or descending order. |
|
Create an index table of the string in ascending or descending order. |
|
Create an index table of the string in ascending or descending order. |
|
Take a fits cube and do an average of the images therein. |
|
Go through the cube and select the maximum of each pixel in the 3rd dimension. Returns an image. |
|
Take a fits cube and do a median of the images therein. This version reads parts of the single images consecutively from disk in order to save memory. (the maximum amount of memory allocated is define below.) |
|
Take a fits cube and do a median of the images therein. This version reads parts of the single images consecutively from disk in order to save memory. (the maximum amount of memory allocated is define below.) |
|
Go through the cube and select the median of each pixel in the 3rd dimension. Returns an image. Values which correspond to reject are discarded. |
|
Go through the cube and select the median of each pixel in the 3rd dimension. Returns an image. |
|
Take a number of FITS cubes and write them to disk as a single FITS cube. |
|
Go through the cube and select the minimum of each pixel in the 3rd dimension. Returns an image. |
|
Go through the cube and add all pixels up. Returns an image. |
|
Replace all values which are equal to zero by v. |
|
Remove all axis information of axes whose length is 1. |
|
Delete a key. |
|
create a delta function |
|
Divide one array by another (Pixel by pixel). If the number of axes in the current array is exactly one greater than in a, we will loop over the current array. If membits of the current array is I1, I2, or I4, it will be changed to at least R4, or to whatever a.membits is. This is in order to assure no loss in data. |
|
Divide the array by a constant. If the array is of integer type (i.e. membits = I1, I2 or I4), this is very fast since only the bzero and bscale entries are modified. |
|
create a 2-dimensional elliptical with bitpix = 8 if fwhm2 < 0, it will be a circle |
|
Enlarge the array by an integer amount Keep flux constant flag can have 2 values: 0: Center original image 1: Center original image, edge values are mean of edge 2: Blow up pixels |
|
Exponential of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
extract part of the array, indices given by another FITS |
|
extract part of the array |
|
Return the linear index of the array element at [x, y, z] (fortran-notation) |
|
Perform the forward Fast Fourier Transform if the array is float Perform the inverse Fast Fourier Transform if the array is complex This uses the FFTW package |
|
error message reporting |
|
flip about specified axis |
|
sub-pixel shift the complete array float ssx, ssy are the shift vectors int method can have the following values: 0: Take weighted mean of next pixels 1: Use fft 2...: Use n-th order polynomial approximation |
|
create a 2-dimensional elliptical gaussian with bitpix = -32 if fwhm2 < 0, it will be a circular gaussian |
|
Return the total value. |
|
Return the maximum value. |
|
Return the minimum value. |
|
Compute minimum and maximum values, ignoring one value. |
|
Compute minimum and maximum values. |
|
Get a floating point key. |
|
Get several floating point keys. The key name is generated from base and the numbers 1...n, where n < 10. |
|
Return a pointer to the string representing the header. |
|
Determine if the file contains a FITS extension. |
|
Update local variables to that of the FITS header |
|
Get an integer key |
|
Get several integer keys. The key name is generated from base and the numbers 1...n, where n < 10. |
|
Get a string key. |
|
Get several string keys. The key name is generated from base and the numbers 1...n, where n < 10. |
|
Invert a 2D-matrix |
|
Create a 2-dimensional high transfer function |
|
Create a histogram equalization of an image with 256 entries. |
|
Create a histogram of the data. |
|
Inclusive clipping: All values between lo and hi will be set to value. |
|
Constructor: Allocates minimum space for a FITS conforming header (2880 bytes). The first line is set to "SIMPLE = T", the last to "END" |
|
Insert a line in the FITS header. If no space is left, the header is expanded by 2880 bytes, according to the FITS standard. |
|
Replace all values by 1/value |
|
Raise a constant to the power of the array. If the array is of integer type (i.e. membits = I1, I2 or I4), it will be changed to R4. If any resulting array value is complex, the array type will be changed to C16. |
|
Shift the array by an integer amount |
|
Find out if the header represents SHARP I data: This is the case, if: 1> The keys INSTRUME and BITPIX do exist and have "SHARPI " and 16, respectively 2> The keys BSCALE and BZERO don't exist. |
|
Create a 2-dimensional low transfer function |
|
Return limits for which the array is non-zero. |
|
sub-pixel shift one single line in the array |
|
Natural logarithm of all array elements. If the array is of integer type, it will be changed to float (R4). If the minimum value of array elements is <= 0.0, the array type will be changed to complex (C16).
|
|
Logarithm of all array elements to the base (default 10). If the array is of integer type, it will be changed to float (R4). If the minimum value of array elements is <= 0.0, the array type will be changed to complex (C16).
|
|
Return minimum, maximum, total value and average value. |
|
Compare to another Fits structure |
|
Return pixel coordinates of brightest pixel around (x, y) within a search box of radius r. |
|
Return the index of the pixel with the highest value (fortran-notation). |
|
Return the index of the pixel with the highest value within a mask (fortran-notation). |
|
Find local maxima in the Fits around a given radius. Flag can have 3 values: Flag = 0 means search in a circle Flag = 1 means search in a box Flag = 2 means search for maxima without a given set of positions |
|
Return the index of the pixel with the lowest value (fortran-notation). |
|
Make a mosaic of the images specified. |
|
Put together images specified in the file pointed to by fname File format: 3(4) Columns: Filename, xshift, yshift, (scale factor) Negative Shifts result in clipping of the image |
|
Multiply an array to the array (Pixel by pixel). If the number of axes in the current array is exactly one greater than in a, we will loop over the current array. If membits of the current array is I1, I2, or I4, it will be changed to at least R4, or to whatever a.membits is. This is in order to assure no loss in data. |
|
Multiply a constant to the array. If the array is of integer type (i.e. membits = I1, I2 or I4), this is very fast since only the bzero and bscale entries are modified. |
|
Length of specified axes |
|
Number of elements |
|
Normalize: if nfact is 1, the average value will be 1, else the total value will be 1. |
|
Normalize array, i.e. all values will be scaled to lie between 0 and 1. |
|
Open a FITS file for READ ONLY |
|
Return value of array element at (a, b, c) (fortran-notation) |
|
Return value of array element at (a, b) (fortran-notation) |
|
Return value at linear index position |
|
Set all elements to value of a |
|
Copy operator.
|
|
Return value at linear index position |
|
Raise all array elements to the power of r. Array elements whose value is < 0 will be set to 0. |
|
Raise one array to the power of another (Pixel by pixel). If the number of axes in the current array is exactly one greater than in a, we will loop over the current array. If membits of the current array is I1, I2, or I4, it will be changed to at least R4, or to whatever a.membits is. This is in order to assure no loss in data. |
|
Raise the array to the power of a constant. If the array is of integer type (i.e. membits = I1, I2 or I4), it will be changed to R4. If any resulting array value is complex, the array type will be changed to C16. |
|
progress information |
|
create a 2-dimensional circular gaussian with bitpix = -32 Speed gives the number of fwhm that the gaussian spans. |
|
Read consecutive files and make a long exposure |
|
Read in a complete FITS file by default, the image(s) is stored in a float array |
|
Read in one image of a FITS cube The data is converted to T_R4 or T_C16 |
|
Read in data in the FITS file The data is converted to T_R4 or T_C16 Partial loading is supported |
|
Read in a complete FITS file by default, the image(s) is stored in a float array |
|
Read a FITS header extension from a file. The file pointer will be placed at the end of the extension header. |
|
Read a FITS header from a file. The file pointer fd must be at the correct position. |
|
Reassemble the array, i.e. re-arrange the quadrants after 2 fft's. |
|
Resize the array to new axis lengths. The aspect ratio is NOT preserved. Intermediate Pixels will be interpolated by bilinear interpolation. At the moment only works for 2-dimensional arrays. 3-dim will loop over the 3rd dimension. |
|
Create a Fits cube (3-dimensional). Values are NOT initialized. |
|
Create a Fits image (2-dimensional). Values are NOT initialized. |
|
create a rectangle |
|
Resize the array to new axis lengths Image will be in lower left corner |
|
Rotate by specified amount of degrees, which is an integer multiple of 90 degrees. This is reversible. |
|
Update all casts to memory |
|
Set a floating point key, optionally with a comment |
|
Set several floating point keys; The key names are generated from the base and the numbers 1..n, where n < 10; |
|
Set an integer key, optionally with a comment |
|
Set several integer keys; The key names are generated from the base and the numbers 1..n, where n < 10; |
|
Set length of specified axes |
|
Set a range in the fits array to values in another fits array |
|
Set a range in the fits array to a certain value |
|
Set a string key, optionally with a comment |
|
Set several string keys; The key names are generated from the base and the numbers 1..n, where n < 10; |
|
Set the value of the element at location x, y, z (fortran-notation) |
|
Shrink the array such that 4 original pixel becomes one new pixel which is set to the sum of those 4 pixels. This way the total flux in the array is kept constant. |
|
Sine of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
Sine hyperbolicus of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
Create an index array which holds a sorted index of the values. |
|
Square root of all array elements. If the array is of integer type, it will be changed to float (R4). If the minimum value of array elements is < 0.0, the array type will be changed to complex (C16).
|
|
Perform Simple Shift-and-Add using previously calculated statistics |
|
Subtract an array from the array (Pixel by pixel). If the number of axes in the current array is exactly one greater than in a, we will loop over the current array. If membits of the current array is I1, I2, or I4, it will be changed to at least R4, or to whatever a.membits is. This is in order to assure no loss in data. |
|
Subtract a constant from the array. If the array is of integer type (i.e. membits = I1, I2 or I4), this is very fast since only the bzero entry is modified. |
|
Swap the values at array index source and array index dest. |
|
Tangent of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
Tangent hyperbolicus of all array elements. If the array is of integer type, it will be changed to float (R4).
|
|
Update Header values |
|
Return value at specified position |
|
Shift and wrap the array by an integer amount |
|
Write a color BMP file. |
|
Write a BMP file. |
|
Write a fits file |
|
Write the data to file. |
|
Write a FITS header to a file. The file pointer fd must be at the correct position. |
|
The storage place of the FITS header (HeaderLength + 1 for the trailing 0) |
|
Length (in bytes) of the FITS header, not including the trailing zero. |