Changeset 347


Ignore:
Timestamp:
02/01/05 17:59:02 (20 years ago)
Author:
kil064
Message:

in getSpectralCoordinate, deal correctly (?) with restfreq if its
not there for the selected IF.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r329 r347  
    433433// Continue with km/s or Hz.  Get FreqID
    434434
    435   Vector<uInt> v;
    436   freqidCol_.get(whichRow, v);
    437   uInt specidx = v(IFSel_);
     435  Vector<uInt> freqIDs;
     436  freqidCol_.get(whichRow, freqIDs);
     437  uInt freqID = freqIDs(IFSel_);
    438438
    439439// Get SpectralCoordinate, set reference frame conversion,
    440440// velocity conversion, and rest freq state
    441441
    442   SpectralCoordinate spc = getSpectralCoordinate(specidx, whichRow);
     442  SpectralCoordinate spc = getSpectralCoordinate(freqID, whichRow);
    443443//
    444444  Vector<Double> pixel(nChan());
     
    482482  Unit u(sunit);
    483483//
    484   Vector<uInt> v;
    485   freqidCol_.get(whichRow, v);
    486   uInt specidx = v(IFSel_);
     484  Vector<uInt> freqIDs;
     485  freqidCol_.get(whichRow, freqIDs);
     486  uInt freqID = freqIDs(IFSel_);
    487487
    488488// Get SpectralCoordinate, with frame, velocity, rest freq state set
    489489
    490   SpectralCoordinate spc = getSpectralCoordinate(specidx, whichRow);
     490  SpectralCoordinate spc = getSpectralCoordinate(freqID, whichRow);
    491491//
    492492  String s = "Channel";
     
    664664
    665665
    666 SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt whichIdx) const
     666SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt freqID) const
    667667{
    668668 
    669669  Table t = table_.keywordSet().asTable("FREQUENCIES");
    670   if (whichIdx > t.nrow() ) {
    671     throw(AipsError("SDMemTable::getSpectralCoordinate - whichIdx out of range"));
     670  if (freqID> t.nrow() ) {
     671    throw(AipsError("SDMemTable::getSpectralCoordinate - freqID out of range"));
    672672  }
    673673
     
    686686    mft = MFrequency::TOPO;
    687687  }
    688   rpc.get(whichIdx, rp);
    689   rvc.get(whichIdx, rv);
    690   incc.get(whichIdx, inc);
     688  rpc.get(freqID, rp);
     689  rvc.get(freqID, rv);
     690  incc.get(freqID, inc);
    691691//
    692692  SpectralCoordinate spec(mft,rv,inc,rp);
     
    696696
    697697
    698 SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt whichIdx, uInt whichRow) const
     698SpectralCoordinate SDMemTable::getSpectralCoordinate(uInt freqID, uInt whichRow) const
    699699{
    700700// Create basic SC
    701701
    702   SpectralCoordinate spec = getSpectralCoordinate (whichIdx);
     702  SpectralCoordinate spec = getSpectralCoordinate (freqID);
    703703//
    704704  Table t = table_.keywordSet().asTable("FREQUENCIES");
    705705
    706 // Set rest frequencies
     706// Get rest frequencies from table, one per IF ???
    707707
    708708  Vector<Double> vec;
     
    713713// Select rest freq
    714714
    715     if (vec.nelements() >= nIF()) {
     715    if (IFSel_+1 < vec.nelements()) {
    716716       spec.selectRestFrequency(uInt(IFSel_));
     717    } else {
     718       cerr << "There is no rest frequency for this IF; selecting rest freq for IF=0" << endl;
     719       spec.selectRestFrequency(0u);
    717720    }
    718721  }
     
    725728  MFrequency::Types mtype;
    726729  if (!MFrequency::getType(mtype, frm)) {
    727     cout << "Frequency type unknown assuming TOPO" << endl;       // SHould never happen
     730    cerr << "Frequency type unknown assuming TOPO" << endl;       // SHould never happen
    728731    mtype = MFrequency::TOPO;
    729732  }
     
    763766
    764767Bool SDMemTable::setCoordinate(const SpectralCoordinate& speccord,
    765                                uInt whichIdx) {
     768                               uInt freqID) {
    766769  Table t = table_.rwKeywordSet().asTable("FREQUENCIES");
    767   if (whichIdx > t.nrow() ) {
     770  if (freqID > t.nrow() ) {
    768771    throw(AipsError("SDMemTable::setCoordinate - coord no out of range"));
    769772  }
     
    772775  ScalarColumn<Double> incc(t, "INCREMENT");
    773776
    774   rpc.put(whichIdx, speccord.referencePixel()[0]);
    775   rvc.put(whichIdx, speccord.referenceValue()[0]);
    776   incc.put(whichIdx, speccord.increment()[0]);
     777  rpc.put(freqID, speccord.referencePixel()[0]);
     778  rvc.put(freqID, speccord.referenceValue()[0]);
     779  incc.put(freqID, speccord.increment()[0]);
    777780
    778781  return True;
Note: See TracChangeset for help on using the changeset viewer.