Power function for XY Data

Hello everyone,

If numpy is imported in the code using: from numpy import * and if you try to square the values of a XY Data, both X and Y co-ordinates are squared. If only the Y co-ordinate has to be squared, don’t use from numpy import * in the code.

For example, If you print:

session.XYData(name='test1',data=((1.0,2.0),(5,5),(15,20)))
print power(session.xyDataObjects['test1'],2)
>> [(1.0, 4.0), (5.0, 25.0), (15.0, 400.0)]

 

But if you import numpy:

from numpy import *
session.XYData(name='test1',data=((1.0,2.0),(5,5),(15,20)))
print power(session.xyDataObjects['test1'],2)
>> [[   1.    4.] [  25.   25.] [ 225.  400.]]