Re: [Numpy-discussion] [enhancement] sum_angle() and sum_polar()

2012-05-29 Thread Stéfan van der Walt
On Mon, May 28, 2012 at 11:53 AM, Travis Oliphant tra...@continuum.io wrote:
 I could see these functions going into scipy.ndimage but again because they
 are not necessarily just image processing functions, and the fact that they
 are so simple, perhaps they are best put into NumPy itself.

I'm wondering about the general applicability of these functions.  Can
anyone suggest some use cases?

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


Re: [Numpy-discussion] [enhancement] sum_angle() and sum_polar()

2012-05-29 Thread Robert Jördens
On Tue, May 29, 2012 at 11:03 AM, Stéfan van der Walt ste...@sun.ac.za wrote:
 On Mon, May 28, 2012 at 11:53 AM, Travis Oliphant tra...@continuum.io wrote:
 I could see these functions going into scipy.ndimage but again because they
 are not necessarily just image processing functions, and the fact that they
 are so simple, perhaps they are best put into NumPy itself.

 I'm wondering about the general applicability of these functions.  Can
 anyone suggest some use cases?

An example from solid state physics:
If you have a spin chain with some long-range interaction and you have
the known, dense, coupling matrix J, sum_angle(J, pi/4) gives you a
view at the distance dependence of the interaction.

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


Re: [Numpy-discussion] [enhancement] sum_angle() and sum_polar()

2012-05-29 Thread Charles R Harris
On Tue, May 29, 2012 at 11:40 AM, Robert Jördens jord...@gmail.com wrote:

 On Tue, May 29, 2012 at 11:03 AM, Stéfan van der Walt ste...@sun.ac.za
 wrote:
  On Mon, May 28, 2012 at 11:53 AM, Travis Oliphant tra...@continuum.io
 wrote:
  I could see these functions going into scipy.ndimage but again because
 they
  are not necessarily just image processing functions, and the fact that
 they
  are so simple, perhaps they are best put into NumPy itself.
 
  I'm wondering about the general applicability of these functions.  Can
  anyone suggest some use cases?

 An example from solid state physics:
 If you have a spin chain with some long-range interaction and you have
 the known, dense, coupling matrix J, sum_angle(J, pi/4) gives you a
 view at the distance dependence of the interaction.


I'd like to see these functions is scipy somewhere. The function names
aren't very descriptive and the one line summaries don't give a very good
idea of what they do, so I think those bits could use improvement. Mention
of the Hough/Radon transform would help, I had to pull out that connection
by reading the code...

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


Re: [Numpy-discussion] [enhancement] sum_angle() and sum_polar()

2012-05-29 Thread Jerome Kieffer
On Tue, 29 May 2012 10:03:04 -0700
Stéfan van der Walt ste...@sun.ac.za wrote:

 On Mon, May 28, 2012 at 11:53 AM, Travis Oliphant tra...@continuum.io wrote:
  I could see these functions going into scipy.ndimage but again because they
  are not necessarily just image processing functions, and the fact that they
  are so simple, perhaps they are best put into NumPy itself.
 
 I'm wondering about the general applicability of these functions.  Can
 anyone suggest some use cases?

I wrote a whole library about that ... pyFAI (available in debian)
https://forge.epn-campus.eu/attachments/1459/20111010-PyFAI-Poster-A0.pdf

Unfortunately real detector are never completely orthogonal to the incident 
beam, pixels are never square, ... what makes things more complicated.

Cheers,

-- 
Jérôme Kieffer
Data analysis unit - ESRF
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [enhancement] sum_angle() and sum_polar()

2012-05-29 Thread Robert Jördens
On Tue, May 29, 2012 at 12:06 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
 I'd like to see these functions is scipy somewhere. The function names
 aren't very descriptive and the one line summaries don't give a very good
 idea of what they do, so I think those bits could use improvement. Mention
 of the Hough/Radon transform would help, I had to pull out that connection
 by reading the code...

I'll fix the descriptions.
What more descriptive names did you have in mind?

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


Re: [Numpy-discussion] [enhancement] sum_angle() and sum_polar()

2012-05-28 Thread Ralf Gommers
On Mon, May 28, 2012 at 7:58 PM, Travis Oliphant tra...@continuum.iowrote:

 I didn't see anyone respond to this, but looking over his simple and
 elegant solution it seems like a useful addition to the 2-d functions
 available in NumPy as it works with any 2-d array (image or matrix) and
 does a transformation on the indices in order to organize the sum.

 It is not a general-purpose interpolating approach where the 2-d array is
 viewed as samples of an underlying continuous function.

 Are their other thoughts?

 This was discussed (not finished yet) on scipy-dev:
