Re: [Numpy-discussion] dtype.type for structured arrays

2010-08-06 Thread Travis Oliphant

On Jul 24, 2010, at 2:42 PM, Thomas Robitaille wrote:

 Hi,
 
 If I create a structured array with vector columns:
 
 array = np.array(zip([[1,2],[1,2],[1,3]]),dtype=[('a',float,2)])
 
 then examine the type of the column, I get:
 
 array.dtype[0]
 dtype(('float64',(2,)))
 
 Then, if I try and view the numerical type, I see:
 
 array.dtype[0].type
 type 'numpy.void'
 
 I have to basically do
 
 array.dtype[0].subdtype[0]
 dtype('float64')
 
 to get what I need. I seem to remember that this used not to be the case, and 
 that even for vector columns, one could access array.dtype[0].type to get the 
 numerical type. Is this a bug, or deliberate?
 


This looks the same as I remember it.   The dtype is a structured array with 
the filed name 'a' having an element which is a vector of floats.   As a 
result, the first dtype[0] extracts the vector of floats dtype.   This must be 
type void because it is a vector of floats.  To get to the underlying type, 
you have to do what you did.  I don't see how it would have worked another way 
in the past. 

-Travis




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

---
Travis Oliphant
Enthought, Inc.
oliph...@enthought.com
1-512-536-1057
http://www.enthought.com



___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] dtype.type for structured arrays

2010-07-27 Thread Thomas Robitaille


Thomas Robitaille wrote:
 
 I seem to remember that this used not to be the case, and that even for
 vector columns, one could access array.dtype[0].type to get the numerical
 type. Is this a bug, or deliberate?
 

I submitted a bug report:

http://projects.scipy.org/numpy/ticket/1557

Cheers,

Tom

-- 
View this message in context: 
http://old.nabble.com/dtype.type-for-structured-arrays-tp29256618p29276859.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion