- Timestamp:
- 12/01/11 11:14:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fitsdump.cc
r12493 r12674 671 671 672 672 int status = 0; 673 for (int i=1; i<=fTable->rows(); i++) 673 int endIndex = (fColMap.find("Time") == fColMap.end()) ? fTable->rows()-1 : fTable->rows(); 674 for (int i=1; i<=endIndex; i++) 674 675 { 675 676 fits_read_tblbytes(fFile->fitsPointer(), i, 1, size, fitsBuffer, &status); … … 893 894 for (unsigned int i=0;i<list.size();i++) 894 895 totalSize += ranges[i].second - ranges[i].first; 895 cout << "Total size: " << totalSize << endl;896 // cout << "Total size: " << totalSize << endl; 896 897 vector<QwtPlotCurve*> curves(totalSize); 897 898 int ii=0; … … 941 942 } 942 943 //add the time column to the given columns 943 MyColumn* timeCol = static_cast<MyColumn*>(fColMap.find("Time")->second); 944 if (!timeCol) 944 if (fColMap.find("Time") == fColMap.end() && fColMap.find("UnixTimeUTC") == fColMap.end()) 945 945 { 946 946 cerr << "Error: time column could not be found in given table. Aborting" << endl; 947 947 return false; 948 948 } 949 MyColumn* timeCol; 950 bool unixTime = false; 951 int endIndex = 0; 952 if (fColMap.find("Time") != fColMap.end()) 953 { 954 timeCol = static_cast<MyColumn*>(fColMap.find("Time")->second); 955 ranges.push_back(make_pair(0,1)); 956 endIndex = fTable->rows(); 957 } 958 if (fColMap.find("UnixTimeUTC") != fColMap.end()) 959 { 960 timeCol = static_cast<MyColumn*>(fColMap.find("UnixTimeUTC")->second); 961 ranges.push_back(make_pair(0,2)); 962 endIndex = fTable->rows()-1; 963 unixTime = true; 964 } 949 965 columns.push_back(timeCol); 950 ranges.push_back(make_pair(0,1));951 966 ///// 952 967 const int size = offsets[offsets.size()-1]; … … 966 981 yValues = new double[fTable->rows()]; 967 982 968 for (int i=1; i<=fTable->rows(); i++) 983 984 for (int i=1; i<=endIndex; i++) 969 985 { 970 986 fits_read_tblbytes(fFile->fitsPointer(), i, 1, size, fitsBuffer, &status); … … 986 1002 // cout << (*it)[i-1] << " "; 987 1003 } 988 str >> yValues[i-1]; 1004 if (unixTime) 1005 { 1006 long u1, u2; 1007 str >> u1 >> u2; 1008 // cout << u1 << " " << u2; 1009 boost::posix_time::ptime unixTimeT( boost::gregorian::date(1970, boost::gregorian::Jan, 1), 1010 boost::posix_time::seconds(u1) + boost::posix_time::microsec(u2)); 1011 1012 Time mjdTime(unixTimeT); 1013 yValues[i-1] = mjdTime.Mjd(); 1014 // cout << " " << mjdTime.Mjd() << endl; 1015 } 1016 else 1017 { 1018 str >> yValues[i-1]; 1019 } 989 1020 if (i==1) 990 1021 { … … 999 1030 auto jt = xValues.begin(); 1000 1031 for (auto it=curves.begin(); it != curves.end(); it++, jt++) 1001 (*it)->setRawData(yValues, *jt, fTable->rows());1032 (*it)->setRawData(yValues, *jt, endIndex); 1002 1033 1003 1034 QStack<QRectF> stack; … … 1033 1064 a.exec(); 1034 1065 1066 1035 1067 for (auto it = curves.begin(); it != curves.end(); it++) 1068 { 1069 (*it)->detach(); 1036 1070 delete *it; 1071 } 1072 grid->detach(); 1037 1073 for (auto it = xValues.begin(); it != xValues.end(); it++) 1038 1074 delete[] *it;
Note:
See TracChangeset
for help on using the changeset viewer.