[Numpy-discussion] type conversion question

2013-04-18 Thread K . -Michael Aye
I don't understand why sometimes a direct assignment of a new dtype is possible (but messes up the values), and why at other times a seemingly harmless upcast (in my potentially ignorant point of view) is not possible. So, maybe a direct assignment of a new dtype is actually never a good idea?

Re: [Numpy-discussion] type conversion question

2013-04-18 Thread K . -Michael Aye
On 2013-04-19 01:02:59 +, Benjamin Root said: On Thu, Apr 18, 2013 at 7:31 PM, K.-Michael Aye kmichael@gmail.com wrote: I don't understand why sometimes a direct assignment of a new dtype is possible (but messes up the values), and why at other times a seemingly harmless

[Numpy-discussion] bug in numpy.mean() ?

2012-01-24 Thread K . -Michael Aye
I know I know, that's pretty outrageous to even suggest, but please bear with me, I am stumped as you may be: 2-D data file here: http://dl.dropbox.com/u/139035/data.npy Then: In [3]: data.mean() Out[3]: 3067.024383998 In [4]: data.max() Out[4]: 3052.4343 In [5]: data.shape Out[5]: (1000,

Re: [Numpy-discussion] bug in numpy.mean() ?

2012-01-24 Thread K . -Michael Aye
do not want to convert to float64 you can add the result of the previous line to the bad mean: bad_mean = data.mean() good_mean = bad_mean + np.mean(data - bad_mean) Val On Tue, Jan 24, 2012 at 12:33 PM, K.-Michael Aye kmichael@gmail.com wrote: I know I know, that's pretty outrageous

[Numpy-discussion] howto store 2D function values and their grid points

2011-12-06 Thread K . -Michael Aye
Dear all, I can't wrap my head around this. Mathematically it's not hard, I just don't know how to store and access it without many loops. I have a function f(x,y). I would like to calculate it at x = arange(20,101,20) and y = arange(2,30,2) How do I store that in a multi-dimensional array

[Numpy-discussion] Why arange has no stop-point opt-in?

2010-12-30 Thread K . -Michael Aye
Dear all, I'm a bit puzzled that there seems just no way to cleanly code an interval with evenly spaced numbers that includes the stop point given? linspace offers to include the stop point, but arange does not? Am I missing something? (I am aware, that I could do arange(9,15.0001,0.1) but

Re: [Numpy-discussion] Why arange has no stop-point opt-in?

2010-12-30 Thread K . -Michael Aye
On 2010-12-30 16:43:12 +0200, josef.p...@gmail.com said: Since linspace exists, I don't see much point in adding the stop point in arange. I use arange mainly for integers as numpy equivalent of python's range. And I often need arange(n+1) which is less writing than arange(n,

[Numpy-discussion] 3 dim array unpacking

2010-07-12 Thread K . -Michael Aye
Dear numpy hackers, I can't find the syntax for unpacking the 3 dimensions of a rgb array. so i have a MxNx3 image array 'img' and would like to do: red, green, blue = img[magical_slicing] Which slicing magic do I need to apply? Thanks for your help! BR, Michael