Changeset 16944 for trunk/FACT++/src
- Timestamp:
- 07/02/13 10:22:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fitsCompressor.cc
r16898 r16944 424 424 bool setHeaderKey(const HeaderEntry&); 425 425 426 bool changeHeaderKey(const string& origName, const string& newName); 427 426 428 ///@brief open a new fits file 427 429 bool open(const string& fileName, const string& tableName="Data"); … … 931 933 } 932 934 935 bool CompressedFitsWriter::changeHeaderKey(const string& origName, const string& newName) 936 { 937 for (vector<HeaderEntry>::iterator it=_header.begin(); it != _header.end(); it++) 938 { 939 if (it->key() == origName) 940 { 941 (*it) = HeaderEntry(newName, it->value(), it->comment()); 942 _headerFlushed = false; 943 return true; 944 } 945 } 946 for (vector<HeaderEntry>::iterator it=_defaultHeader.begin(); it != _defaultHeader.end(); it++) 947 { 948 if (it->key() == origName) 949 { 950 (*it) = HeaderEntry(newName, it->value(), it->comment()); 951 _headerFlushed = false; 952 return true; 953 } 954 } 955 return false; 956 } 933 957 /**************************************************************** 934 958 * OPEN … … 1134 1158 else 1135 1159 { 1136 setHeaderKey(HeaderEntry("NAXIS1", _ rowWidth, "width of table in bytes"));1160 setHeaderKey(HeaderEntry("NAXIS1", _columns.size()*2*sizeof(int64_t), "width of table in bytes")); 1137 1161 setHeaderKey(HeaderEntry("NAXIS2", 0, "")); 1138 1162 setHeaderKey(HeaderEntry("TFIELDS", _columns.size(), "number of fields in each row")); 1139 1163 setHeaderKey(HeaderEntry("PCOUNT", 0, "size of special data area")); 1164 changeHeaderKey("THEAP", "ZHEAP"); 1140 1165 } 1141 1166 ostringstream str; … … 1849 1874 Checksum rawsum; 1850 1875 //Convert each row one after the other 1876 ostringstream wrongChannels; 1877 map<int, int> wrongChannelsMap; 1878 for (uint32_t i=0;i<1440;i++) 1879 wrongChannelsMap[i] = 0; 1851 1880 for (uint32_t i=0;i<inFile.GetNumRows();i++) 1852 1881 { … … 1878 1907 { 1879 1908 const int thisStartCell = reinterpret_cast<int16_t*>(&buffer[startCellOffset])[j]; 1880 if (thisStartCell < 0) continue; 1909 if (thisStartCell > 1023) 1910 { 1911 wrongChannelsMap[j]++; 1912 wrongChannels << j; 1913 } 1914 if (thisStartCell < 0) continue; 1881 1915 for (int k=0;k<numSlices;k++) 1882 1916 reinterpret_cast<int16_t*>(&buffer[dataOffset])[numSlices*j + k] -= drsCalib16[1024*j + (thisStartCell+k)%1024]; … … 1885 1919 outFile.writeBinaryRow(buffer); 1886 1920 }; 1921 1922 if (wrongChannels.str() != "") 1923 { 1924 cout << "ERROR: Wrong channels: "; 1925 for (uint32_t i=0;i<1440;i++) 1926 { 1927 if (wrongChannelsMap[i] != 0) 1928 cout << i << "(" << wrongChannelsMap[i] << ") "; 1929 } 1930 cout << endl; 1931 exit(-1); 1932 } 1887 1933 ostringstream strSum; 1888 1934 strSum << rawsum.val(); … … 1953 1999 k == "TFIELDS" || k == "ZTABLE" || k == "ZNAXIS1" || k == "ZNAXIS2" || 1954 2000 k == "ZHEAPPTR" || k == "ZPCOUNT" || k == "ZTILELEN" || k == "THEAP" || 1955 k == "CHECKSUM" || k == "DATASUM" || k == "FCTCPVER" )2001 k == "CHECKSUM" || k == "DATASUM" || k == "FCTCPVER" || k == "ZHEAP") 1956 2002 { 1957 2003 continue;
Note:
See TracChangeset
for help on using the changeset viewer.