Changeset 1047 in Sophya for trunk/SophyaExt/FitsIOServer/fitsfile.h
- Timestamp:
- Jun 15, 2000, 12:22:23 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitsfile.h
r1045 r1047 48 48 static int NbBlocks(char flnm[]); 49 49 static void getBlockType(char flnm[], int hdunum, string& typeOfExtension, int& naxis, vector<int>& naxisn, string& dataType, DVList& dvl ); 50 /*! return true if the current header corresponds to a FITS image extension */ 51 inline bool IsFitsImage() const { return (hdutype_ == IMAGE_HDU);} 52 53 /*! return true if the current header corresponds to a FITS ASCII or BINTABLE extension */ 54 inline bool IsFitsTable() const {return (hdutype_ == ASCII_TBL || hdutype_ == BINARY_TBL);} 55 56 /*! 57 this method is called from inherited objects : 58 59 moves to header 'hdunum' on file 'flnm' 60 61 gets parameters in header 62 63 calls the method 'ReadFromFits' from the inherited delegated object 64 65 */ 66 void ReadF(char flnm[],int hdunum= 0); 67 FitsFile* ReadFInit(char flnm[],int hdunum=0); 68 void ReadFFromFits(); 50 51 protected: 69 52 70 53 /*! 71 54 this method is called from inherited objects : 72 55 56 moves to header 'hdunum' on file 'flnm' 57 58 gets parameters in header 59 60 calls the method 'ReadFromFits' from the inherited object 61 62 */ 63 void ReadF(char flnm[],int hdunum= 0); 64 // FitsFile* ReadFInit(char flnm[],int hdunum=0); 65 void ReadFInit(char flnm[],int hdunum=0); 66 67 /*! 68 this method is called from inherited objects : 69 73 70 opens a file 'flnm' 74 71 75 72 gets parameters in header 76 73 77 calls the method 'ReadFromFits' from the inherited delegatedobject74 calls the method 'ReadFromFits' from the inherited object 78 75 79 76 */ 80 void WriteF(char flnm[], bool OldFile=false); 81 82 83 /*! 84 fill the array 'map' with double data from the current extension on FITS file. 85 If the extension is BINTABLE, the first column is provided. 86 87 \param <nentries> number of data to be read 88 */ 89 void GetSingleColumn(double* map, int nentries) const; 90 91 /*! same as above with float data */ 92 void GetSingleColumn(float* map, int nentries) const; 93 94 /*! same as above with int data */ 95 void GetSingleColumn(int* map, int nentries) const; 77 void WriteF(char flnm[], bool OldFile=false); 78 // virtual void ReadFromFits(FitsFile& ff)=0; 79 80 81 82 virtual void ReadFromFits()=0; 83 virtual void WriteToFits()=0; 84 85 static string getErrStatus(int status); 86 87 88 ////////////////////////////////////////////////////////// 89 /////// methods for managing extensions //////////////// 90 ////////////////////////////////////////////////////////// 91 92 ////////////////////////////////////////////////////////// 93 // methods with general purpose 94 /////////////////////////////////////// 95 96 /*! return a reference on a DVList containing the keywords from FITS file 97 */ 98 inline const DVList& DVListFromFits() const { return dvl_;} 99 100 void moveToFollowingHeader(); 101 int statusF() const; 102 103 104 ///////////////////////////////////////////////////////////// 105 // methods for managing FITS IMAGE extension 106 /////////////////////////////////////////////////// 107 108 109 //read 110 //---- 111 112 /*! return true if the current header corresponds to a FITS image extension */ 113 inline bool IsFitsImage() const { return (hdutype_ == IMAGE_HDU);} 96 114 97 115 /*! number of dimensions of an image extension : NAXIS parameter (in FITS notations) 98 116 */ 99 117 inline int nbDimOfImage() const {return naxis_;} 100 118 /*! a reference on a vector containing sizes of the NAXIS dimensions : NAXIS1, NAXIS2, NAXIS3 wtc. 119 */ 120 inline const vector<int>& dimOfImageAxes() const { return naxisn_;} 101 121 /*! 102 122 total number of data in the current IMAGE extension … … 104 124 inline int nbOfImageData() const { return nbData_; } 105 125 106 /*! a reference on a vector containing sizes of the NAXIS dimensions : NAXIS1, NAXIS2, NAXIS3 wtc. 107 */ 108 inline const vector<int>& dimOfImageAxes() const { return naxisn_;} 109 126 127 //write 128 //----- 129 130 131 /*! create an IMAGE header on FITS file. 132 \param <type> type of data (see method ColTypeFromFits) 133 \param <nbdim> number of dimensions : 1D, 2D, 3D etc. = NAXIS 134 \param <naxisn> array containind sizes of the different dimensions 135 */ 136 void makeHeaderImageOnFits(char type, int nbdim, int* naxisn) ; 137 138 /*! write double data from array 'map'on an IMAGE extension 139 \param <nbData> number of data to be written 140 141 */ 142 void putImageToFits( int nbData, double* map) const; 143 144 /*! same as previous method with float data */ 145 void putImageToFits(int nbData, float* map ) const; 146 147 /*! same as previous method with int data */ 148 void putImageToFits(int nbData, int* map) const; 149 150 151 152 ////////////////////////////////////////////////////////////////////////// 153 // methods for managing FITS BINARY TABLE or ASCII TABLE extension 154 //////////////////////////////////////////////////////////////////////// 155 156 157 158 // read 159 //----- 160 161 /*! return true if the current header corresponds to a FITS ASCII or BINTABLE extension */ 162 inline bool IsFitsTable() const {return (hdutype_ == ASCII_TBL || hdutype_ == BINARY_TBL);} 110 163 /*! return number of columns (return 1 if IMAGE) */ 111 164 int NbColsFromFits() const; 112 165 /*! number of data in the current IMAGE extension on FITS file, or number 166 of data of column number 'nocol' of the current BINTABLE extension 167 */ 168 int NentriesFromFits(int nocol) const; 113 169 /*! return a character denoting data type of column number 'nocol' in a BINTABLE : 114 170 … … 123 179 */ 124 180 char ColTypeFromFits(int nocol) const; 125 126 /*! number of data in the current IMAGE extension on FITS file, or number127 of data of column number 'nocol' of the current BINTABLE extension128 */129 int NentriesFromFits(int nocol) const;130 131 181 /*! name of the column number 'nocol' of the current BINTABLE extension 132 182 */ 133 183 string ColNameFromFits(int nocol) const; 134 184 135 136 185 /*! number of characters of each data for the column number 'nocol' (if char* typed) of the current BINTABLE extension 137 186 */ 138 187 int ColStringLengthFromFits(int nocol) const; 139 188 140 /*! return a reference on a DVList containing the keywords from FITS file 141 */ 142 inline const DVList& DVListFromFits() const { return dvl_;} 189 190 191 /*! 192 get the NoLine-th 'line' from the current BINTABLE extension on FITS file, 193 */ 194 void GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char 195 ** cdata) ; 196 197 /*! 198 get the NoLine-th 'line' from the current BINTABLE extension on FITS file, 199 */ 200 void GetBinTabLine(int NoLine, float* fdata) ; 201 202 203 143 204 144 205 … … 158 219 // Write elements into the FITS data array 159 220 160 /*! 161 get the NoLine-th 'line' from the current BINTABLE extension on FITS file, 162 */ 163 void GetBinTabLine(int NoLine, double* ddata, float* fdata, int* idata, char 164 ** cdata) const; 165 /*! 166 get the NoLine-th 'line' from the current BINTABLE extension on FITS file, 167 */ 168 void GetBinTabLine(int NoLine, float* fdata) const; 169 170 171 172 173 /*! write double data from array 'map'on an IMAGE extension 174 \param <nbData> number of data to be written 175 176 */ 177 void putImageToFits( int nbData, double* map) const; 178 179 /*! same as previous method with float data */ 180 void putImageToFits(int nbData, float* map ) const; 181 182 /*! same as previous method with int data */ 183 void putImageToFits(int nbData, int* map) const; 184 185 /*! write double data from array 'donnees ' on column number 'nocol' of a BINTABLE extension. 186 \param <nentries> number of data to be written 187 188 */ 189 void putColToFits(int nocol, int nentries, double* donnees) const; 190 191 /*! same as previous method with float data */ 192 void putColToFits(int nocol, int nentries, float* donnees) const; 193 194 /*! same as previous method with int data */ 195 void putColToFits(int nocol, int nentries, int* donnees) const; 196 197 /*! same as previous method with char* data */ 198 void putColToFits(int nocol, int nentries, char** donnees) const; 199 200 /*! create an IMAGE header on FITS file. 201 \param <type> type of data (see method ColTypeFromFits) 202 \param <nbdim> number of dimensions : 1D, 2D, 3D etc. = NAXIS 203 \param <naxisn> array containind sizes of the different dimensions 204 */ 205 void makeHeaderImageOnFits(char type, int nbdim, int* naxisn) ; 221 222 223 //write 224 //----- 206 225 207 226 /*! create an BINTABLE header on FITS file. … … 216 235 void makeHeaderBntblOnFits ( char* fieldType, char** Noms, int nentries, int tfields, DVList &dvl, char* extname, vector<int> taille_des_chaines) ; 217 236 218 void moveToFollowingHeader(); 219 void readheader(); 220 static void printerror(int&) ; 221 static void printerror(int&,char* texte) ; 222 protected: 223 virtual void ReadFromFits(FitsFile& ff)=0; 224 virtual void WriteToFits(FitsFile& ff)=0; 237 /*! write double data from array 'donnees ' on column number 'nocol' of a BINTABLE extension. 238 \param <nentries> number of data to be written 239 240 */ 241 void putColToFits(int nocol, int nentries, double* donnees) const; 242 243 /*! same as previous method with float data */ 244 void putColToFits(int nocol, int nentries, float* donnees) const; 245 246 /*! same as previous method with int data */ 247 void putColToFits(int nocol, int nentries, int* donnees) const; 248 249 /*! same as previous method with char* data */ 250 void putColToFits(int nocol, int nentries, char** donnees) const; 251 252 253 ///////////////////////////////////////////////////////////// 254 // methods for managing any type of FITS extension 255 //////////////////////////////////////////////////////// 256 257 258 /*! 259 fill the array 'map' with double data from the current extension on FITS file. 260 If the extension is BINTABLE, the first column is provided. 261 262 \param <nentries> number of data to be read 263 */ 264 void GetSingleColumn(double* map, int nentries) const; 265 266 /*! same as above with float data */ 267 void GetSingleColumn(float* map, int nentries) const; 268 269 /*! same as above with int data */ 270 void GetSingleColumn(int* map, int nentries) const; 271 272 273 225 274 private: 226 275 227 276 void InitNull(); 277 void ResetStatus(int& status) ; 278 static void printerror(int&) ; 279 static void printerror(int&,char* texte) ; 228 280 229 281 static void GetImageParameters (fitsfile* fileptr,int& bitpix,int& naxis,vector<int>& naxisn); … … 279 331 DVList dvl_; 280 332 333 334 335 //! last status returned by fitsio library. updated only by several methods 336 int fits_status_; 281 337 }; 282 338
Note:
See TracChangeset
for help on using the changeset viewer.