<div class="gmail_quote"><div>Shall I file a bug report? Or is this fairly easy to fix?</div><div>Mark</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
On Fri, Aug 10, 2012 at 11:41 AM, <<a href="mailto:josef.pktd@gmail.com">josef.pktd@gmail.com</a>> wrote:<br>
<br>
><br>
><br>
> On Fri, Aug 10, 2012 at 10:00 AM, Travis Oliphant <<a href="mailto:travis@continuum.io">travis@continuum.io</a>>wrote:<br>
><br>
>><br>
>> On Aug 10, 2012, at 5:37 AM, Paul Anton Letnes wrote:<br>
>><br>
>> ><br>
>> ><br>
>> > On 10. aug. 2012, at 09:54, Mark Bakker wrote:<br>
>> ><br>
>> >> I am giving this a second try. Can anybody help me out?<br>
>> >><br>
>> >> I think there is a problem with assigning a 1D complex array of length<br>
>> one<br>
>> >> to a position in another complex array.<br>
>> >><br>
>> >> Example:<br>
>> >><br>
>> >> a = ones(1,'D')<br>
>> >> b = ones(1,'D')<br>
>> >> a[0] = b<br>
>> >><br>
>> ---------------------------------------------------------------------------<br>
>> >> TypeError                                 Traceback (most recent call<br>
>> last)<br>
>> >> <ipython-input-37-0c4fc6d780e3> in <module>()<br>
>> >> ----> 1 a[0] = b<br>
>> >><br>
>> >> TypeError: can't convert complex to float<br>
>> >><br>
>> >> This works correctly when a and b are real arrays:<br>
>> >><br>
>> >> a = ones(1)<br>
>> >> b = ones(1)<br>
>> >> a[0] = b<br>
>> >><br>
>> >> Bug or feature?<br>
>> ><br>
>> > The exact same thing happens on OS X 10.7.4, python 2.7.3, numpy 1.6.1.<br>
>> ><br>
>> > Looks like a bug to me - or at least very surprising behavior.<br>
>><br>
>> This is definitely an inconsistency.    The error seems more correct<br>
>> (though the error message needs improvement).<br>
>><br>
>> Can someone try this on NumPy 1.5 and see if this inconsistency existed<br>
>> there as well.<br>
>><br>
><br>
> >>> np.__version__<br>
> '1.5.1'<br>
><br>
> >>> a = np.ones(1,'D')<br>
> >>> b = np.ones(1,'D')<br>
> >>> a[0] = b<br>
> Traceback (most recent call last):<br>
>   File "<stdin>", line 1, in <module><br>
><br>
> TypeError: can't convert complex to float<br>
> >>> a = np.ones(1)<br>
> >>> b = np.ones(1)<br>
> >>> a[0] = b<br>
><br>
<br>
and<br>
<br>
>>> a = np.ones(1,'D')<br>
>>> b = 2*np.ones(1)<br>
>>> a[0] = b<br>
>>> a<br>
array([ 2.+0.j])<br>
>>> c = 3*np.ones(1, int)<br>
>>> a[0] = c<br>
>>> a<br>
array([ 3.+0.j])<br>
<br>
<br>
<br>
><br>
> Josef<br>
><br>
><br>
>> Thanks,<br>
>><br>
>> -Travis<br>
>><br>
>> ><br>
>> > Paul<br>
>> > _______________________________________________<br>
>> > NumPy-Discussion mailing list<br>
>> > <a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
>> > <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
>><br>
>> _______________________________________________<br>
>> NumPy-Discussion mailing list<br>
>> <a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
>> <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
>><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120810/05588327/attachment.html" target="_blank">http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120810/05588327/attachment.html</a><br>

<br>
------------------------------<br>
<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br>
<br>
End of NumPy-Discussion Digest, Vol 71, Issue 18<br>
************************************************<br>
</blockquote></div><br>