Re: [Numpy-discussion] List/location of consecutive integers (2)

2009-05-27 Thread Bruce Southey
Christopher Barker wrote: > Andrea Gavana wrote: > >> I have tried the solutions proposed in the previous thread and it >> looks like Chris' one is the fastest for my purposes. >> > > whoo hoo! What do I win? ;-) > > >> Splitting the reading process between 4 processes will require t

Re: [Numpy-discussion] List/location of consecutive integers (2)

2009-05-26 Thread Christopher Barker
Andrea Gavana wrote: > I have tried the solutions proposed in the previous thread and it > looks like Chris' one is the fastest for my purposes. whoo hoo! What do I win? ;-) > Splitting the reading process between 4 processes will require the > exchange of 5-20 MB from the child processes to

[Numpy-discussion] List/location of consecutive integers (2)

2009-05-26 Thread Andrea Gavana
Hi All, I have tried the solutions proposed in the previous thread and it looks like Chris' one is the fastest for my purposes. Now, I have a question which is probably more conceptual than implementation-related. I started this little thread as my task is to read medium to (relatively) big u

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-25 Thread josef . pktd
On Mon, May 25, 2009 at 1:57 PM, Neil Crighton wrote: > Andrea Gavana gmail.com> writes: > >>     this should be a very easy question but I am trying to make a >> script run as fast as possible, so please bear with me if the solution >> is easy and I just overlooked it. > > That's weird, I was tr

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-25 Thread Neil Crighton
Andrea Gavana gmail.com> writes: > this should be a very easy question but I am trying to make a > script run as fast as possible, so please bear with me if the solution > is easy and I just overlooked it. That's weird, I was trying to solve exactly the same problem a couple of weeks ago for

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-25 Thread Andrea Gavana
Hi All, On Fri, May 22, 2009 at 11:28 PM, David Warde-Farley wrote: > On 22-May-09, at 6:13 PM, Christopher Barker wrote: > >> that's why I put a sys.maxint at the end of the series... > > Oops! I foolishly assumed the sequence was unaltered. That makes a lot > more sense. Thank you guys for your

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread David Warde-Farley
On 22-May-09, at 6:13 PM, Christopher Barker wrote: > that's why I put a sys.maxint at the end of the series... Oops! I foolishly assumed the sequence was unaltered. That makes a lot more sense. David ___ Numpy-discussion mailing list Numpy-discussio

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread Pierre GM
On May 22, 2009, at 6:15 PM, Christopher Barker wrote: > Pierre GM wrote: >> scikits.hydroclimpy.core.tools (hydroclimpy.sourceforge.net). > > whoa! Why didn't I ever see that before. Here I am , witting a whole > bunch of my own code to deal with time series of meteorological > data > argg

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread Christopher Barker
Pierre GM wrote: > scikits.hydroclimpy.core.tools (hydroclimpy.sourceforge.net). whoa! Why didn't I ever see that before. Here I am , witting a whole bunch of my own code to deal with time series of meteorological data argg! Now I need to go dig into that more. -Chris -- Christopher B

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread Christopher Barker
David Warde-Farley wrote: > I don't think this is very general: > > In [53]: indices > Out[53]: > array([ -3, 1, 2, 3, 4, 5, 6, 7, 8, > 9, 255, 256, 257, 258, 10001, 10002, 10003, 10004]) > > In [54]: breaks = diff(indices) != 1 > > In [55]:

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread josef . pktd
On Fri, May 22, 2009 at 3:59 PM, David Warde-Farley wrote: > On 22-May-09, at 1:03 PM, Christopher Barker wrote: > >> In [104]: zip(indices[np.r_[True, breaks[:-1]]], indices[breaks]) > > > > I don't think this is very general: > > In [53]: indices > Out[53]: > array([   -3,     1,     2,     3,  

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread Pierre GM
On May 22, 2009, at 12:31 PM, Andrea Gavana wrote: > Hi All, > >this should be a very easy question but I am trying to make a > script run as fast as possible, so please bear with me if the solution > is easy and I just overlooked it. > > I have a list of integers, like this one: > > indices

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread David Warde-Farley
On 22-May-09, at 1:03 PM, Christopher Barker wrote: > In [104]: zip(indices[np.r_[True, breaks[:-1]]], indices[breaks]) I don't think this is very general: In [53]: indices Out[53]: array([ -3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 256, 257, 258,

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread Christopher Barker
Andrea Gavana wrote: > I have a list of integers, like this one: > > indices = [1,2,3,4,5,6,7,8,9,255,256,257,258,10001,10002,10003,10004] > >>From this list, I would like to find out which values are consecutive > and store them in another list of tuples (begin_consecutive, > end_consecutive) or

Re: [Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread josef . pktd
On Fri, May 22, 2009 at 12:31 PM, Andrea Gavana wrote: > Hi All, > >    this should be a very easy question but I am trying to make a > script run as fast as possible, so please bear with me if the solution > is easy and I just overlooked it. > > I have a list of integers, like this one: > > indic

[Numpy-discussion] List/location of consecutive integers

2009-05-22 Thread Andrea Gavana
Hi All, this should be a very easy question but I am trying to make a script run as fast as possible, so please bear with me if the solution is easy and I just overlooked it. I have a list of integers, like this one: indices = [1,2,3,4,5,6,7,8,9,255,256,257,258,10001,10002,10003,10004] >Fro