Changeset 2144 for trunk/python


Ignore:
Timestamp:
04/18/11 12:57:09 (14 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: sdmath unit test (coming soon)

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Bug fix on 2D array operation with scantable.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2129 r2144  
    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")
Note: See TracChangeset for help on using the changeset viewer.