Changeset 1978 in Sophya for trunk/SophyaExt
- Timestamp:
- May 3, 2002, 3:04:05 PM (23 years ago)
- Location:
- trunk/SophyaExt/FitsIOServer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitsfile.cc
r1771 r1978 254 254 taille_des_chaines_.clear(); 255 255 dvl_.Clear(); 256 257 dnull_ = 1.e-300; 258 fnull_ = 1.e-33; 259 inull_= 99999; 260 cnull_= string("xxx"); 256 261 262 257 263 } 258 264 … … 742 748 { 743 749 int status= 0; 744 int an ull;745 double dnull= 0.;746 float fnull= 0.;747 int inull= 0;748 char* cnull= "";750 int anynul; 751 double dnull= dnull_; 752 float fnull= fnull_; 753 int inull= inull_; 754 char* cnull= const_cast<char*>(cnull_.c_str()); 749 755 int dcount = 0.; 750 756 int fcount = 0.; … … 769 775 case FitsDataType_double : 770 776 { 771 fits_read_col(fptr_,TDOUBLE,ncol+1,ligneALire,premierElement,1,&dnull,&ddata[dcount++],&an ull,&status);777 fits_read_col(fptr_,TDOUBLE,ncol+1,ligneALire,premierElement,1,&dnull,&ddata[dcount++],&anynul,&status); 772 778 break; 773 779 } 774 780 case FitsDataType_float : 775 fits_read_col(fptr_,TFLOAT,ncol+1,ligneALire,premierElement,1,&fnull,&fdata[fcount++],&an ull,&status);781 fits_read_col(fptr_,TFLOAT,ncol+1,ligneALire,premierElement,1,&fnull,&fdata[fcount++],&anynul,&status); 776 782 break; 777 783 case FitsDataType_int : 778 784 fits_read_col(fptr_,TINT,ncol+1,ligneALire,premierElement,1,&inull,&idata[icount++], 779 &an ull,&status);785 &anynul,&status); 780 786 break; 781 787 case FitsDataType_long : 782 fits_read_col(fptr_,TLONG,ncol+1,ligneALire,premierElement,1,&inull,&idata[icount++], &an ull,&status);788 fits_read_col(fptr_,TLONG,ncol+1,ligneALire,premierElement,1,&inull,&idata[icount++], &anynul,&status); 783 789 case FitsDataType_byte : 784 790 { 785 791 unsigned char uschar = 0; 786 fits_read_col(fptr_,TBYTE,ncol+1,ligneALire,premierElement,1,&inull,&uschar, &an ull,&status);792 fits_read_col(fptr_,TBYTE,ncol+1,ligneALire,premierElement,1,&inull,&uschar, &anynul,&status); 787 793 idata[icount++] = (int)uschar; 788 794 } 789 795 break; 790 796 case FitsDataType_char : 791 fits_read_col(fptr_,TSTRING,ncol+1,ligneALire,premierElement,1,cnull,&cdata[ccount++],&an ull,&status);797 fits_read_col(fptr_,TSTRING,ncol+1,ligneALire,premierElement,1,cnull,&cdata[ccount++],&anynul,&status); 792 798 break; 793 799 } … … 806 812 { 807 813 int status= 0; 808 int an ull;809 double dnull= 0.;810 float fnull= 0.;811 int inull= 0;812 char* cnull= "";814 int anynul; 815 double dnull= dnull_; 816 float fnull= fnull_; 817 int inull= inull_; 818 char* cnull= const_cast<char*>(cnull_.c_str()); 813 819 int dcount = 0.; 814 820 int fcount = 0.; … … 822 828 { 823 829 case FitsDataType_double : 824 fits_read_col(fptr_,TDOUBLE,ncol+1,NoLine+1,1,1,&dnull,&ligne.ddata_[dcount++],&an ull,&status);830 fits_read_col(fptr_,TDOUBLE,ncol+1,NoLine+1,1,1,&dnull,&ligne.ddata_[dcount++],&anynul,&status); 825 831 break; 826 832 case FitsDataType_float : 827 fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&ligne.fdata_[fcount++],&an ull,&status);833 fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&ligne.fdata_[fcount++],&anynul,&status); 828 834 break; 829 835 case FitsDataType_int : 830 fits_read_col(fptr_,TINT,ncol+1,NoLine+1,1,1,&inull,&ligne.idata_[icount++], &an ull,&status);836 fits_read_col(fptr_,TINT,ncol+1,NoLine+1,1,1,&inull,&ligne.idata_[icount++], &anynul,&status); 831 837 break; 832 838 case FitsDataType_long : 833 fits_read_col(fptr_,TLONG,ncol+1,NoLine+1,1,1,&inull,&ligne.ldata_[icount++], &an ull,&status);839 fits_read_col(fptr_,TLONG,ncol+1,NoLine+1,1,1,&inull,&ligne.ldata_[icount++], &anynul,&status); 834 840 break; 835 841 case FitsDataType_byte : 836 fits_read_col(fptr_,TBYTE,ncol+1,NoLine+1,1,1,&inull,&ligne.bdata_[icount++], &an ull,&status);842 fits_read_col(fptr_,TBYTE,ncol+1,NoLine+1,1,1,&inull,&ligne.bdata_[icount++], &anynul,&status); 837 843 break; 838 844 case FitsDataType_char : 839 845 char* chaine = new char[taille_des_chaines_[ccount]]; 840 fits_read_col(fptr_,TSTRING,ncol+1,NoLine+1,1,1,cnull,&chaine,&an ull,&status);846 fits_read_col(fptr_,TSTRING,ncol+1,NoLine+1,1,1,cnull,&chaine,&anynul,&status); 841 847 ligne.cdata_[ccount++] = string(chaine); 842 848 break; … … 857 863 { 858 864 int status= 0; 859 int an ull;860 float fnull= 0.;865 int anynul; 866 float fnull= fnull_; 861 867 long nels=1; 862 868 int ncol; 863 869 for (ncol=0; ncol<nbcols_; ncol++) 864 870 { 865 fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&fdata[ncol],&an ull,&status);871 fits_read_col(fptr_,TFLOAT,ncol+1,NoLine+1,1,1,&fnull,&fdata[ncol],&anynul,&status); 866 872 if (status) 867 873 { … … 892 898 } 893 899 long nels=nentries; 894 int anull; 895 // no checking for undefined pixels 896 double dnull= 0.; 897 // fits_read_key(fptr_,TDOUBLE,"BAD_DATA",&dnull,NULL,&status); 898 // if (status != 0) 899 // { 900 // dnull = -1.6375e30; // default value 901 // status = 0; 902 // } 903 // if (nentries != nrows_*repeat) 904 // { 905 // cout << " found " << nentries << " pixels, expected: " << nrows_*repeat << endl; 906 // throw PException(" FitsFile:::GetBinTabFCol "); 907 // } 900 int anynul; 901 double dnull= dnull_; 902 908 903 fits_read_col(fptr_,TDOUBLE,NoCol+1,1,1,nels,&dnull,valeurs, 909 &an ull,&status);904 &anynul,&status); 910 905 if( status ) 911 906 { … … 931 926 } 932 927 long nels=nentries; 933 int anull; 934 // no checking for undefined pixels 935 float fnull= 0.; 936 // fits_read_key(fptr_,TFLOAT,"BAD_DATA",&fnull,NULL,&status); 937 // if (status != 0) 938 // { 939 // fnull = -1.6375e30; // default value 940 // status = 0; 941 // } 942 // if (nentries != nrows_*repeat) 943 // { 944 // cout << " found " << nentries << " pixels, expected: " << nrows_*repeat << endl; 945 // throw PException(" FitsFile:::GetBinTabFCol "); 946 // } 928 int anynul; 929 float fnull= fnull_; 947 930 fits_read_col(fptr_,TFLOAT,NoCol+1,1,1,nels,&fnull,valeurs, 948 &an ull,&status);931 &anynul,&status); 949 932 if( status ) printerrorAndContinue( status,"erreur lecture de colonne" ); 950 933 } … … 967 950 } 968 951 long nels=nentries; 969 // no checking for undefined pixels 970 int anull; 971 int inull= 0; 972 // fits_read_key(fptr_,TINT,"BAD_DATA",&inull,NULL,&status); 973 // if (status != 0) 974 // { 975 // inull = -999999; // default value 976 // status = 0; 977 // } 978 // if (nentries != nrows_*repeat) 979 // { 980 // cout << " found " << nentries << " pixels, expected: " << nrows_*repeat << endl; 981 // throw PException(" FitsFile:::GetBinTabFCol "); 982 // } 952 int anynul; 953 int inull= inull_; 983 954 984 955 … … 986 957 // voir commentaire dans putColToFits() 987 958 fits_read_col(fptr_,TINT,NoCol+1,1,1,nels,&inull,valeurs, 988 &an ull,&status);959 &anynul,&status); 989 960 if( status ) printerrorAndContinue( status,"erreur lecture de colonne" ); 990 961 } … … 1006 977 } 1007 978 long nels=nentries; 1008 // no checking for undefined pixels 1009 int anull; 1010 char* cnull= ""; 1011 // if (nentries != nrows_*repeat/width) 1012 // { 1013 // cout << " found " << nentries << " pixels, expected: " << nrows_*repeat/width << endl; 1014 // throw PException(" FitsFile:::GetBinTabFCol "); 1015 // } 979 int anynul; 980 char* cnull= const_cast<char*>(cnull_.c_str()); 1016 981 long frow=1; 1017 982 long felem=1; 1018 983 fits_read_col(fptr_,TSTRING,NoCol+1,frow,felem,nels,cnull,valeurs, 1019 &an ull,&status);984 &anynul,&status); 1020 985 if( status ) printerrorAndContinue( status,"erreur lecture de colonne" ); 1021 986 } … … 1039 1004 } 1040 1005 1041 // no checking for undefined pixels 1042 int anull; 1043 double dnull= 0.; 1006 int anynul; 1007 double dnull= dnull_; 1044 1008 1045 1009 long nels= nentries; 1046 fits_read_img(fptr_,TDOUBLE,1,nels,&dnull,map,&an ull,&status);1010 fits_read_img(fptr_,TDOUBLE,1,nels,&dnull,map,&anynul,&status); 1047 1011 if( status ) printerror( status ); 1048 1012 } … … 1072 1036 cout << " Conversion to float achieved by cfitsio lib" << endl; 1073 1037 } 1074 // no checking for undefined pixels 1075 int anull; 1076 float fnull= 0.; 1038 int anynul; 1039 float fnull= fnull_; 1077 1040 1078 1041 long nels= nentries; 1079 fits_read_img(fptr_,TFLOAT,1,nels,&fnull, map,&an ull,&status);1042 fits_read_img(fptr_,TFLOAT,1,nels,&fnull, map,&anynul,&status); 1080 1043 if( status ) printerror( status ); 1081 1044 } … … 1105 1068 cout << " Conversion to float achieved by cfitsio lib" << endl; 1106 1069 } 1107 // no checking for undefined pixels 1108 int anull; 1109 float fnull= 0.; 1070 int anynul; 1071 float fnull= fnull_; 1110 1072 1111 1073 long nels= nentries; 1112 fits_read_img(fptr_,TINT,1,nels,&fnull,map,&an ull,&status);1074 fits_read_img(fptr_,TINT,1,nels,&fnull,map,&anynul,&status); 1113 1075 if( status ) printerror( status ); 1114 1076 } … … 1327 1289 case 'C': 1328 1290 fits_read_key(fileptr,TSTRING,keyname,strval,comment,&status); 1291 if ( strncmp(keyname,"TTYPE",5) == 0 || 1292 strncmp(keyname,"TFORM",5) == 0 || 1293 strncmp(keyname,"TBCOL",5) == 0 ) break; 1329 1294 dvl[keyname]= strval; 1330 1295 dvl.SetComment(keyname, comment); … … 1352 1317 } 1353 1318 } 1354 // dvl_.Print();1319 // dvl.Print(); 1355 1320 } 1356 1321 … … 1811 1776 int k; 1812 1777 int status= 0; 1813 int an ull;1778 int anynul; 1814 1779 int ncol=0; 1815 1780 long nels=1; -
trunk/SophyaExt/FitsIOServer/fitsfile.h
r1771 r1978 249 249 250 250 void InitNull(); 251 251 252 void getHeaderWithSophyaObject(); 252 253 static void KeywordsIntoDVList(fitsfile* fileptr, DVList& dvl, int hdunum); … … 264 265 DVList dvl_; /**< DVList for transferring keywords */ 265 266 vector<int> taille_des_chaines_; /**< Bintable parameters: length of the char* variables */ 267 268 double dnull_; 269 float fnull_; 270 int inull_; 271 string cnull_; 272 273 266 274 267 275 };
Note:
See TracChangeset
for help on using the changeset viewer.