[SciPy-user] scipy_base.squeeze

Jean-Michel Philippe jean-michel.philippe at irsid.arcelor.com
Fri Aug 27 08:28:20 CDT 2004


Hi,

I recently had troubles with the squeeze function from scipy_base. It 
squeezes all the dimensions when I pass a (1,1) array, resulting in an 
empty one!
Is it a known side effect?

Regards.

JM. Philippe

--------------------------
PS: I modified the 'site-packages/scipy_base/shape_base.py' script this 
way to get rid of the problem:

def squeeze(a):
     "Returns a with any ones from the shape of a removed"
     a = asarray(a)
     b = asarray(a.shape)
     dims = tuple (compress (not_equal (b, 1), b))
     if len(dims) == 0:
         dims = (1, )
     val = reshape (a, dims)
     return val
--------------------------



More information about the SciPy-user mailing list