Changeset 306 for trunk


Ignore:
Timestamp:
01/27/05 21:47:09 (20 years ago)
Author:
kil064
Message:

implement function getSDFreqTable which was empty before

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r303 r306  
    331331{
    332332  std::vector<string>::iterator it;
    333   String un,rfrm,dpl;
    334   un = theinfo[0];
    335   rfrm = theinfo[1];
    336   dpl = theinfo[2];
    337 
     333  String un,rfrm, brfrm,dpl;
     334  un = theinfo[0];              // Abcissa unit
     335  rfrm = theinfo[1];            // Active (or conversion) frame
     336  dpl = theinfo[2];             // Doppler
     337  brfrm = theinfo[3];           // Base frame
     338//
    338339  Table t = table_.rwKeywordSet().asTable("FREQUENCIES");
     340//
    339341  Vector<Double> rstf;
    340342  t.keywordSet().get("RESTFREQS",rstf);
     343//
    341344  Bool canDo = True;
    342345  Unit u1("km/s");Unit u2("Hz");
     
    370373    t.rwKeywordSet().define("DOPPLER",dpl);
    371374  }
     375//
     376  if (!MFrequency::getType(mdr, brfrm)) {
     377     Int a,b;const uInt* c;
     378     const String* valid = MFrequency::allMyTypes(a, b, c);
     379     String pfix = "Please specify a legal frame type. Types are\n";
     380     throw(AipsError(pfix+(*valid)));
     381   } else {
     382    t.rwKeywordSet().define("BASEREFFRAME",brfrm);
     383   }
    372384}
    373385
     
    819831SDFrequencyTable SDMemTable::getSDFreqTable() const
    820832{
    821   // TODO !!!!! implement this properly USE with care
    822833  const Table& t = table_.keywordSet().asTable("FREQUENCIES");
    823834  SDFrequencyTable sdft;
    824   sdft.setLength(t.nrow());
     835
     836// Add refpix/refval/incr.  What are the units ? Hz I suppose
     837// but it's nowhere described...
     838
     839  Vector<Double> refPix, refVal, incr;
     840  ScalarColumn<Double> refPixCol(t, "REFPIX");
     841  ScalarColumn<Double> refValCol(t, "REFVAL");
     842  ScalarColumn<Double> incrCol(t, "INCREMENT");
     843  refPix = refPixCol.getColumn();
     844  refVal = refValCol.getColumn();
     845  incr = incrCol.getColumn();
     846//
     847  uInt n = refPix.nelements();
     848  for (uInt i=0; i<n; i++) {
     849     sdft.addFrequency(refPix[i], refVal[i], incr[i]);
     850  }
     851
     852// Frequency reference frame.  I don't know if this
     853// is the correct frame.  It might be 'REFFRAME'
     854// rather than 'BASEREFFRAME' ?
     855
     856  String baseFrame;
     857  t.keywordSet().get("BASEREFFRAME",baseFrame);
     858  sdft.setRefFrame(baseFrame);
     859
     860// Equinox
     861
     862  Float equinox;
     863  t.keywordSet().get("EQUINOX", equinox);
     864  sdft.setEquinox(equinox);
     865
     866// Rest Frequency
     867
     868  Vector<Double> restFreqs;
     869  t.keywordSet().get("RESTFREQS", restFreqs);
     870  for (uInt i=0; i<restFreqs.nelements(); i++) {
     871     sdft.addRestFrequency(restFreqs[i]);
     872  }
     873  sdft.setRestFrequencyUnit(String("Hz"));
     874//
    825875  return sdft;
    826876}
  • trunk/src/SDMemTable.h

    r303 r306  
    8080  SDHeader getSDHeader() const;
    8181
    82   // Get SD Frequency table.  Note that this function is largely
    83   // unimplemented.  Only the number of freqIDs is filled in presently.
     82  // Get SD Frequency table. 
    8483  SDFrequencyTable getSDFreqTable() const;
     84
    8585  // get spectrum,mask and tsys for the given row, at the selected
    8686  // cursor - all as stl vectors
     
    175175
    176176  // Return SC, setting only the basic construction state (i.e.
    177   // no conversion or velocity or rest frequency state)
     177  // no conversion or velocity or rest frequency state).
     178  // Specify the index of the FreqID you want
    178179  casa::SpectralCoordinate getSpectralCoordinate(casa::uInt whichIdx) const;
    179180
Note: See TracChangeset for help on using the changeset viewer.