Ignore:
Timestamp:
11/17/05 14:37:33 (19 years ago)
Author:
mar637
Message:

added frequency switching; implemented use of SDLog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMathWrapper.cc

    r502 r716  
    3030//#---------------------------------------------------------------------------
    3131
    32 
    3332#include "SDMathWrapper.h"
    34 #include "SDMath.h"
    35 
    3633
    3734using namespace asap;
    3835using namespace casa;
     36
    3937
    4038SDMemTableWrapper SDMathWrapper::quotient(const SDMemTableWrapper& on,
     
    4240                                          Bool preserveContinuum)
    4341{
    44     SDMath sdm;
     42   
    4543    Bool doTSys = True;
    46     return SDMemTableWrapper(sdm.binaryOperate(on.getCP(), off.getCP(),
    47                              String("QUOTIENT"), preserveContinuum, doTSys));
     44    return SDMemTableWrapper(sdmath.binaryOperate(on.getCP(), off.getCP(),
     45                                                  String("QUOTIENT"),
     46                                                  preserveContinuum, doTSys));
    4847}
    4948
     
    5150SDMemTableWrapper SDMathWrapper::binaryOperate(const SDMemTableWrapper& left,
    5251                                               const SDMemTableWrapper& right,
    53                                                const std::string& op, bool doTSys)
    54 {
    55     SDMath sdm;
    56     return SDMemTableWrapper(sdm.binaryOperate(left.getCP(), right.getCP(),
    57                                                String(op), False, Bool(doTSys)));
    58 }
    59 
    60 
    61 void SDMathWrapper::scaleInSitu(SDMemTableWrapper& in, float factor, bool doAll, bool doTSys)
     52                                               const std::string& op,
     53                                               bool doTSys)
     54{
     55   
     56    return SDMemTableWrapper(sdmath.binaryOperate(left.getCP(), right.getCP(),
     57                                                  String(op), False,
     58                                                  Bool(doTSys)));
     59}
     60
     61
     62void SDMathWrapper::scaleInSitu(SDMemTableWrapper& in, float factor,
     63                                bool doAll, bool doTSys)
    6264{
    6365  SDMemTable* pIn = in.getPtr();
    6466  const uInt what = 0;
    65 //
    66   SDMath sdm;
    67   SDMemTable* pOut = sdm.unaryOperate (*pIn, Float(factor),
     67 
     68  SDMemTable* pOut = sdmath.unaryOperate (*pIn, Float(factor),
    6869                                        Bool(doAll), what, Bool(doTSys));
    6970  *pIn = *pOut;
     
    7677  const CountedPtr<SDMemTable>& pIn = in.getCP();
    7778  const uInt what = 0;
    78   SDMath sdm;
    79   return CountedPtr<SDMemTable>(sdm.unaryOperate(*pIn, Float(factor), Bool(doAll),
     79 
     80  return CountedPtr<SDMemTable>(sdmath.unaryOperate(*pIn, Float(factor), Bool(doAll),
    8081                                                 what, Bool (doTSys)));
    8182}
     
    8687  SDMemTable* pIn = in.getPtr();
    8788  const uInt what = 1;
    88 //
    89   SDMath sdm;
     89 
    9090  Bool doTSys = False;
    91   SDMemTable* pOut = sdm.unaryOperate (*pIn, Float(offset),
     91  SDMemTable* pOut = sdmath.unaryOperate (*pIn, Float(offset),
    9292                                        Bool(doAll), what, doTSys);
    9393  *pIn = *pOut;
     
    100100  const CountedPtr<SDMemTable>& pIn = in.getCP();
    101101  const uInt what = 1;
    102   SDMath sdm;
     102 
    103103  Bool doTSys = False;
    104   return CountedPtr<SDMemTable>(sdm.unaryOperate(*pIn, Float(offset),
     104  return CountedPtr<SDMemTable>(sdmath.unaryOperate(*pIn, Float(offset),
    105105                                                  Bool(doAll), what, doTSys));
    106106}
     
    112112{
    113113  SDMemTable* pIn = in.getPtr();
    114   SDMath sdm;
    115   SDMemTable* pOut = sdm.smooth(*pIn, String(kernel),
     114 
     115  SDMemTable* pOut = sdmath.smooth(*pIn, String(kernel),
    116116                                Float(width), Bool(doAll));
    117117  *pIn = *pOut;
     
    125125{
    126126  const CountedPtr<SDMemTable>& pIn = in.getCP();
    127   SDMath sdm;
    128   return CountedPtr<SDMemTable>(sdm.smooth(*pIn, String(kernel),
     127 
     128  return CountedPtr<SDMemTable>(sdmath.smooth(*pIn, String(kernel),
    129129                                           Float(width), Bool(doAll)));
    130130}
     
    135135{
    136136  SDMemTable* pIn = in.getPtr();
    137   SDMath sdm;
    138   SDMemTable* pOut = sdm.bin (*pIn, Int(width));
     137 
     138  SDMemTable* pOut = sdmath.bin (*pIn, Int(width));
    139139  *pIn = *pOut;
    140140   delete pOut;
     
    145145{
    146146  const CountedPtr<SDMemTable>& pIn = in.getCP();
    147   SDMath sdm;
    148   return CountedPtr<SDMemTable>(sdm.bin(*pIn, Int(width)));
     147 
     148  return CountedPtr<SDMemTable>(sdmath.bin(*pIn, Int(width)));
    149149}
    150150
     
    153153{
    154154  SDMemTable* pIn = in.getPtr();
    155   SDMath sdm;
    156   SDMemTable* pOut = sdm.resample(*pIn, String(method), Float(width));
     155 
     156  SDMemTable* pOut = sdmath.resample(*pIn, String(method), Float(width));
    157157  *pIn = *pOut;
    158158   delete pOut;
     
    163163{
    164164  const CountedPtr<SDMemTable>& pIn = in.getCP();
    165   SDMath sdm;
    166   return CountedPtr<SDMemTable>(sdm.resample(*pIn, String(method), Float(width)));
     165 
     166  return CountedPtr<SDMemTable>(sdmath.resample(*pIn, String(method), Float(width)));
    167167}
    168168
     
    173173{
    174174  SDMemTable* pIn = in.getPtr();
    175   SDMath sdm;
     175 
    176176  Vector<Bool> tMask(mask);
    177   SDMemTable* pOut = sdm.averagePol (*pIn, tMask, String(weightStr));
     177  SDMemTable* pOut = sdmath.averagePol (*pIn, tMask, String(weightStr));
    178178  *pIn = *pOut;
    179179   delete pOut;
     
    185185{
    186186  const CountedPtr<SDMemTable>& pIn = in.getCP();
    187   SDMath sdm;
     187 
    188188  Vector<Bool> tMask(mask);
    189   return CountedPtr<SDMemTable>(sdm.averagePol(*pIn, tMask, String(weightStr)));
     189  return CountedPtr<SDMemTable>(sdmath.averagePol(*pIn, tMask, String(weightStr)));
    190190}
    191191
     
    195195                                            const std::string& which, int row)
    196196{
    197   SDMath sdm;
     197 
    198198  Vector<Bool> tMask(mask);
    199   return sdm.statistic(in.getCP(), tMask, String(which), Int(row));
     199  return sdmath.statistic(in.getCP(), tMask, String(which), Int(row));
    200200}
    201201
     
    205205{
    206206  SDMemTable* pIn = in.getPtr();
    207   SDMath sdm;
    208   SDMemTable* pOut = sdm.convertFlux (*pIn, Float(D), Float(eta), Float(JyPerK), Bool(doAll));
     207 
     208  SDMemTable* pOut = sdmath.convertFlux (*pIn, Float(D), Float(eta), Float(JyPerK), Bool(doAll));
    209209  *pIn = *pOut;
    210210  delete pOut;
     
    216216{
    217217  const CountedPtr<SDMemTable>& pIn = in.getCP();
    218   SDMath sdm;
    219   return CountedPtr<SDMemTable>(sdm.convertFlux(*pIn, Float(D), Float(eta), Float(JyPerK), Bool(doAll)));
     218 
     219  return CountedPtr<SDMemTable>(sdmath.convertFlux(*pIn, Float(D), Float(eta), Float(JyPerK), Bool(doAll)));
    220220}
    221221
     
    228228  SDMemTable* pIn = in.getPtr();
    229229  Vector<Float> tCoeffs(coeffs);
    230   SDMath sdm;
    231   SDMemTable* pOut = sdm.gainElevation(*pIn, tCoeffs, String(fileName),
     230 
     231  SDMemTable* pOut = sdmath.gainElevation(*pIn, tCoeffs, String(fileName),
    232232                                       String(method), Bool(doAll));
    233233  *pIn = *pOut;
     
    243243  const CountedPtr<SDMemTable>& pIn = in.getCP();
    244244  Vector<Float> tCoeffs(coeffs);
    245   SDMath sdm;
    246   return CountedPtr<SDMemTable>(sdm.gainElevation(*pIn, tCoeffs, String(fileName),
     245 
     246  return CountedPtr<SDMemTable>(sdmath.gainElevation(*pIn, tCoeffs, String(fileName),
    247247                                                  String(method), Bool(doAll)));
    248248}
     
    252252{
    253253  SDMemTable* pIn = in.getPtr();
    254   SDMath sdm;
    255   SDMemTable* pOut = sdm.frequencyAlignment(*pIn, String(refTime), String(method),
     254 
     255  SDMemTable* pOut = sdmath.frequencyAlignment(*pIn, String(refTime), String(method),
    256256                                            Bool(perFreqID));
    257257  *pIn = *pOut;
     
    266266{
    267267  const CountedPtr<SDMemTable>& pIn = in.getCP();
    268   SDMath sdm;
    269   return CountedPtr<SDMemTable>(sdm.frequencyAlignment(*pIn, String(refTime),
     268 
     269  return CountedPtr<SDMemTable>(sdmath.frequencyAlignment(*pIn, String(refTime),
    270270                                                       String(method), Bool(perFreqID)));
    271271}
     
    274274{
    275275  SDMemTable* pIn = in.getPtr();
    276   SDMath sdm;
    277   sdm.rotateXYPhase(*pIn, Float(angle), Bool(doAll));
     276 
     277  sdmath.rotateXYPhase(*pIn, Float(angle), Bool(doAll));
    278278}
    279279
     
    282282{
    283283  SDMemTable* pIn = in.getPtr();
    284   SDMath sdm;
    285   sdm.rotateLinPolPhase(*pIn, Float(angle), Bool(doAll));
     284 
     285  sdmath.rotateLinPolPhase(*pIn, Float(angle), Bool(doAll));
    286286}
    287287
     
    292292{
    293293  SDMemTable* pIn = in.getPtr();
    294   SDMath sdm;
    295   SDMemTable* pOut = sdm.opacity(*pIn, Float(tau), Bool(doAll));
    296   *pIn = *pOut;
    297   delete pOut;
    298 }
    299 
     294 
     295  SDMemTable* pOut = sdmath.opacity(*pIn, Float(tau), Bool(doAll));
     296  *pIn = *pOut;
     297  delete pOut;
     298}
    300299
    301300SDMemTableWrapper SDMathWrapper::opacity(const SDMemTableWrapper& in,
     
    303302{
    304303  const CountedPtr<SDMemTable>& pIn = in.getCP();
     304 
     305  return CountedPtr<SDMemTable>(sdmath.opacity(*pIn, Float(tau), Bool(doAll)));
     306}
     307
     308void SDMathWrapper::frequencySwitchInSitu(SDMemTableWrapper& in)
     309{
     310  SDMemTable* pIn = in.getPtr();
    305311  SDMath sdm;
    306   return CountedPtr<SDMemTable>(sdm.opacity(*pIn, Float(tau), Bool(doAll)));
    307 }
    308 
     312  SDMemTable* pOut = sdm.frequencySwitch(*pIn);
     313  *pIn = *pOut;
     314  delete pOut;
     315}
     316
     317SDMemTableWrapper SDMathWrapper::frequencySwitch(const SDMemTableWrapper& in)
     318{
     319  const CountedPtr<SDMemTable>& pIn = in.getCP();
     320  SDMath sdm;
     321  return CountedPtr<SDMemTable>(sdm.frequencySwitch(*pIn));
     322}
Note: See TracChangeset for help on using the changeset viewer.