Changeset 1369 in Sophya for trunk/ArchTOIPipe


Ignore:
Timestamp:
Jan 3, 2001, 5:59:25 PM (25 years ago)
Author:
aubourg
Message:

flag handling

Location:
trunk/ArchTOIPipe/Kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/Kernel/fitstoiwtr.cc

    r1365 r1369  
    1010  fname = fn;
    1111  fstatus = 0;
     12  outFlags = false;
    1213
    1314  // Open file
     
    2021
    2122FITSTOIWriter::~FITSTOIWriter() {
     23}
     24
     25void FITSTOIWriter::setOutFlags(bool yn) {
     26  outFlags = yn;
    2227}
    2328
     
    3843  }
    3944
    40   int ncols = inIx.size();
     45  int ndata = inIx.size();
     46  int ncols = inIx.size() * (outFlags ? 2 : 1) + 1;
    4147
    4248  char** colnames = new (char*[ncols]);
     
    4450  char** colunits = new (char*[ncols]);
    4551
     52  colnames[0] = "samplenum";
     53  coltypes[0] = "1D";
     54  colunits[0] = "integer";
     55
    4656  for (map<string, int>::iterator i = inIx.begin(); i != inIx.end(); i++) {
    4757    int j = (*i).second;
    4858    string n = (*i).first;
    49     colnames[j] = const_cast<char*>(n.c_str());
    50     coltypes[j] = "1D";
    51     colunits[j] = "?";
     59    if (outFlags) j += j;
     60    colnames[j+1] = const_cast<char*>(n.c_str());
     61    coltypes[j+1] = "1D";
     62    colunits[j+1] = "?";
     63    if (outFlags) {
     64      colnames[j+2] = const_cast<char*>((n+"_flg").c_str());
     65      coltypes[j+2] = "1D";
     66      colunits[j+2] = "?";
     67    }
    5268  }
    5369
     
    6682
    6783  int fitsLine = 1;
    68   TOIManager* mgr = TOIManager::getManager();
    69   // int snb = mgr->getRequestedBegin();
    70   //int sne = mgr->getRequestedEnd();
    7184  int snb = getMinIn();
    7285  int sne = getMaxIn();
     
    7487  for (int sn = snb; sn <= sne; sn++) {
    7588    try {
    76       for (int i=0; i<ncols; i++) {
    77         //      cout << "wtr req " << sn << endl;
     89      fits_lock();
     90      double xx = sn;
     91      fits_write_col_dbl(fptr, 1, fitsLine, 1, 1, &xx, &fstatus);
     92      fits_unlock();
     93      for (int i=0; i<ndata; i++) {
    7894        double x = getData(i, sn);
    79         //      cout << "wtr got " << sn << endl;
    8095        fits_lock();
    81         fits_write_col_dbl(fptr, i+1, fitsLine, 1, 1, &x, &fstatus);
     96        if (outFlags) {
     97          fits_write_col_dbl(fptr, 2*i+2, fitsLine, 1, 1, &x, &fstatus);
     98          x = getFlag(i, sn);
     99          fits_write_col_dbl(fptr, 2*i+3, fitsLine, 1, 1, &x, &fstatus);
     100        } else {
     101          fits_write_col_dbl(fptr, i+2, fitsLine, 1, 1, &x, &fstatus);
     102        }
    82103        if (fstatus != 0) {
    83104          cerr << "fitstoiwtr error sn = " << sn << " i = "<< i << endl;
  • trunk/ArchTOIPipe/Kernel/fitstoiwtr.h

    r1365 r1369  
    1818  virtual void  addInput(string name, TOI* toi);
    1919
     20  virtual void  setOutFlags(bool yn = true);
     21
    2022  //virtual void  init(); 
    2123  virtual void  run(); 
     
    2628  int fstatus;
    2729  vector<TOI*> fwinputs;
    28 
     30  bool outFlags;
    2931};
    3032
Note: See TracChangeset for help on using the changeset viewer.