#include "fitstoiwtr.h" #include "toimanager.h" extern void fits_lock(); extern void fits_unlock(); FITSTOIWriter::FITSTOIWriter(string fn) { fname = fn; fstatus = 0; outFlags = false; // Open file remove(fname.c_str()); fits_lock(); fits_create_file(&fptr,fname.c_str(),&fstatus); fits_unlock(); name = "wtr"; } FITSTOIWriter::~FITSTOIWriter() { } void FITSTOIWriter::setOutFlags(bool yn) { outFlags = yn; } void FITSTOIWriter::addInput(string name, TOI* toi) { declareInput(name); fwinputs.push_back(toi); } void FITSTOIWriter::run() { cout << "fitstoiwriter running" << endl; // init done here delete[] inTOIs; inTOIs = new (TOI*[fwinputs.size()]); for (int i=0; i::iterator i = inIx.begin(); i != inIx.end(); i++) { int j = (*i).second; string n = (*i).first; if (outFlags) j += j; colnames[j+1] = const_cast(n.c_str()); coltypes[j+1] = "1D"; colunits[j+1] = "?"; if (outFlags) { colnames[j+2] = const_cast((n+"_flg").c_str()); coltypes[j+2] = "1D"; colunits[j+2] = "?"; } } fits_lock(); fits_create_tbl(fptr, BINARY_TBL, 0, ncols, colnames, coltypes, colunits, NULL, &fstatus); fits_write_date(fptr, &fstatus); fits_unlock(); delete[] colunits; delete[] coltypes; delete[] colnames; // Add headers ? // loop int fitsLine = 1; int snb = getMinIn(); int sne = getMaxIn(); for (int sn = snb; sn <= sne; sn++) { try { fits_lock(); double xx = sn; fits_write_col_dbl(fptr, 1, fitsLine, 1, 1, &xx, &fstatus); fits_unlock(); for (int i=0; i