http://thread.gmane.org/gmane.comp.python.scientific.devel/16538/focus=16541.


Ralf



 -Travis



 On Mar 7, 2012, at 12:39 PM, Robert Jördens wrote:

  Hi everyone,
  I am proposing to add the the two following functions to
  numpy/lib/twodim_base.py:
 
  sum_angle() computes the sum of a 2-d array along an angled axis
  sum_polar() computes the sum of a 2-d array along radial lines or
  along azimuthal circles
 
  https://github.com/numpy/numpy/pull/230
 
  Comments?
 
  When I was looking for a solution to these problems of calculating
  special sums of 2-d arrays I could not find anything and it took me a
  while to figure out a (hopefully) useful and consistent algorithm.
  I can see how one would extend these to higher dimensions but that
  would preclude using bincount() to do the heavy lifting.
  Looking at some other functions, the doctests might need to be split
  into real examples and unittests.
 
  Best,
 
  --
  Robert Jordens.
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion@scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion

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

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


Re: [Numpy-discussion] [enhancement] sum_angle() and sum_polar()

2012-05-28 Thread Travis Oliphant

On May 28, 2012, at 1:02 PM, Ralf Gommers wrote:

 
 
 On Mon, May 28, 2012 at 7:58 PM, Travis Oliphant tra...@continuum.io wrote:
 I didn't see anyone respond to this, but looking over his simple and elegant 
 solution it seems like a useful addition to the 2-d functions available in 
 NumPy as it works with any 2-d array (image or matrix) and does a 
 transformation on the indices in order to organize the sum.
 
 It is not a general-purpose interpolating approach where the 2-d array is 
 viewed as samples of an underlying continuous function.
 
 Are their other thoughts?
 
 This was discussed (not finished yet) on scipy-dev: 
 http://thread.gmane.org/gmane.comp.python.scientific.devel/16538/focus=16541. 
 

That is a useful discussion, but the question about whether this function 
should just go into NumPy is also of interest.There are arguments that it 
could go into NumPy, SciPy, or sckitis-image.   I think going into 
scikits-image does not make sense because of their general applicability  for 
more than just images and the fact that in the context of image-processing 
these functions *just* do nearest neighbor interpolation. 

I could see these functions going into scipy.ndimage but again because they are 
not necessarily just image processing functions, and the fact that they are so 
simple, perhaps they are best put into NumPy itself. 

-Travis


 Ralf
 
  
 -Travis
 
 
 
 On Mar 7, 2012, at 12:39 PM, Robert Jördens wrote:
 
  Hi everyone,
  I am proposing to add the the two following functions to
  numpy/lib/twodim_base.py:
 
  sum_angle() computes the sum of a 2-d array along an angled axis
  sum_polar() computes the sum of a 2-d array along radial lines or
  along azimuthal circles
 
  https://github.com/numpy/numpy/pull/230
 
  Comments?
 
  When I was looking for a solution to these problems of calculating
  special sums of 2-d arrays I could not find anything and it took me a
  while to figure out a (hopefully) useful and consistent algorithm.
  I can see how one would extend these to higher dimensions but that
  would preclude using bincount() to do the heavy lifting.
  Looking at some other functions, the doctests might need to be split
  into real examples and unittests.
 
  Best,
 
  --
  Robert Jordens.
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion@scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

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


[Numpy-discussion] [enhancement] sum_angle() and sum_polar()

2012-03-07 Thread Robert Jördens
Hi everyone,
I am proposing to add the the two following functions to
numpy/lib/twodim_base.py:

sum_angle() computes the sum of a 2-d array along an angled axis
sum_polar() computes the sum of a 2-d array along radial lines or
along azimuthal circles

https://github.com/numpy/numpy/pull/230

Comments?

When I was looking for a solution to these problems of calculating
special sums of 2-d arrays I could not find anything and it took me a
while to figure out a (hopefully) useful and consistent algorithm.
I can see how one would extend these to higher dimensions but that
would preclude using bincount() to do the heavy lifting.
Looking at some other functions, the doctests might need to be split
into real examples and unittests.

Best,

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