I have a question about creation of numpy arrays from a list of
objects, which bears on the Quantities project and also on masked
arrays:

>>> import quantities as pq
>>> import numpy as np
>>> a, b = 2*pq.m,1*pq.s
>>> np.array([a, b])
array([ 12.,   1.])

Why doesn't that create an object array? Similarly:

>>> m = np.ma.array([1], mask=[True])
>>> m
masked_array(data = [--],
             mask = [ True],
       fill_value = 999999)

>>> np.array([m])
array([[1]])

This has broader implications than just creating arrays, for example:

>>> np.sum([m, m])
2
>>> np.sum([a, b])
13.0

Any thoughts?

Thanks,
Darren
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to