[Numpy-discussion] format typestr for "String" ( 10 strings: '10a80' ) gives just 'None'

Sebastian Haase haase at msg.ucsf.edu
Thu Aug 10 23:25:22 CDT 2006


Travis Oliphant wrote:
> Sebastian Haase wrote:
>> This is what I get:  It claims that the 'title' field (the last one) 
>> is 10 times 'S80' but trying to read that array from the first (and 
>> only) record (a.Mrc._hdrArray.title[0])  I just get None...
>>   
> Hopefully that problem is resolved now.  I should discuss a little bit 
> about how the 10-element sub-array field is handled by NumPy.
> 
> Any sub-array present causes the shape of the returned array for a given 
> field to grow by the sub-array size.
> 
> So, in your case you have a (10,)-shape subarray in the title field.
> 
> Thus if g is a record-array of shape gshape g.title will be a chararray 
> of shape gshape + (10,)
> 
> In this case of a 1-d array with 1-element we have gshape = (1,).  
> Therefore,  g.title will be a (1,10) chararray and g[0].title will be a 
> (10,)-shaped chararray.
> 
> -Travis
> 
Thanks, for fixing everything so quickly - I'll test it tomorrow.
BTW: are you intentionally sending the last few messages ONLY to me and
NOT to the mailing list !?  I actually think the mailing should be
configured that a "normal reply" automatically defaults to go only (!)
to the list.
(I'm on some other lists that know how to do that).
Who would be able to change that for the numpy and the scipy list !?

Thanks again,
Sebastian





More information about the Numpy-discussion mailing list