Re: [Numpy-discussion] Stick intersection path algorithm

2013-09-01 Thread Daπid
On 2 September 2013 02:50, Josè Luis Mietta wrote:

> I wanna see if two line segments are connected by a path formed by line
> segments intersected.
>

You could build a network where each segment is a node and an intersection
is a link. Then, you could use NetworkX connected_components to get groups
of segments together.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Stick intersection path algorithm

2013-09-01 Thread Josè Luis Mietta
Hi Chris.

I wanna see if two line segments are connected by a path formed by line 
segments intersected.

Waiting for your answers.

Thanks a lot!


De: Chris Barker - NOAA Federal 
Para: Discussion of Numerical Python  
Enviado: domingo, 1 de septiembre de 2013 21:18
Asunto: Re: [Numpy-discussion] Stick intersection path algorithm
 


On Sun, Sep 1, 2013 at 3:55 PM, Josè Luis Mietta  
wrote:

Given two arbitrary sticks, i need a simple and effective algorithm that 
determinate if that two sticks are conected by a 'intersected-sticks' path.
>
>
>

do you mean a test to see if two line segments intersect?

This looks reasonable:

http://wiki.processing.org/w/Line-Line_intersection


It probably makes sense to translate to Cython (or use the C and call with 
cython).

I"ve also got similar code in a little package of mine:

https://github.com/ChrisBarker-NOAA/py_geometry


Already Cython, and includes code to check a whole bunch at once, stored in 
numpy arrays:

https://github.com/ChrisBarker-NOAA/py_geometry/blob/master/py_geometry/line_crossings.pyx


I hope it's useful to you.

-Chris


-Chris








-Chris





 
Any idea for that?
>
>
>Thanks a lot!
>
>
>___
>NumPy-Discussion mailing list
>NumPy-Discussion@scipy.org
>http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov 
___
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] Stick intersection path algorithm

2013-09-01 Thread Chris Barker - NOAA Federal
On Sun, Sep 1, 2013 at 3:55 PM, Josè Luis Mietta <
joseluismie...@yahoo.com.ar> wrote:

> Given two arbitrary sticks, i need a simple and effective algorithm that
> determinate if that two sticks are conected by a 'intersected-sticks' path.
>
>
do you mean a test to see if two line segments intersect?

This looks reasonable:

http://wiki.processing.org/w/Line-Line_intersection

It probably makes sense to translate to Cython (or use the C and call with
cython).

I"ve also got similar code in a little package of mine:

https://github.com/ChrisBarker-NOAA/py_geometry

Already Cython, and includes code to check a whole bunch at once, stored in
numpy arrays:

https://github.com/ChrisBarker-NOAA/py_geometry/blob/master/py_geometry/line_crossings.pyx

I hope it's useful to you.

-Chris


-Chris








-Chris







> Any idea for that?
>
> Thanks a lot!
>
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

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


[Numpy-discussion] Stick intersection path algorithm

2013-09-01 Thread Josè Luis Mietta
Hi experts!

I wanna study the intersection between line segments (sticks).
I wrote a algorithm that generate a matrix, M, with N rows and N columns. The 
M-element Mij is 1 if stick number 'i' intersect stick number 'j' (obviously M 
is symmetric).

Given two arbitrary sticks, i need a simple and effective algorithm that 
determinate if that two sticks are conected by a 'intersected-sticks' path.

Any idea for that?

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


[Numpy-discussion] Faster np.triu_indices

2013-09-01 Thread Daniel Smith
Hello all,
I was noticing that `np.triu_indices` took quite awhile and discovered it 
creates an upper triu array and then uses `np.where`. This seems quite 
inefficient and I was curious if something like the following would be better:

"""
def fast_triu_indices(dim,k=0):

   tmp_range = np.arange(dim-k)
   rows = np.repeat(tmp_range,(tmp_range+1)[::-1])

   cols = np.ones(rows.shape[0],dtype=np.int)
   inds = np.cumsum(tmp_range[1:][::-1]+1)

   np.put(cols,inds,np.arange(dim*-1+2+k,1))
   cols[0] = k
   np.cumsum(cols,out=cols)
   return (rows,cols)
"""

This is just a first run at the function, and unfortunately does not work for 
k<0. However, it does return the correct results for k>=0 and is between 2-8 
faster on my machine then `np.triu_indices`. Any thoughts on this?

-Daniel

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


Re: [Numpy-discussion] ANN: Numpy 1.8.0 beta 1 release

2013-09-01 Thread Charles R Harris
On Sun, Sep 1, 2013 at 11:15 AM, Daπid  wrote:

> On 1 September 2013 18:54, Charles R Harris wrote:
>
>> I'm happy to announce the first beta release of Numpy 1.8.0. Please try
>> this beta and report any issues on the numpy-dev mailing list.
>>
>
> In an old thread there was discussion about adding minmax and sincos; is
> there a plan for implementing these?
>
>
That would be for 1.9, you should open a new thread for that question. I
think a good argument can be made for both. Another pair that might be
useful would be stdmean (or a better name).

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


Re: [Numpy-discussion] ANN: Numpy 1.8.0 beta 1 release

2013-09-01 Thread Daπid
On 1 September 2013 18:54, Charles R Harris wrote:

> I'm happy to announce the first beta release of Numpy 1.8.0. Please try
> this beta and report any issues on the numpy-dev mailing list.
>

In an old thread there was discussion about adding minmax and sincos; is
there a plan for implementing these?
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] ANN: Numpy 1.8.0 beta 1 release

2013-09-01 Thread Charles R Harris
Hi all,

I'm happy to announce the first beta release of Numpy 1.8.0. Please try
this beta and report any issues on the numpy-dev mailing list.

Source tarballs and release notes can be found at
https://sourceforge.net/projects/numpy/files/NumPy/1.8.0b1/. The Windows
and OS X installers will follow when the infrastructure issues are dealt
with.

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


[Numpy-discussion] numpy.org down - any ETA on when it's back up?

2013-09-01 Thread Ambrose LI
Hi,

numpy.org has been down for at least a few days and is currently
accessible only through archive.org. So I’m just wondering if anyone
with admin access to the site is working on bringing numpy.org back
up.

Apparently, github has recently changed their project subdomains from
github.com to github.io, and (presumably as a result) numpy.github.com
is no longer responding. I checked and saw that numpy.org’s cname has
a ttl of just 60 seconds, so fixing it should fix the problem right
away provided the fix isn’t going to cause a redirection loop.

Thanks much
-- 
cheers,
-ambrose 
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion