Changeset 1480 in Sophya for trunk/ArchTOIPipe/Kernel


Ignore:
Timestamp:
Apr 27, 2001, 11:33:51 AM (24 years ago)
Author:
aubourg
Message:

join & merge

Location:
trunk/ArchTOIPipe/Kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/Kernel/Makefile.in

    r1477 r1480  
    6262endif
    6363
     64ifeq ($(CXX), cxx)
     65  CXXFLAGS := $(CXXFLAGS) -ptr ../cxx_repository
     66endif
     67
    6468SRCFILES = 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
    6671
    6772FILES=$(patsubst %.c,%.o,$(SRCFILES:.cc=.o))
     
    7277libatkern.a: $(FILES)
    7378        $(AR) -cr libatkern.a $(FILES)
    74         ln libatkern.a ../libatkern.a
     79        ln -f libatkern.a ../libatkern.a
    7580
    7681clean:
  • trunk/ArchTOIPipe/Kernel/fitstoirdr.cc

    r1454 r1480  
    66FITSTOIReader::FITSTOIReader(string fn) {
    77  fname = fn;
     8  allfn.push_back(fn);
    89  cout << "FITSTOIReader::FITSTOIReader" << endl;
    910  cout << "FITSTOIReader::inited " << inited << endl;
    1011  name = "rdr";
     12  fptr = NULL;
    1113}
    1214
     
    2527}
    2628
    27 void FITSTOIReader::init() {
     29void FITSTOIReader::openFile(string fn) {
    2830  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;
    3037  fstatus = 0;
    3138  // Open file
     
    4855  fits_movabs_hdu(fptr, 2, NULL, &fstatus);
    4956 
    50   int ncols;
    5157  fits_get_num_cols(fptr,&ncols,&fstatus);
    5258  fits_get_num_rows(fptr,&nrows,&fstatus);
    5359
    5460  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}
    5567
     68void FITSTOIReader::init() {
     69  openFile(allfn.front());
     70
     71  fits_lock();
    5672  // Dans cette version, on s'attend a ce que la premiere colonne soit le samplenum
    5773  for (int i=1; i<ncols; i++) {
     
    6480    declareOutput(colname);
    6581  }
    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);
    7082  fits_unlock();
     83
     84  snBegin = firstSn;
     85
     86  openFile(allfn.back());
     87  snEnd = firstSn+nrows-1;
     88  cout << "FITSTOIReader range " << snBegin << " -> " << snEnd << endl;
    7189}
    7290
     
    7492  TOIManager* mgr = TOIManager::getManager();
    7593  int firstReq = mgr->getRequestedBegin();
    76   return firstSn > firstReq ? firstSn : firstReq;
     94  return snBegin > firstReq ? snBegin : firstReq;
    7795}
    7896
     
    8098  TOIManager* mgr = TOIManager::getManager();
    8199  int lastReq = mgr->getRequestedEnd();
    82   int lastSn  = firstSn + nrows - 1;
    83   return lastSn < lastReq ? lastSn : lastReq;
     100  return snEnd < lastReq ? snEnd : lastReq;
    84101}
    85102
     103void FITSTOIReader::addFile(string fn) {
     104  allfn.push_back(fn);
     105}
    86106
    87107void FITSTOIReader::run() {
     108  for (vector<string>::iterator i=allfn.begin(); i!=allfn.end(); i++) {
     109    openFile(*i);
     110    run1();
     111  }
     112}
     113
     114void FITSTOIReader::run1() {
    88115  // Il faudrait optimiser en fonction de ce qui a ete demande comme samplenum,
    89116  // mais cela implique de gerer aussi bien echant uniforme que non.
  • trunk/ArchTOIPipe/Kernel/fitstoirdr.h

    r1365 r1480  
    66#include "toiprocessor.h"
    77#include <string>
     8#include <vector>
    89#include "fitsio.h"
    910
     
    1314  FITSTOIReader(string fn);
    1415  ~FITSTOIReader();
     16
     17  virtual void addFile(string fn);
     18
    1519  virtual void init(); 
    1620  virtual void run(); 
     
    2024  virtual int   calcMaxOut();
    2125
     26  virtual void run1();
     27  virtual void openFile(string fn);
     28
    2229private:
    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
    2842};
    2943
Note: See TracChangeset for help on using the changeset viewer.