Changeset 2145 for branches


Ignore:
Timestamp:
04/18/11 13:01:09 (13 years ago)
Author:
Takeshi Nakazato
Message:

merge bug fix in trunk (r2143,r2144).

Location:
branches/casa-prerelease/pre-asap
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/casa-prerelease/pre-asap

  • branches/casa-prerelease/pre-asap/Makefile

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/SConstruct

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/apps

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/external-alma

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/external-alma/atnf/pks/pks_maths.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/getsvnrev.sh

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/python

  • branches/casa-prerelease/pre-asap/python/flagtoolbar.py

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/python/scantable.py

    r2130 r2145  
    31843184        elif isinstance(other, float):
    31853185            s = scantable(self._math._unaryop(self, other, "ADD", False))
     3186        elif isinstance(other, list) or isinstance(other, numpy.ndarray):
     3187            if isinstance(other[0], list) or isinstance(other[0], numpy.ndarray):
     3188                from asapmath import _array2dOp
     3189                s = _array2dOp( self.copy(), other, "ADD", False )
     3190            else:
     3191                s = scantable( self._math._arrayop( self.copy(), other, "ADD", False ) )
    31863192        else:
    31873193            raise TypeError("Other input is not a scantable or float value")
     
    32003206        elif isinstance(other, float):
    32013207            s = scantable(self._math._unaryop(self, other, "SUB", False))
     3208        elif isinstance(other, list) or isinstance(other, numpy.ndarray):
     3209            if isinstance(other[0], list) or isinstance(other[0], numpy.ndarray):
     3210                from asapmath import _array2dOp
     3211                s = _array2dOp( self.copy(), other, "SUB", False )
     3212            else:
     3213                s = scantable( self._math._arrayop( self.copy(), other, "SUB", False ) )
    32023214        else:
    32033215            raise TypeError("Other input is not a scantable or float value")
     
    32163228        elif isinstance(other, float):
    32173229            s = scantable(self._math._unaryop(self, other, "MUL", False))
     3230        elif isinstance(other, list) or isinstance(other, numpy.ndarray):
     3231            if isinstance(other[0], list) or isinstance(other[0], numpy.ndarray):
     3232                from asapmath import _array2dOp
     3233                s = _array2dOp( self.copy(), other, "MUL", False )
     3234            else:
     3235                s = scantable( self._math._arrayop( self.copy(), other, "MUL", False ) )
    32183236        else:
    32193237            raise TypeError("Other input is not a scantable or float value")
     
    32353253                raise ZeroDivisionError("Dividing by zero is not recommended")
    32363254            s = scantable(self._math._unaryop(self, other, "DIV", False))
     3255        elif isinstance(other, list) or isinstance(other, numpy.ndarray):
     3256            if isinstance(other[0], list) or isinstance(other[0], numpy.ndarray):
     3257                from asapmath import _array2dOp
     3258                s = _array2dOp( self.copy(), other, "DIV", False )
     3259            else:
     3260                s = scantable( self._math._arrayop( self.copy(), other, "DIV", False ) )
    32373261        else:
    32383262            raise TypeError("Other input is not a scantable or float value")
  • branches/casa-prerelease/pre-asap/src

  • branches/casa-prerelease/pre-asap/src/SConscript

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/casa-prerelease/pre-asap/src/STMath.cpp

    r2136 r2145  
    492492  ArrayColumn<Float> specCol(tab,"SPECTRA");
    493493  ArrayColumn<Float> tsysCol(tab,"TSYS");
     494  if (mode=="DIV") val = 1.0/val ;
     495  else if (mode=="SUB") val *= -1.0 ;
    494496  for (uInt i=0; i<tab.nrow(); ++i) {
    495497    Vector<Float> spec;
     
    498500    tsysCol.get(i, ts);
    499501    if (mode == "MUL" || mode == "DIV") {
    500       if (mode == "DIV") val = 1.0/val;
     502      //if (mode == "DIV") val = 1.0/val;
    501503      spec *= val;
    502504      specCol.put(i, spec);
     
    506508      }
    507509    } else if ( mode == "ADD"  || mode == "SUB") {
    508       if (mode == "SUB") val *= -1.0;
     510      //if (mode == "SUB") val *= -1.0;
    509511      spec += val;
    510512      specCol.put(i, spec);
     
    587589  ArrayColumn<Float> specCol(tab,"SPECTRA");
    588590  ArrayColumn<Float> tsysCol(tab,"TSYS");
     591  if (mode == "DIV") fact = (float)1.0 / fact;
     592  else if (mode == "SUB") fact *= (float)-1.0 ;
    589593  for (uInt i=0; i<tab.nrow(); ++i) {
    590594    Vector<Float> spec;
     
    593597    tsysCol.get(i, ts);
    594598    if (mode == "MUL" || mode == "DIV") {
    595       if (mode == "DIV") fact = (float)1.0 / fact;
     599      //if (mode == "DIV") fact = (float)1.0 / fact;
    596600      spec *= fact;
    597601      specCol.put(i, spec);
     
    601605      }
    602606    } else if ( mode == "ADD"  || mode == "SUB") {
    603       if (mode == "SUB") fact *= (float)-1.0 ;
     607      //if (mode == "SUB") fact *= (float)-1.0 ;
    604608      spec += fact;
    605609      specCol.put(i, spec);
Note: See TracChangeset for help on using the changeset viewer.