Changeset 1480 in Sophya for trunk/ArchTOIPipe/Kernel
- Timestamp:
- Apr 27, 2001, 11:33:51 AM (24 years ago)
- Location:
- trunk/ArchTOIPipe/Kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/Makefile.in
r1477 r1480 62 62 endif 63 63 64 ifeq ($(CXX), cxx) 65 CXXFLAGS := $(CXXFLAGS) -ptr ../cxx_repository 66 endif 67 64 68 SRCFILES = toi.cc toimanager.cc toiprocessor.cc toiseqbuff.cc \ 65 fitstoirdr.cc fitstoiwtr.cc asciitoiwtr.cc 69 fitstoirdr.cc fitstoiwtr.cc asciitoiwtr.cc \ 70 toiregwindow.cc 66 71 67 72 FILES=$(patsubst %.c,%.o,$(SRCFILES:.cc=.o)) … … 72 77 libatkern.a: $(FILES) 73 78 $(AR) -cr libatkern.a $(FILES) 74 ln libatkern.a ../libatkern.a79 ln -f libatkern.a ../libatkern.a 75 80 76 81 clean: -
trunk/ArchTOIPipe/Kernel/fitstoirdr.cc
r1454 r1480 6 6 FITSTOIReader::FITSTOIReader(string fn) { 7 7 fname = fn; 8 allfn.push_back(fn); 8 9 cout << "FITSTOIReader::FITSTOIReader" << endl; 9 10 cout << "FITSTOIReader::inited " << inited << endl; 10 11 name = "rdr"; 12 fptr = NULL; 11 13 } 12 14 … … 25 27 } 26 28 27 void FITSTOIReader:: init() {29 void FITSTOIReader::openFile(string fn) { 28 30 fits_lock(); 29 cout << "FITSTOIReader::init FileName=" << fname << endl; 31 if (fptr) { 32 fits_close_file(fptr,&fstatus); 33 fptr = NULL; 34 } 35 fname = fn; 36 cout << "FITSTOIReader::open FileName=" << fname << endl; 30 37 fstatus = 0; 31 38 // Open file … … 48 55 fits_movabs_hdu(fptr, 2, NULL, &fstatus); 49 56 50 int ncols;51 57 fits_get_num_cols(fptr,&ncols,&fstatus); 52 58 fits_get_num_rows(fptr,&nrows,&fstatus); 53 59 54 60 cout << "FITSTOIReader cols = " << ncols << " rows=" << nrows << endl; 61 int anyNul; 62 double y; 63 fits_read_col_dbl(fptr,1,1,1,1,0,&y,&anyNul,&fstatus); 64 firstSn = (int) (y+.1); 65 fits_unlock(); 66 } 55 67 68 void FITSTOIReader::init() { 69 openFile(allfn.front()); 70 71 fits_lock(); 56 72 // Dans cette version, on s'attend a ce que la premiere colonne soit le samplenum 57 73 for (int i=1; i<ncols; i++) { … … 64 80 declareOutput(colname); 65 81 } 66 int anyNul;67 double y;68 fits_read_col_dbl(fptr,1,1,1,1,0,&y,&anyNul,&fstatus);69 firstSn = (int) (y+.1);70 82 fits_unlock(); 83 84 snBegin = firstSn; 85 86 openFile(allfn.back()); 87 snEnd = firstSn+nrows-1; 88 cout << "FITSTOIReader range " << snBegin << " -> " << snEnd << endl; 71 89 } 72 90 … … 74 92 TOIManager* mgr = TOIManager::getManager(); 75 93 int firstReq = mgr->getRequestedBegin(); 76 return firstSn > firstReq ? firstSn : firstReq;94 return snBegin > firstReq ? snBegin : firstReq; 77 95 } 78 96 … … 80 98 TOIManager* mgr = TOIManager::getManager(); 81 99 int lastReq = mgr->getRequestedEnd(); 82 int lastSn = firstSn + nrows - 1; 83 return lastSn < lastReq ? lastSn : lastReq; 100 return snEnd < lastReq ? snEnd : lastReq; 84 101 } 85 102 103 void FITSTOIReader::addFile(string fn) { 104 allfn.push_back(fn); 105 } 86 106 87 107 void FITSTOIReader::run() { 108 for (vector<string>::iterator i=allfn.begin(); i!=allfn.end(); i++) { 109 openFile(*i); 110 run1(); 111 } 112 } 113 114 void FITSTOIReader::run1() { 88 115 // Il faudrait optimiser en fonction de ce qui a ete demande comme samplenum, 89 116 // mais cela implique de gerer aussi bien echant uniforme que non. -
trunk/ArchTOIPipe/Kernel/fitstoirdr.h
r1365 r1480 6 6 #include "toiprocessor.h" 7 7 #include <string> 8 #include <vector> 8 9 #include "fitsio.h" 9 10 … … 13 14 FITSTOIReader(string fn); 14 15 ~FITSTOIReader(); 16 17 virtual void addFile(string fn); 18 15 19 virtual void init(); 16 20 virtual void run(); … … 20 24 virtual int calcMaxOut(); 21 25 26 virtual void run1(); 27 virtual void openFile(string fn); 28 22 29 private: 23 string fname; 24 fitsfile *fptr; 25 int fstatus; 26 long nrows; 27 int firstSn; 30 fitsfile* fptr; 31 int fstatus; 32 string fname; // current file 33 long nrows; // current file 34 int firstSn; // current file 35 36 int ncols; 37 int snBegin; // first file 38 int snEnd; // last file 39 40 vector<string> allfn; 41 28 42 }; 29 43
Note:
See TracChangeset
for help on using the changeset viewer.