Changeset 488


Ignore:
Timestamp:
02/21/05 11:36:17 (19 years ago)
Author:
mar637
Message:
  • added merging of history tables
Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMath.cc

    r480 r488  
    112112
    113113
    114 SDMemTable* SDMath::frequencyAlignment (const SDMemTable& in, const String& refTime,
    115                                          const String& method, Bool perFreqID) const
     114SDMemTable* SDMath::frequencyAlignment(const SDMemTable& in,
     115                                       const String& refTime,
     116                                       const String& method,
     117                                       Bool perFreqID) const
    116118{
    117119// Get frame info from Table
     
    132134// Do it
    133135
    134    return frequencyAlign (in, freqSystem, refTime, method, perFreqID);
     136   return frequencyAlign(in, freqSystem, refTime, method, perFreqID);
    135137}
    136138
     
    153155
    154156  SDMemTable* pTabOut = new SDMemTable(*in[0],True);
    155 
     157  if (in.nelements() > 1) {
     158    for (uInt i=1; i < in.nelements(); ++i) {
     159      pTabOut->appendToHistoryTable(in[i]->getHistoryTable());
     160    }
     161  }
    156162// Setup
    157163
     
    376382
    377383
    378 CountedPtr<SDMemTable> SDMath::binaryOperate (const CountedPtr<SDMemTable>& left,
    379                                               const CountedPtr<SDMemTable>& right,
    380                                               const String& op, Bool preserve,
    381                                               Bool doTSys)  const
     384CountedPtr<SDMemTable> SDMath::binaryOperate(const CountedPtr<SDMemTable>&
     385                                             left,
     386                                             const CountedPtr<SDMemTable>&
     387                                             right,
     388                                             const String& op, Bool preserve,
     389                                             Bool doTSys) const
    382390{
    383391
     
    435443
    436444  SDMemTable* pTabOut = new SDMemTable(*left, True);
    437 
     445  pTabOut->appendToHistoryTable(right->getHistoryTable());
    438446// Loop over rows
    439447
     
    488496        if (doTSys) sc.putTsys(tSysLeftArr/tSysRightArr);
    489497     } else if (what==4) {
    490         if (preserve) {     
    491            MaskedArray<Float> tmp = (tSysRightArr * mLeft / *pMRight) - tSysRightArr;
    492            putDataInSDC(sc, tmp.getArray(), tmp.getMask());
    493         } else {
    494            MaskedArray<Float> tmp = (tSysRightArr * mLeft / *pMRight) - tSysLeftArr;
    495            putDataInSDC(sc, tmp.getArray(), tmp.getMask());
    496         }
    497         sc.putTsys(tSysRightArr);
     498       if (preserve) {     
     499         MaskedArray<Float> tmp = (tSysRightArr * mLeft / *pMRight) -
     500           tSysRightArr;
     501         putDataInSDC(sc, tmp.getArray(), tmp.getMask());
     502       } else {
     503         MaskedArray<Float> tmp = (tSysRightArr * mLeft / *pMRight) -
     504           tSysLeftArr;
     505         putDataInSDC(sc, tmp.getArray(), tmp.getMask());
     506       }
     507       sc.putTsys(tSysRightArr);
    498508     }
    499509
     
    504514  if (pMRight) delete pMRight;
    505515  pTabOut->resetCursor();
    506 //
     516
    507517  return CountedPtr<SDMemTable>(pTabOut);
    508518}
     
    629639}
    630640
    631 SDMemTable* SDMath::resample (const SDMemTable& in, const String& methodStr,
    632                               Float width) const
     641SDMemTable* SDMath::resample(const SDMemTable& in, const String& methodStr,
     642                             Float width) const
    633643//
    634644// Should add the possibility of width being specified in km/s. This means
     
    789799   return pOut;
    790800}
    791 
    792 
    793801
    794802SDMemTable* SDMath::averagePol(const SDMemTable& in, const Vector<Bool>& mask,
     
    10181026
    10191027
    1020 SDMemTable* SDMath::convertFlux (const SDMemTable& in, Float D, Float etaAp,
    1021                                  Float JyPerK, Bool doAll) const
     1028SDMemTable* SDMath::convertFlux(const SDMemTable& in, Float D, Float etaAp,
     1029                                Float JyPerK, Bool doAll) const
    10221030//
    10231031// etaAp = aperture efficiency (-1 means find)
     
    11071115
    11081116
    1109 SDMemTable* SDMath::gainElevation (const SDMemTable& in, const Vector<Float>& coeffs,
    1110                                    const String& fileName,
    1111                                    const String& methodStr, Bool doAll) const
     1117SDMemTable* SDMath::gainElevation(const SDMemTable& in,
     1118                                  const Vector<Float>& coeffs,
     1119                                  const String& fileName,
     1120                                  const String& methodStr, Bool doAll) const
    11121121{
    11131122
     
    11881197 
    11891198
    1190 SDMemTable* SDMath::opacity (const SDMemTable& in, Float tau, Bool doAll) const
     1199SDMemTable* SDMath::opacity(const SDMemTable& in, Float tau, Bool doAll) const
    11911200{
    11921201
     
    12201229
    12211230
    1222 void SDMath::rotateXYPhase (SDMemTable& in, Float value, Bool doAll)
     1231void SDMath::rotateXYPhase(SDMemTable& in, Float value, Bool doAll)
    12231232//
    12241233// phase in degrees
     
    12701279}     
    12711280
    1272 
    1273 
    12741281// 'private' functions
    12751282
  • trunk/src/SDMemTable.cc

    r483 r488  
    4747#include <tables/Tables/TableParse.h>
    4848#include <tables/Tables/TableDesc.h>
     49#include <tables/Tables/TableCopy.h>
    4950#include <tables/Tables/SetupNewTab.h>
    5051#include <tables/Tables/ScaColDesc.h>
     
    15091510}
    15101511
     1512Table SDMemTable::getHistoryTable() const
     1513{
     1514  return table_.keywordSet().asTable("HISTORY");
     1515}
     1516
     1517void SDMemTable::appendToHistoryTable(const Table& otherHist)
     1518{
     1519  Table t = table_.rwKeywordSet().asTable("HISTORY");
     1520  const String sep = "--------------------------------------------------------------------------------";
     1521  addHistory(sep);
     1522  TableCopy::copyRows(t, otherHist, t.nrow(), 0, otherHist.nrow());
     1523  addHistory(sep);
     1524}
     1525
    15111526void SDMemTable::addHistory(const std::string& hist)
    15121527{
     
    15321547  return stlout;
    15331548}
     1549
     1550
    15341551/*
    15351552  void SDMemTable::maskChannels(const std::vector<Int>& whichChans ) {
  • trunk/src/SDMemTable.h

    r483 r488  
    195195  std::vector<std::string> getHistory() const;
    196196  void addHistory(const std::string& hist);
     197
     198  casa::Table getHistoryTable() const;
     199  void appendToHistoryTable(const casa::Table& otherHist);
    197200
    198201  // write to disk as aips++ table
Note: See TracChangeset for help on using the changeset viewer.