Changeset 78


Ignore:
Timestamp:
08/10/04 16:23:15 (20 years ago)
Author:
mar637
Message:

Added support of source direction. This is reflected in the getAbscissa function. Frame conversions enabled.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r68 r78  
    5050#include <aips/Tables/TableRecord.h>
    5151#include <aips/Measures/MFrequency.h>
     52#include <aips/Measures/MeasTable.h>
    5253#include <aips/Quanta/MVTime.h>
    5354
     
    117118  td.addColumn(ScalarColumnDesc<Double>("INTERVAL")); 
    118119  td.addColumn(ArrayColumnDesc<uInt>("FREQID"));
     120  td.addColumn(ArrayColumnDesc<Double>("DIRECTION"));
    119121  // Now create a new table from the description.
    120122
     
    234236std::vector<double> SDMemTable::getAbscissa(Int whichRow,
    235237                                            const std::string& whichUnit,
     238                                            const std::string& whichFrame,
    236239                                            double restfreq) {
    237240  std::vector<double> absc(nChan());
     
    249252  }
    250253  SpectralCoordinate spc = getCoordinate(specidx);
     254  Table t = table_.keywordSet().asTable("FREQUENCIES");
     255  String rf;
     256  t.keywordSet().get("REFFRAME",rf);
     257  MDirection::Types mdr;
     258  MDirection::getType(mdr, rf);   
     259  ROArrayColumn<Double> dir(table_, "DIRECTION");
     260  Array<Double> posit;
     261  dir.get(whichRow,posit);
     262  Vector<Double> wpos(2);
     263  wpos[0] = posit(IPosition(2,beamSel_,0));
     264  wpos[1] = posit(IPosition(2,beamSel_,1));
     265  Quantum<Double> lon(wpos[0],Unit(String("rad")));
     266  Quantum<Double> lat(wpos[1],Unit(String("rad")));
     267  MDirection direct(lon, lat, mdr);
     268  ROScalarColumn<Double> tme(table_, "TIME");
     269  Double obstime;
     270  tme.get(whichRow,obstime);
     271  Quantum<Double> tm(obstime, Unit(String("d")));
     272  MVEpoch tm2(tm);
     273  MEpoch epoch(tm2);
     274
     275  Vector<Double> antpos;
     276  table_.keywordSet().get("AntennaPosition", antpos);
     277  //MPosition pos;
     278  MVPosition mvpos(antpos(0),antpos(1),antpos(2));
     279  MPosition pos(mvpos);
     280  //MeasTable::Observatory(pos, String("ATCA"));
     281
     282  MFrequency::Types mtype;
     283  if (!MFrequency::getType(mtype, whichFrame)) {
     284    cerr << "Frequency type unknown assuming TOPO" << endl;
     285    mtype = MFrequency::TOPO;
     286  }
     287  spc.setReferenceConversion(mtype,epoch,pos,direct); 
     288
    251289  if ( u == Unit("km/s") ) {
    252290    if (Double(restfreq) >  Double(0.000001)) {
     
    394432    return SpectralCoordinate();
    395433  }
     434 
    396435  Double rp,rv,inc;
    397436  String rf;
     
    471510  ScalarColumn<Double> integr(table_, "INTERVAL");
    472511  ArrayColumn<uInt> freqid(table_, "FREQID");
     512  ArrayColumn<Double> dir(table_, "DIRECTION");
    473513
    474514  uInt rno = table_.nrow();
     
    483523  integr.put(rno, sdc.interval);
    484524  freqid.put(rno, sdc.getFreqMap());
     525  dir.put(rno, sdc.getDirection());
    485526 
    486527  return true;
     
    496537  ROScalarColumn<Double> integr(table_, "INTERVAL");
    497538  ROArrayColumn<uInt> freqid(table_, "FREQID");
     539  ROArrayColumn<Double> dir(table_, "DIRECTION");
    498540
    499541  SDContainer sdc(nBeam(),nIF(),nPol(),nChan());
     
    506548  Array<uChar> flagtrum;
    507549  Vector<uInt> fmap;
     550  Array<Double> direction;
    508551  spec.get(whichRow, spectrum);
    509552  sdc.putSpectrum(spectrum);
     
    514557  freqid.get(whichRow, fmap);
    515558  sdc.putFreqMap(fmap);
     559  dir.get(whichRow, direction);
     560  sdc.putDirection(direction);
    516561  return sdc;
    517562}
     563
    518564bool SDMemTable::putSDHeader(const SDHeader& sdh) {
    519565  table_.lock();
  • trunk/src/SDMemTable.h

    r68 r78  
    138138  std::vector<double> getAbscissa(int whichRow,
    139139                                  const std::string& whichUnit="GHz",
     140                                  const std::string& whichFrame="TOPO",
    140141                                  double restfreq=0.0);
    141142private:
Note: See TracChangeset for help on using the changeset viewer.