Re: [Numpy-discussion] From Python to Numpy

2016-12-30 Thread Alex Rogozhnikov
Hi Nicolas, 
that's a very nice work!

> Comments/questions/fixes/ideas are of course welcome.

Boids example brought my attention too, some comments on it:
- I find using complex numbers here very natural, this should speed up things 
and also shorten the code (rotating without einsum, etc.)
- you probably can speed up things with going to sparse arrays 
- and you can go to really large numbers of 'birds' if you combine it with 
preliminary splitting of space into squares, thus analyze only birds from close 
squares

Also I think worth adding some operations with HSV / HSL color spaces as those 
can be visualized easily e.g. on some photo.

Thanks,
Alex.



> 23 дек. 2016 г., в 12:14, Kiko  написал(а):
> 
> 
> 
> 2016-12-22 17:44 GMT+01:00 Nicolas P. Rougier  >:
> 
> Dear all,
> 
> I've just put online a (kind of) book on Numpy and more specifically about 
> vectorization methods. It's not yet finished, has not been reviewed and it's 
> a bit rough around the edges. But I think there are some material that can be 
> interesting. I'm specifically happy with the boids example that show a nice 
> combination of numpy and matplotlib strengths.
> 
> Book is online at: http://www.labri.fr/perso/nrougier/from-python-to-numpy/ 
> 
> Sources are available at: https://github.com/rougier/from-python-to-numpy 
> 
> 
> 
> Comments/questions/fixes/ideas are of course welcome.
> 
> Wow!!! Beautiful.
> 
> Thanks for sharing.
>  
> 
> 
> Nicolas
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org 
> https://mail.scipy.org/mailman/listinfo/numpy-discussion 
> 
> 
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion

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


Re: [Numpy-discussion] From Python to Numpy

2016-12-30 Thread Nicolas P. Rougier

> On 30 Dec 2016, at 20:36, Alex Rogozhnikov  wrote:
> 
> Hi Nicolas, 
> that's a very nice work!
> 
>> Comments/questions/fixes/ideas are of course welcome.
> 
> Boids example brought my attention too, some comments on it:
> - I find using complex numbers here very natural, this should speed up things 
> and also shorten the code (rotating without einsum, etc.)
> - you probably can speed up things with going to sparse arrays 
> - and you can go to really large numbers of 'birds' if you combine it with 
> preliminary splitting of space into squares, thus analyze only birds from 
> close squares
> 
> Also I think worth adding some operations with HSV / HSL color spaces as 
> those can be visualized easily e.g. on some photo.
> 
> Thanks,
> Alex.


Thanks.

I'm not sure to know how to use complex with this example. Could you elaborate ?

For the preliminary splitting, a quadtree (scipy KDTree) could also help a lot 
but I wanted to stick to numpy only.
A simpler square splitting as you suggest could make thing faster but require 
some work. I'm not sure yet I see how to restrict analysis to close squares.

Nicolas


> 
> 
> 
>> 23 дек. 2016 г., в 12:14, Kiko  написал(а):
>> 
>> 
>> 
>> 2016-12-22 17:44 GMT+01:00 Nicolas P. Rougier :
>> 
>> Dear all,
>> 
>> I've just put online a (kind of) book on Numpy and more specifically about 
>> vectorization methods. It's not yet finished, has not been reviewed and it's 
>> a bit rough around the edges. But I think there are some material that can 
>> be interesting. I'm specifically happy with the boids example that show a 
>> nice combination of numpy and matplotlib strengths.
>> 
>> Book is online at: http://www.labri.fr/perso/nrougier/from-python-to-numpy/
>> Sources are available at: https://github.com/rougier/from-python-to-numpy
>> 
>> 
>> Comments/questions/fixes/ideas are of course welcome.
>> 
>> Wow!!! Beautiful.
>> 
>> Thanks for sharing.
>>  
>> 
>> 
>> Nicolas
>> ___
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>> 
>> ___
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> https://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion

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


Re: [Numpy-discussion] From Python to Numpy

2016-12-30 Thread Marmaduke Woodman

> On 22 Dec 2016, at 17:44, Nicolas P. Rougier  wrote:
> 
> 
> Dear all,
> 
> I've just put online a (kind of) book on Numpy and more specifically about 
> vectorization methods. It's not yet finished, has not been reviewed and it's 
> a bit rough around the edges. But I think there are some material that can be 
> interesting. I'm specifically happy with the boids example that show a nice 
> combination of numpy and matplotlib strengths.
> 
> Book is online at: http://www.labri.fr/perso/nrougier/from-python-to-numpy/
> Sources are available at: https://github.com/rougier/from-python-to-numpy
> 
> 
> Comments/questions/fixes/ideas are of course welcome.

I’ve seen vectorisation taken to the extreme, with negative consequences in 
terms of both speed and readability, in both Python and MATLAB codebases, so I 
would suggest some discussion / wisdom about when not to vectorise. 
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion