Changeset 888


Ignore:
Timestamp:
03/08/06 13:15:06 (19 years ago)
Author:
mar637
Message:

Fixed all nXYZ() functions, to get row 0 NOT the number 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r884 r888  
    407407  } else {
    408408    // take the first POLNO,IFNO,CYCLENO as nbeam shouldn't vary with these
    409     Table tab = table_(table_.col("SCANNO") == scanno
    410                        && table_.col("POLNO") == 0
    411                        && table_.col("IFNO") == 0
    412                        && table_.col("CYCLENO") == 0 );
    413     ROTableVector<uInt> v(tab, "BEAMNO");
     409    Table t = table_(table_.col("SCANNO") == scanno);
     410    ROTableRow row(t);
     411    const TableRecord& rec = row.get(0);
     412    Table subt = t( t.col("IFNO") == Int(rec.asuInt("IFNO"))
     413                    && t.col("POLNO") == Int(rec.asuInt("POLNO"))
     414                    && t.col("CYCLENO") == Int(rec.asuInt("CYCLENO")) );
     415    ROTableVector<uInt> v(subt, "BEAMNO");
    414416    return int(v.nelements());
    415417  }
     
    425427  } else {
    426428    // take the first POLNO,BEAMNO,CYCLENO as nbeam shouldn't vary with these
    427     Table tab = table_(table_.col("SCANNO") == scanno
    428                        && table_.col("POLNO") == 0
    429                        && table_.col("BEAMNO") == 0
    430                        && table_.col("CYCLENO") == 0 );
    431     ROTableVector<uInt> v(tab, "IFNO");
     429    Table t = table_(table_.col("SCANNO") == scanno);
     430    ROTableRow row(t);
     431    const TableRecord& rec = row.get(0);
     432    Table subt = t( t.col("BEAMNO") == Int(rec.asuInt("BEAMNO"))
     433                    && t.col("POLNO") == Int(rec.asuInt("POLNO"))
     434                    && t.col("CYCLENO") == Int(rec.asuInt("CYCLENO")) );
     435    if ( subt.nrow() == 0 ) return 0;
     436    ROTableVector<uInt> v(subt, "IFNO");
    432437    return int(v.nelements());
    433438  }
     
    443448  } else {
    444449    // take the first POLNO,IFNO,CYCLENO as nbeam shouldn't vary with these
    445     Table tab = table_(table_.col("SCANNO") == scanno
    446                        && table_.col("IFNO") == 0
    447                        && table_.col("BEAMNO") == 0
    448                        && table_.col("CYCLENO") == 0 );
    449     ROTableVector<uInt> v(tab, "POLNO");
     450    Table t = table_(table_.col("SCANNO") == scanno);
     451    ROTableRow row(t);
     452    const TableRecord& rec = row.get(0);
     453    Table subt = t( t.col("BEAMNO") == Int(rec.asuInt("BEAMNO"))
     454                    && t.col("IFNO") == Int(rec.asuInt("IFNO"))
     455                    && t.col("CYCLENO") == Int(rec.asuInt("CYCLENO")) );
     456    if ( subt.nrow() == 0 ) return 0;
     457    ROTableVector<uInt> v(subt, "POLNO");
    450458    return int(v.nelements());
    451459  }
     
    466474    return n;
    467475  } else {
    468     // take the first POLNO,IFNO,CYCLENO as nbeam shouldn't vary with these
    469     Table tab = table_(table_.col("SCANNO") == scanno
    470                        && table_.col("BEAMNO") == 0
    471                        && table_.col("IFNO") == 0
    472                        && table_.col("POLNO") == 0 );
    473     return int(tab.nrow());
     476    Table t = table_(table_.col("SCANNO") == scanno);
     477    ROTableRow row(t);
     478    const TableRecord& rec = row.get(0);
     479    Table subt = t( t.col("BEAMNO") == Int(rec.asuInt("BEAMNO"))
     480                    && t.col("POLNO") == Int(rec.asuInt("POLNO"))
     481                    && t.col("IFNO") == Int(rec.asuInt("IFNO")) );
     482    if ( subt.nrow() == 0 ) return 0;
     483    return int(subt.nrow());
    474484  }
    475485  return 0;
     
    490500  } else {
    491501    // take the first SCANNO,POLNO,BEAMNO,CYCLENO as nbeam shouldn't vary with these
    492     Table tab = table_(table_.col("SCANNO") == 0
    493                        && table_.col("IFNO") == ifno
    494                        && table_.col("BEAMNO") == 0
    495                        && table_.col("POLNO") == 0
    496                        && table_.col("CYCLENO") == 0 );
    497     ROArrayColumn<Float> v(tab, "SPECTRA");
     502    Table t = table_(table_.col("IFNO") == ifno);
     503    if ( t.nrow() == 0 ) return 0;
     504    ROArrayColumn<Float> v(t, "SPECTRA");
    498505    return v(0).nelements();
    499506  }
Note: See TracChangeset for help on using the changeset viewer.