[Numpy-discussion] What should be the return type of average?

Sebastian Haase haase@msg.ucsf....
Sun Mar 16 05:11:39 CDT 2008

On Sun, Mar 16, 2008 at 1:08 AM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
> Hi,
> I want to fix up the average function. I note that the return dtype is not
> specified, nor is the precision of the accumulator. Both of these can be
> specified for the mean method and I wonder what should be the case for
> average. Or should we just use double precision? That would seem appropriate
> to me most of the time, but wouldn't match what happens with mean and would
> lose precision in the case of extended precision doubles. There is also no
> out keyword, do we want one?

I'm starting to forget... but faintly I'm remembering that there might
have been some extended discussion about this on this list.
We work with large multi-dimensional image data, so if, for example, I
have n (small) 50x512x512 3D-images that I want to average into one
50x512x512 image, the most memory I can afford is single precession
float32. (Also the original dynamic range is 16bit at best anyway)

I was just checking my archives:
http://projects.scipy.org/scipy/numpy/ticket/465#comment:2 (by
oliphant) actually already says this.

Furthermore, an "out" variable  like it is in most functions in the
ndimage module would certainly be good to have.

Sebastian Haase

More information about the Numpy-discussion mailing list