[SciPy-user] scipy choice of defaults for matrix manipulation
Alan G Isaac
aisaac at american.edu
Thu Aug 5 00:37:31 EDT 2004
Alan wrote:
>> The SciPy documentation says:
>> To begin with, all of the Numeric functions have
>> been subsumed into the scipy namespace so that all
>> of those functions are available without
>> additionally importing Numeric.
>> It was therefore unsettling to find that SciPy's function_base defines
>> def cumsum(m,axis=-1):
>> """Returns the cumulative sum of the elements along the given axis
>> """
>> if axis is None:
>> m = ravel(m)
>> axis = 0
>> else:
>> m = _asarray1d(m)
>> return add.accumulate(m,axis)
>> This changes the default axis of Numeric and numarray.
>> Bug or feature??
On Wed, 04 Aug 2004, Robert Kern apparently wrote:
> Implementation feature; documentation bug. Numeric's functions have
> various, inconsistent ("schizophrenic" as you say) choices for the
> default axis. An attempt, albeit incomplete as you note, was made with
> SciPy to standardize on always using axis=-1. I'm fairly positive this
> was documented somewhere at some point, but probably only on the old
> website. The tutorial really should be updated to prominently note this
> convention.
Looking at briefly at Numeric and numarray, it seems they
have made an effort to standardize on axis=0. This is also
true in the Matlab module. Wouldn't it be wise for SciPy
to join the parade? (I.e., shouldn't these closely related
and interdependent packages share a convention?
Otherwise, this is going to be VERY confusing for users.
(As it was for me.) Now when I call a such a function,
I have to remember: is it a SciPy function, or a
Numeric/numarray function? Not a good situation, right?
Thanks,
Alan
More information about the SciPy-User
mailing list