15 #include <boost/regex.hpp> 46 minMaxStruct() : min(FLT_MAX), max(-FLT_MAX), average(0), squared(0), numValues(0) { }
48 void add(
long double val)
70 string ValueTypeToStr(
char type)
const;
74 void ListFileContent()
const;
75 void ListHeader(
const string& filename);
76 void ListKeywords(ostream &);
78 vector<MyColumn> InitColumns(vector<string> list);
79 vector<MyColumn> InitColumnsRoot(vector<string> &list);
81 double GetDouble(
const MyColumn &,
size_t)
const;
82 int64_t GetInteger(
const MyColumn &,
size_t)
const;
83 string Format(
const string &fmt,
const double &val)
const;
87 void Dump(ostream &,
const vector<string> &,
const vector<MyColumn> &,
const string &,
size_t,
size_t,
const string &);
88 void DumpRoot(ostream &,
const vector<string> &,
const string &,
size_t,
size_t,
const string &);
89 void DumpMinMax(ostream &,
const vector<MyColumn> &,
size_t,
size_t,
bool);
90 void DumpStats(ostream &,
const vector<MyColumn> &,
const string &,
size_t,
size_t);
93 FitsDumper(
const string &fname,
const string &tablename);
113 case 'L':
return "bool(8)";
114 case 'A':
return "char(8)";
115 case 'B':
return "byte(8)";
116 case 'I':
return "short(16)";
117 case 'J':
return "int(32)";
118 case 'K':
return "int(64)";
119 case 'E':
return "float(32)";
120 case 'D':
return "double(64)";
133 cout <<
" " << fKeyMap.find(
"EXTNAME")->second.value <<
" [";
136 for (
auto it = fColMap.begin(); it != fColMap.end(); it++)
138 cout <<
" " << it->first <<
"[" << it->second.num <<
"] (" << it->second.unit <<
":" <<
ValueTypeToStr(it->second.type) <<
") ";
139 for (
auto jt = fKeyMap.begin(); jt != fKeyMap.end(); jt++)
140 if (jt->second.value == it->first)
141 cout <<
"/ " << jt->second.comment << endl;
151 for (
auto it=fKeyMap.begin(); it != fKeyMap.end(); it++)
153 fout <<
"## " << ::left << setw(8) << it->first <<
"= ";
155 if (it->second.type==
'T')
156 fout << ::left << setw(20) << (
"'"+it->second.value+
"'");
158 fout << ::right << setw(20) << it->second.value;
160 if (!it->second.comment.empty())
161 fout <<
" / " << it->second.comment;
170 const std::vector<std::string> &tables =
GetTables();
172 cout <<
"File " <<
fFilename <<
" has " << tables.size() <<
" table(s): " << endl;
173 for (
auto it=tables.begin(); it!=tables.end(); it++)
174 cout <<
" * " << *it << endl;
179 ostream fout(cout.rdbuf());
187 cerr <<
"Cannot open output stream " << filename <<
": " << strerror(errno) << endl;
190 fout.rdbuf(sout.rdbuf());
195 fout <<
"\nTable: " << fKeyMap.find(
"EXTNAME")->second.value <<
" (rows=" <<
GetNumRows() <<
")\n";
196 if (fKeyMap.find(
"COMMENT") != fKeyMap.end())
197 fout <<
"Comment: \t" << fKeyMap.find(
"COMMENT")->second.value <<
"\n";
205 static const boost::regex expr(
"([[:word:].]+)(\\[([[:digit:]]+)?(:)?([[:digit:]]+)?\\])?");
210 for (
auto it=fColMap.begin(); it!=fColMap.end(); it++)
211 if (it->second.num>0)
212 names.push_back(it->first);
214 vector<MyColumn> vec;
216 for (
auto it=names.begin(); it!=names.end(); it++)
219 if (!boost::regex_match(*it, what, expr, boost::match_extra))
221 cerr <<
"Couldn't parse expression '" << *it <<
"' " << endl;
222 return vector<MyColumn>();
225 const string name = what[1];
227 const auto iter = fColMap.find(name);
228 if (iter==fColMap.end())
230 cerr <<
"ERROR - Column '" << name <<
"' not found in table." << endl;
231 return vector<MyColumn>();
236 const string val0 = what[3];
237 const string delim = what[4];
238 const string val1 = what[5];
240 const uint32_t
first = atol(val0.c_str());
241 const uint32_t last = (val0.empty() && delim.empty()) ? col.num-1 : (val1.empty() ? first : atoi(val1.c_str()));
245 cerr <<
"ERROR - First index " << first <<
" for column " << name <<
" exceeds number of elements " << col.num << endl;
246 return vector<MyColumn>();
251 cerr <<
"ERROR - Last index " << last <<
" for column " << name <<
" exceeds number of elements " << col.num << endl;
252 return vector<MyColumn>();
257 cerr <<
"ERROR - Last index " << last <<
" for column " << name <<
" exceeds first index " << first << endl;
258 return vector<MyColumn>();
269 vec.push_back(mycol);
280 return reinterpret_cast<const char*
>(it.
ptr)[i];
283 return reinterpret_cast<const bool*
>(it.
ptr)[i];
286 return (
unsigned int)
reinterpret_cast<const uint8_t*
>(it.
ptr)[i];
289 return reinterpret_cast<const int16_t*
>(it.
ptr)[i];
292 return reinterpret_cast<const int32_t*
>(it.
ptr)[i];
295 return reinterpret_cast<const int64_t*
>(it.
ptr)[i];
298 return reinterpret_cast<const float*
>(it.
ptr)[i];
301 return reinterpret_cast<const double*
>(it.
ptr)[i];
312 return reinterpret_cast<const char*
>(it.
ptr)[i];
315 return reinterpret_cast<const bool*
>(it.
ptr)[i];
318 return (
unsigned int)
reinterpret_cast<const uint8_t*
>(it.
ptr)[i];
321 return reinterpret_cast<const int16_t*
>(it.
ptr)[i];
324 return reinterpret_cast<const int32_t*
>(it.
ptr)[i];
327 return reinterpret_cast<const int64_t*
>(it.
ptr)[i];
330 return reinterpret_cast<const float*
>(it.
ptr)[i];
333 return reinterpret_cast<const double*
>(it.
ptr)[i];
341 switch (*format.rbegin())
364 *remove_if(rc.begin(), rc.end(), ::isspace)=0;
374 switch (*format.rbegin())
397 *remove_if(rc.begin(), rc.end(), ::isspace)=0;
411 void FitsDumper::Dump(ostream &fout,
const vector<string> &format,
const vector<MyColumn> &cols,
const string &filter,
size_t first,
size_t limit,
const string &filename)
413 void FitsDumper::Dump(ostream &fout,
const vector<string> &format,
const vector<MyColumn> &cols,
const string &,
size_t first,
size_t limit,
const string &filename)
420 if (!filter.empty() && select.Compile(filter.c_str()))
421 throw runtime_error(
"Syntax Error: TFormula::Compile failed for '"+filter+
"'");
424 fout <<
"## --------------------------------------------------------------------------\n";
425 fout <<
"## Fits file: \t" <<
fFilename <<
'\n';
427 fout <<
"## File: \t" << filename <<
'\n';
428 fout <<
"## Table: \t" << fKeyMap.find(
"EXTNAME")->second.value <<
'\n';
429 fout <<
"## NumRows: \t" <<
GetNumRows() <<
'\n';
430 fout <<
"## Comment: \t" << ((fKeyMap.find(
"COMMENT") != fKeyMap.end()) ? fKeyMap.find(
"COMMENT")->second.value :
"") <<
'\n';
433 fout <<
"## Selection: \t" << select.GetExpFormula() <<
'\n';
435 fout <<
"## --------------------------------------------------------------------------\n";
437 fout <<
"## --------------------------------------------------------------------------\n";
441 for (
auto it=cols.begin(); it!=cols.end(); it++)
443 fout <<
"# " << it->name;
445 if (it->first==it->last)
448 fout <<
"[" << it->first <<
"]";
451 fout <<
"[" << it->first <<
":" << it->last <<
"]";
453 if (!it->col.unit.empty())
454 fout <<
": " << it->col.unit;
457 num += it->last-it->first+1;
464 vector<Double_t>
data(num+1);
467 const size_t last = limit ? first + limit : size_t(-1);
471 const size_t row =
GetRow();
482 sout.precision(fout.precision());
483 sout.flags(fout.flags());
486 for (
auto it=cols.begin(); it!=cols.end(); it++, col++)
489 for (uint32_t
i=it->first; i<=it->last;
i++, p++)
491 if (col<format.size())
492 sout <<
Format(
"%"+format[col], *it,
i) <<
" ";
495 switch (it->col.type)
498 msg +=
reinterpret_cast<const char*
>(it->ptr)[
i];
501 sout << (unsigned int)reinterpret_cast<const unsigned char*>(it->ptr)[
i] <<
" ";
504 sout << reinterpret_cast<const bool*>(it->ptr)[
i] <<
" ";
507 sout << reinterpret_cast<const int16_t*>(it->ptr)[
i] <<
" ";
510 sout << reinterpret_cast<const int32_t*>(it->ptr)[
i] <<
" ";
513 sout << reinterpret_cast<const int64_t*>(it->ptr)[
i] <<
" ";
516 sout << reinterpret_cast<const float*>(it->ptr)[
i] <<
" ";
519 sout << reinterpret_cast<const double*>(it->ptr)[
i] <<
" ";
531 if (it->col.type==
'A')
532 sout <<
"'" << msg.c_str() <<
"' ";
535 if (!filter.empty() && select.EvalPar(0, data.data())<0.5)
538 fout << sout.str() << endl;
544 static const boost::regex expr(
"[^\\[]([[:word:].]+)(\\[([[:digit:]]+)\\])?");
548 vector<MyColumn> vec;
550 for (
auto it=names.begin(); it!=names.end(); it++)
557 string::const_iterator ibeg = it->begin();
558 string::const_iterator iend = it->end();
561 while (boost::regex_search(ibeg, iend, what, expr, boost::match_extra))
563 const string all = what[0];
564 const string name = what[1];
565 const size_t idx = atol(
string(what[3]).c_str());
568 const auto ic = cols.find(name);
576 if (idx>=ic->second.num)
578 cout <<
"Column '" << name <<
"' has no index " << idx <<
"." << endl;
579 return vector<MyColumn>();
584 for (; p<vec.size(); p++)
585 if (vec[p].name==name)
588 const string id =
'['+to_string(p)+
']';
592 const size_t offset = what[0].first - it->begin();
594 it->replace(ibeg-it->begin()+what.position(1), what.length()-1,
id);
596 ibeg = it->begin() + offset +
id.size();
606 mycol.
col = ic->second;
611 vec.push_back(mycol);
616 id <<
'[' << vec.size() <<
']';
618 for (
auto it=names.begin(); it!=names.end(); it++)
622 auto p = it->find_first_of(
'#');
626 it->replace(p, 1,
id.
str());
639 void FitsDumper::DumpRoot(ostream &fout,
const vector<string> &cols,
const string &filter,
size_t first,
size_t limit,
const string &filename)
645 vector<string> names(cols);
646 names.insert(names.begin(), filter);
652 vector<TFormula> form(names.size());
654 auto ifo = form.begin();
655 for (
auto it=names.begin(); it!=names.end(); it++, ifo++)
657 if (!it->empty() && ifo->Compile(it->c_str()))
658 throw runtime_error(
"Syntax Error: TFormula::Compile failed for '"+*it+
"'");
663 fout <<
"## --------------------------------------------------------------------------\n";
664 fout <<
"## Fits file: \t" <<
fFilename <<
'\n';
666 fout <<
"## File: \t" << filename <<
'\n';
667 fout <<
"## Table: \t" << fKeyMap.find(
"EXTNAME")->second.value <<
'\n';
668 fout <<
"## NumRows: \t" <<
GetNumRows() <<
'\n';
669 fout <<
"## Comment: \t" << ((fKeyMap.find(
"COMMENT") != fKeyMap.end()) ? fKeyMap.find(
"COMMENT")->second.value :
"") <<
'\n';
670 fout <<
"## --------------------------------------------------------------------------\n";
672 fout <<
"## --------------------------------------------------------------------------\n";
675 fout <<
"## Selection: " << form[0].GetExpFormula() <<
"\n##\n";
678 for (
auto it=vec.begin(); it!=vec.end(); it++, num++)
680 fout <<
"## [" << num <<
"] = " << it->name;
682 if (it->first==it->last)
685 fout <<
"[" << it->first <<
"]";
688 fout <<
"[" << it->first <<
":" << it->last <<
"]";
690 if (!it->col.unit.empty())
691 fout <<
": " << it->col.unit;
695 fout <<
"## --------------------------------------------------------------------------\n";
699 for (
auto it=form.begin()+1; it!=form.end(); it++)
700 fout <<
" \"" << it->GetExpFormula() <<
"\"";
701 fout <<
"\n#" << endl;
705 vector<Double_t>
data(vec.size()+1);
707 const size_t last = limit ? first + limit : size_t(-1);
711 const size_t row =
GetRow();
716 for (
auto it=vec.begin(); it!=vec.end(); it++, p++)
721 if (!filter.empty() && form[0].EvalPar(0,
data.data())<0.5)
724 for (
auto iform=form.begin()+1; iform!=form.end(); iform++)
725 fout << iform->EvalPar(0,
data.data()) <<
" ";
734 vector<minMaxStruct> statData(cols.size());
737 const size_t last = limit ? first + limit : size_t(-1);
741 const size_t row =
GetRow();
745 auto statsIt = statData.begin();
747 for (
auto it=cols.begin(); it!=cols.end(); it++, statsIt++)
749 if ((it->name==
"UnixTimeUTC" || it->name==
"PCTime") && it->first==0 && it->last==1)
751 const uint32_t *val =
reinterpret_cast<const uint32_t*
>(it->ptr);
752 if (fNoZeroPlease && val[0]==0 && val[1]==0)
755 statsIt->add(
Time(val[0], val[1]).Mjd());
759 for (uint32_t
i=it->first; i<=it->last;
i++)
763 if (fNoZeroPlease && cValue == 0)
766 statsIt->add(cValue);
774 auto statsIt = statData.begin();
775 for (
auto it=cols.begin(); it!=cols.end(); it++, statsIt++)
777 fout <<
"\n[" << it->name <<
':' << it->first;
778 if (it->first!=it->last)
779 fout <<
':' << it->last;
782 if (statsIt->numValues == 0)
784 fout <<
"Min: -\nMax: -\nAvg: -\nRms: -" << endl;
788 const long &num = statsIt->numValues;
790 long double &avg = statsIt->average;
791 long double &rms = statsIt->squared;
796 rms = rms<0 ? 0 : sqrt(rms);
798 fout <<
"Min: " << statsIt->min <<
'\n';
799 fout <<
"Max: " << statsIt->max <<
'\n';
800 fout <<
"Avg: " << avg <<
'\n';
801 fout <<
"Rms: " << rms << endl;
808 const size_t numElems = array.size()/
sizeof(T);
811 out <<
"Min: -\nMax: -\nMed: -\nAvg: -\nRms: -" << endl;
815 T *val =
reinterpret_cast<T*
>(array.data());
817 sort(val, val+numElems);
819 out <<
"Min: " << double(val[0]) <<
'\n';
820 out <<
"Max: " << double(val[numElems-1]) <<
'\n';
823 out <<
"Med: " << (double(val[numElems/2-1]) + double(val[numElems/2]))/2 <<
'\n';
825 out <<
"Med: " << double(val[numElems/2]) <<
'\n';
829 for (uint32_t
i=0;
i<numElems;
i++)
831 const long double v = val[
i];
839 rms = rms<0 ? 0 : sqrt(rms);
842 out <<
"Avg: " << avg <<
'\n';
843 out <<
"Rms: " << rms << endl;
847 void FitsDumper::DumpStats(ostream &fout,
const vector<MyColumn> &cols,
const string &filter,
size_t first,
size_t limit)
854 if (!filter.empty() && select.Compile(filter.c_str()))
855 throw runtime_error(
"Syntax Error: TFormula::Compile failed for '"+filter+
"'");
859 vector<vector<char>> statData;
863 for (
auto it=cols.begin(); it!=cols.end(); it++)
864 statData.emplace_back(vector<char>(it->col.size*rows*(it->last-it->first+1)));
868 for (
auto it=cols.begin(); it!=cols.end(); it++)
869 num += it->last-it->first+1;
871 vector<Double_t>
data(num+1);
875 const size_t last = limit ? first + limit : size_t(-1);
881 const size_t row =
GetRow();
892 for (
auto it=cols.begin(); it!=cols.end(); it++)
893 for (uint32_t
i=it->first; i<=it->last;
i++, p++)
896 if (select.EvalPar(0,
data.data())<0.5)
901 auto statsIt = statData.begin();
902 for (
auto it=cols.begin(); it!=cols.end(); it++, statsIt++)
904 const char *src =
reinterpret_cast<const char*
>(it->ptr);
905 const size_t sz = (it->last-it->first+1)*it->col.size;
906 memcpy(statsIt->data()+counter*sz, src+it->first*it->col.size, sz);
912 auto statsIt = statData.begin();
913 for (
auto it=cols.begin(); it!=cols.end(); it++, statsIt++)
915 fout <<
"\n[" << it->name <<
':' << it->first;
916 if (it->last!=it->first)
917 fout <<
':' << it->last;
920 const size_t sz = (it->last-it->first+1)*it->col.size;
921 statsIt->resize(counter*sz);
923 switch (it->col.type)
926 displayStats<bool>(*statsIt, fout);
929 displayStats<char>(*statsIt, fout);
932 displayStats<int16_t>(*statsIt, fout);
935 displayStats<int32_t>(*statsIt, fout);
938 displayStats<int64_t>(*statsIt, fout);
941 displayStats<float>(*statsIt, fout);
944 displayStats<double>(*statsIt, fout);
960 if (conf.
Get<
bool>(
"list"))
963 if (conf.
Get<
bool>(
"filecontent"))
966 if (conf.
Get<
bool>(
"header"))
970 if (conf.
Get<
bool>(
"header") || conf.
Get<
bool>(
"list") || conf.
Get<
bool>(
"filecontent"))
975 if (conf.
Get<
bool>(
"minmax") && conf.
Get<
bool>(
"stat"))
977 cerr <<
"Invalid combination of options: cannot do stats and minmax." << endl;
980 if (conf.
Get<
bool>(
"stat") && conf.
Get<
bool>(
"nozero"))
982 cerr <<
"Invalid combination of options: nozero only works with minmax." << endl;
986 if (conf.
Get<
bool>(
"scientific") && conf.
Get<
bool>(
"fixed"))
988 cerr <<
"Switched --scientific and --fixed are mutually exclusive." << endl;
992 if (conf.
Has(
"%") && conf.
Has(
"%%"))
994 cerr <<
"Switched --% and --%% are mutually exclusive." << endl;
1000 const string filename = conf.
Get<
string>(
"outfile");
1002 ostream fout(cout.rdbuf());
1007 sout.open(filename);
1010 cerr <<
"Cannot open output stream " << filename <<
": " << strerror(errno) << endl;
1013 fout.rdbuf(sout.rdbuf());
1016 fout.precision(conf.
Get<
int>(
"precision"));
1017 if (conf.
Get<
bool>(
"fixed"))
1019 if (conf.
Get<
bool>(
"scientific"))
1022 const string filter = conf.
Has(
"filter") ? conf.
Get<
string>(
"filter") :
"";
1023 const size_t first = conf.
Get<
size_t>(
"first");
1024 const size_t limit = conf.
Get<
size_t>(
"limit");
1027 if (conf.
Get<
bool>(
"root"))
1029 DumpRoot(fout, conf.
Vec<
string>(
"col"), filter, first, limit, filename);
1034 const vector<string> format = conf.
Vec<
string>(
"%");
1035 for (
auto it=format.begin(); it<format.end(); it++)
1037 static const boost::regex expr(
"-?[0-9]*[.]?[0-9]*[diouxXeEfFgGaAh]");
1040 if (!boost::regex_match(*it, what, expr, boost::match_extra))
1042 cerr <<
"Format '" << *it <<
"' not supported." << endl;
1047 const vector<MyColumn> cols =
InitColumns(conf.
Vec<
string>(
"col"));
1051 if (conf.
Get<
bool>(
"minmax"))
1053 DumpMinMax(fout, cols, first, limit, conf.
Get<
bool>(
"nozero"));
1057 if (conf.
Get<
bool>(
"stat"))
1059 DumpStats(fout, cols, filter, first, limit);
1063 Dump(fout, format, cols, filter, first, limit, filename);
1071 "fitsdump is a tool to dump data from a FITS table as ascii.\n" 1073 "Usage: fitsdump [OPTIONS] fitsfile col col ... \n" 1074 " or: fitsdump [OPTIONS]\n" 1076 "Addressing a column:\n" 1077 " ColumnName: Will address all fields of a column\n" 1078 " ColumnName[n]: Will address the n-th field of a column (starts with 0)\n" 1079 " ColumnName[n1:n2]: Will address all fields between n1 and including n2\n" 1082 "Selecting a column:\n" 1083 " Commandline option: --filter\n" 1084 " Explanation: Such a selection is evaluated using TFormula, hence, every " 1085 "mathematical operation allowed in TFormula is allowed there, too. " 1086 "The reference is the column index as printed in the output stream, " 1087 "starting with 1. The index 0 is reserved for the row number.\n" 1099 "In --root mode, fitsdump support TFormula's syntax for all columns and the filter " 1100 "You can then refer to a column or a (single) index of the column just by its name " 1101 "If the index is omitted, 0 is assumed. Note that the [x:y] syntax in this mode is " 1104 " fitsdump Zd --filter=\"[0]>20 && cos([1])*TMath::RadToDeg()<45\"\n" 1106 "The columns can also be addressed with their names\n" 1108 " fitsdump -r \"(Zd+Err)*TMath::DegToRad()\" --filter=\"[0]<25 && [1]<0.05\"\n" 1112 " fitsdump -r \"(Zd[0]+Err[0])*TMath::DegToRad()\" --filter=\"[0]<25 && [1]<0.05\"\n" 1114 "A special placeholder exists for the row number\n" 1116 " fitsdump -r \"#\" --filter=\"#>10 && #<100\"\n" 1118 "To format a single column you can do\n" 1120 " fitsdump col1 -%.1f col2 -%d\n" 1122 "A special format is provided converting to 'human readable format'\n" 1124 " fitsdump col1 -%h\n" 1133 po::options_description configs(
"Fitsdump options");
1134 configs.add_options()
1135 (
"filecontent",
po_switch(),
"List the number of tables in the file, along with their name")
1136 (
"header,h",
po_switch(),
"Dump header of given table")
1137 (
"list,l",
po_switch(),
"List all tables and columns in file")
1138 (
"fitsfile", var<string>()
1139 #if BOOST_VERSION >= 104200 1142 ,
"Name of FITS file")
1143 (
"col,c", vars<string>(),
"List of columns to dump\narg is a list of columns, separated by a space.\nAdditionnally, a list of sub-columns can be added\ne.g. Data[3] will dump sub-column 3 of column Data\nData[3:4] will dump sub-columns 3 and 4\nOmitting this argument dump the entire column\nnote: all indices start at zero")
1144 (
"outfile,o", var<string>(
"-"),
"Name of output file (-:/dev/stdout)")
1145 (
"precision,p", var<int>(20),
"Precision of ofstream")
1146 (
"stat,s",
po_switch(),
"Perform statistics instead of dump")
1147 (
"minmax,m",
po_switch(),
"Calculates min and max of data")
1148 (
"nozero,z",
po_switch(),
"skip 0 values for stats")
1149 (
"fixed",
po_switch(),
"Switch output stream to floating point values in fixed-point notation")
1150 (
"scientific",
po_switch(),
"Switch output stream to floating point values in scientific notation")
1151 (
"%,%", vars<string>(),
"Format for the output (currently not available in root-mode)")
1152 (
"force",
po_switch(),
"Force reading the fits file even if END key is missing")
1153 (
"first", var<size_t>(
size_t(0)),
"First number of row to read")
1154 (
"limit", var<size_t>(
size_t(0)),
"Limit for the maximum number of rows to read (0=unlimited)")
1155 (
"tablename,t", var<string>(
""),
"Name of the table to open. If not specified, first binary table is opened")
1157 (
"root,r",
po_switch(),
"Enable root mode")
1158 (
"filter,f", var<string>(
""),
"Filter to restrict the selection of events (e.g. '[0]>10 && [0]<20'; does not work with stat and minmax yet)")
1162 po::positional_options_description p;
1163 p.add(
"fitsfile", 1);
1170 int main(
int argc,
const char** argv)
1179 if (!conf.
Has(
"fitsfile"))
1181 cerr <<
"Filename required." << endl;
1185 FitsDumper loader(conf.
Get<
string>(
"fitsfile"), conf.
Get<
string>(
"tablename"));
1188 cerr <<
"ERROR - Opening " << conf.
Get<
string>(
"fitsfile");
1189 cerr <<
" failed: " << strerror(errno) << endl;
1193 return loader.
Exec(conf);
void DumpStats(ostream &, const vector< MyColumn > &, const string &, size_t, size_t)
void List()
Lists all columns of an open file.
void * SetPtrAddress(const std::string &name)
std::map< std::string, Column > Columns
void displayStats(vector< char > &array, ostream &out)
int Exec(Configuration &conf)
Configures the fitsLoader from the config file and/or command arguments.
Adds some functionality to boost::posix_time::ptime for our needs.
void SetPrintUsage(const std::function< void(void)> &func)
T Get(const std::string &var)
string ValueTypeToStr(char type) const
po::typed_value< bool > * po_switch()
size_t GetNumRows() const
std::vector< T > Vec(const std::string &var)
string Format(const string &fmt, const double &val) const
void SetArgumentPositions(const po::positional_options_description &desc)
int64_t first
Size of this column in the tile.
int64_t GetInteger(const MyColumn &, size_t) const
void ListFileContent() const
void DumpRoot(ostream &, const vector< string > &, const string &, size_t, size_t, const string &)
void ListHeader(const string &filename)
vector< MyColumn > InitColumns(vector< string > list)
void add(long double val)
const Table::Keys & GetKeys() const
bool Has(const std::string &var)
void AddOptions(const po::options_description &opt, bool visible=true)
void DumpMinMax(ostream &, const vector< MyColumn > &, size_t, size_t, bool)
void ListKeywords(ostream &)
std::map< std::string, Entry > Keys
void Dump(ostream &, const vector< string > &, const vector< MyColumn > &, const string &, size_t, size_t, const string &)
Display the selected columns values VS time.
vector< MyColumn > InitColumnsRoot(vector< string > &list)
FitsDumper(const string &fname, const string &tablename)
Commandline parsing, resource file parsing and database access.
const std::vector< std::string > & GetTables() const
int main(int argc, const char **argv)
double GetDouble(const MyColumn &, size_t) const
const Table::Columns & GetColumns() const
void SetupConfiguration(Configuration &conf)
bool DoParse(int argc, const char **argv, const std::function< void()> &func=std::function< void()>())
Dumps contents of fits tables to stdout or a file.