[SciPy-dev] shape_base questions
Pietro Berkes
p.berkes at biologie.hu-berlin.de
Fri Oct 18 08:00:15 CDT 2002
Hi! I was taking a look to the 'shape_base.py' file, and I've got a couple of
questions/suggestions:
- 'apply_over_axes' won't work, since it cannot find SequenceType on line 15.
SequenceType was defined in stats/rv2.py and stats/stats.py, where
'apply_over_axes' is used. I suggest to move the definition
SequenceType = [types.TupleType, types.ListType, Numeric.ArrayType]
together with a predicate function:
def issequence(seq):
return type(seq) in SequenceType
in scipy_base/type_check.py and then to fix rv2.py, stats.py and
shape_base.py. By the way: in rv2.py, SequenceType contains array.ArrayType
and Numeric.ArrayType. Are they different? And if yes, why?
- 'apply_over_axes' and 'expand_dims' accept negative axes, while other
functions don't. Are there design guidelines regarding negative axes? The two
functions correct negative indices in two different ways:
'apply_over_axes' : axis = len(shape) + axis
'expand_dims' : axis = len(shape) + axis + 1
I think the first way is the correct one in both cases, at least it would
match the documentation of both functions.
I could send a patch for these issues... what is the preferred way to do
this? Should I use the SourceForge page (it appears to be void...)?
Regards,
Pietro.
More information about the Scipy-dev
mailing list