// Eric Aubourg // Christophe Magneville // Reza Ansari // $Id: fitsringrdr.cc,v 1.2 2003-03-26 09:18:44 cecile Exp $ #include "fitsringrdr.h" #include "toimanager.h" #include extern void fits_lock(); extern void fits_unlock(); FITSRingReader::FITSRingReader(string fn,int buff_sz) { fname = fn; allfn.push_back(fn); cout<<"FITSRingReader::FITSRingReader"<0) ? buffsz: 1024; return; } void FITSRingReader::openFile(string fn) { cout << "(((((((((((((((((((((((((((((((((((((((((((" << endl; fits_lock(); if (fptr) { fits_close_file(fptr,&fstatus); fptr = NULL; } fname = fn; cout << "FITSRingReader::open FileName=" << fname << endl; fstatus = 0; // Open file fits_open_file(&fptr,fname.c_str(),READONLY,&fstatus); if (fstatus != 0) { fits_report_error(stderr, fstatus); fits_unlock(); throw IOExc("FITSRingReader::openFile() fitsio error"); } // Go to first extension, which should be a BINTABLE int simple, bitpix, naxis; long naxes; long pcount, gcount; int extend; fits_read_imghdr(fptr, 1, &simple, &bitpix, &naxis, &naxes, &pcount, &gcount, &extend, &fstatus); fits_movabs_hdu(fptr, 2, NULL, &fstatus); fits_get_num_cols(fptr,&nSamples,&fstatus); cout << "FITSRingReader nSamples = " << nSamples << endl; fits_unlock(); } void FITSRingReader::init() { declareOutput("CircTheta"); declareOutput("CircPhi"); declareOutput("signal"); } int FITSRingReader::calcMinOut() { chkinit(); TOIManager* mgr = TOIManager::getManager(); int firstReq = mgr->getRequestedBegin(); return snBegin > firstReq ? snBegin : firstReq; } int FITSRingReader::calcMaxOut() { chkinit(); TOIManager* mgr = TOIManager::getManager(); int lastReq = mgr->getRequestedEnd(); return snEnd < lastReq ? snEnd : lastReq; } // ajout vf 31/07/2002 bool FITSRingReader::checkSampleLimits(long& min, long& max, int pass) { bool sample_ok=true; chkinit(); return TOIProcessor::checkSampleLimits(min, max, pass); } void FITSRingReader::calcSampleLimits(long& min, long& max) { chkinit(); cout << "calc " << name << " in " << min << " - " << max << " ; " << snBegin << " - " << snEnd << endl; min=minsnMax?snMax:max; snBegin=snMin; snEnd=snMax; cout << "calc " << name << " out " << min << " - " << max << " ; " << snBegin << " - " << snEnd << endl; //cout << "fitstoirdr : limites temporaires calculees : " << snBegin << " , " << snEnd << endl; } // fin ajout vf void FITSRingReader::run() { fits_lock(); fits_read_key(fptr, TLONG, "NCIRCLES", &nRings, "Number of rings", &fstatus); fits_unlock(); char xname[100],buf[100]; double theta,phi; int anyNul; for (int ring = 0; ring