#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::afterinit() { if (inTOIs) delete[] inTOIs; inTOIs = new (TOI*[fwinputs.size()]); for (int i=0; i::iterator ii = inIx.begin(); ii != inIx.end(); ii++) { int j = (*ii).second; if (outFlags) j += j; int ck = j+1; coln[ck] = (*ii).first; colnames[ck] = const_cast(coln[ck].c_str()); cout << " Column[" << ck << "] Name=" << coln[ck] << endl; coltypes[ck] = "1D"; colunits[ck] = "double"; if (outFlags) { ck++; coln[ck] = "fg_" + coln[ck-1]; colnames[ck] = const_cast(coln[ck].c_str()); cout << " Column[" << ck << "] -Flag- Name=" << coln[ck] << endl; coltypes[ck] = "1I"; colunits[ck] = "Int_8Flag"; } } 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; delete[] coln; // Add headers ? // loop int fitsLine = 1; int snb = getMinIn(); int sne = getMaxIn(); double* tabdata = new double[ndata]; int* tabflag = new int[ndata]; // ? pas int_8 ?? $CHECK$ - Reza bool* tabck = new bool[ndata]; int i; for(i=0; i