Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Joris Van den Bossche
2013/4/18 Chris Barker - NOAA Federal > On Wed, Apr 17, 2013 at 1:09 PM, Bob Nnamtrop > wrote: > > It would seem that before 1970 the dates do not include the time zone > > adjustment while after 1970 they do. This is the source of the extra 7 > > hours. > > > > In [21]: np.datetime64('1970-01-0

[Numpy-discussion] NumPy 1.7.0 w/ MKL available on PiCloud

2013-04-17 Thread John Riley
Hello, I'm happy to announce that NumPy 1.7.0 is now available on PiCloud [1]. Previously, NumPy 1.6.2 was the most up-to-date version available by default. While any user could always create a custom environment, and install the latest version themselves [2], we've decided to address the issue d

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Benjamin Root
On Wed, Apr 17, 2013 at 7:10 PM, Chris Barker - NOAA Federal < chris.bar...@noaa.gov> wrote: > On Wed, Apr 17, 2013 at 1:09 PM, Bob Nnamtrop > wrote: > > It would seem that before 1970 the dates do not include the time zone > > adjustment while after 1970 they do. This is the source of the extra

Re: [Numpy-discussion] Time Zones and datetime64

2013-04-17 Thread Chris Barker - NOAA Federal
On Fri, Apr 12, 2013 at 1:36 PM, Anthony Scopatz wrote: > Option (2), what datetime does, is the wrong model. This is more > complicated in both the implementation and API, and leads to lots of broken > code, weird errors, and no clear right way of doing thing. could you elaborate a bit more? I'

[Numpy-discussion] numpy scalars and savez -- bug?

2013-04-17 Thread Chris Barker - NOAA Federal
Folks, I've discovered somethign intertesting (bug?) with numpy scalars ans savz. If I save a numpy scalar, then reload it, ot comes back as rank-0 array -- similar, but not the same thing: In [144]: single_value, type(single_value) Out[144]: (2.0, numpy.float32) In [145]: np.savez('test.npz', s

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Chris Barker - NOAA Federal
On Wed, Apr 17, 2013 at 1:09 PM, Bob Nnamtrop wrote: > It would seem that before 1970 the dates do not include the time zone > adjustment while after 1970 they do. This is the source of the extra 7 > hours. > > In [21]: np.datetime64('1970-01-01 00') > Out[21]: numpy.datetime64('1970-01-01T00:00-0

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Ondřej Čertík
On Wed, Apr 17, 2013 at 2:09 PM, Bob Nnamtrop wrote: > It would seem that before 1970 the dates do not include the time zone > adjustment while after 1970 they do. This is the source of the extra 7 > hours. > > In [21]: np.datetime64('1970-01-01 00') > Out[21]: numpy.datetime64('1970-01-01T00:00-0

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Bob Nnamtrop
It would seem that before 1970 the dates do not include the time zone adjustment while after 1970 they do. This is the source of the extra 7 hours. In [21]: np.datetime64('1970-01-01 00') Out[21]: numpy.datetime64('1970-01-01T00:00-0700','h') In [22]: np.datetime64('1969-12-31 00') Out[22]: numpy

Re: [Numpy-discussion] Gsoc : Performance parity between numpy arrays and Python scalars

2013-04-17 Thread Raul Cota
Few comments on the topic, The postings I did to the list were in numpy 1.6 but the pull requests were done on the latest code at that time I believe 1.7 . There are still a few comments pending that I have not had a chance to look into, but that is a separ

Re: [Numpy-discussion] Adding gufuncs

2013-04-17 Thread Pauli Virtanen
14.04.2013 18:39, Charles R Harris kirjoitti: > There is a pull request for > work adding linear algebra support as generalized ufuncs. The result is > that many of the linear algebra routines can now be applied to stacks of > matrices. Another new feature

Re: [Numpy-discussion] contributing to numpy

2013-04-17 Thread Andrew Giessel
Chuck- Thank you for the very helpful and encouraging email! I will first try to just add a function, rather than a method on ndarray (which looks to be lower level ie: C). The pointer to numeric.py / test_numeric.py is exactly what I needed. I will of course figure out a good test and document

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Chris Barker - NOAA Federal
On Tue, Apr 16, 2013 at 3:55 PM, Bob Nnamtrop wrote: > pss It would be most handy if datetime64 had a constructor of the form > np.datetime64(year,month,day,hour,min,sec) where these inputs were numpy > arrays and the output would have the same shape as the input arrays (but be > of type datetime

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Ondřej Čertík
On Wed, Apr 17, 2013 at 10:11 AM, Sebastian Berg wrote: > On Wed, 2013-04-17 at 09:07 -0700, Chris Barker - NOAA Federal wrote: >> On Wed, Apr 17, 2013 at 9:04 AM, Chris Barker - NOAA Federal >> wrote: >> > On Tue, Apr 16, 2013 at 8:23 PM, Zachary Ploskey >> > wrote: >> > I'd say we need some m

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Sebastian Berg
On Wed, 2013-04-17 at 09:07 -0700, Chris Barker - NOAA Federal wrote: > On Wed, Apr 17, 2013 at 9:04 AM, Chris Barker - NOAA Federal > wrote: > > On Tue, Apr 16, 2013 at 8:23 PM, Zachary Ploskey wrote: > > I'd say we need some more unit-tests! > > speaking of which, where are the tests? I just d

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Chris Barker - NOAA Federal
On Wed, Apr 17, 2013 at 9:07 AM, Chris Barker - NOAA Federal wrote: > speaking of which, where are the tests? I just did a quick poke at > github, and found: > > https://github.com/numpy/numpy/tree/master/numpy/testing > and > https://github.com/numpy/numpy/tree/master/numpy/test > > but there's v

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Chris Barker - NOAA Federal
On Wed, Apr 17, 2013 at 9:04 AM, Chris Barker - NOAA Federal wrote: > On Tue, Apr 16, 2013 at 8:23 PM, Zachary Ploskey wrote: > I'd say we need some more unit-tests! speaking of which, where are the tests? I just did a quick poke at github, and found: https://github.com/numpy/numpy/tree/master/

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Chris Barker - NOAA Federal
On Tue, Apr 16, 2013 at 8:23 PM, Zachary Ploskey wrote: > The problem does not appear to exist on Linux with numpy version 1.6.2. datetime64 was re-vampded a fair bit between 1.6 and 1.7 something is up here for sure with 1.7 We can be more dramatic about it: In [5]: np.datetime64('1970-01-01T

Re: [Numpy-discussion] datetime64 1970 issue

2013-04-17 Thread Chris Barker - NOAA Federal
On Tue, Apr 16, 2013 at 9:32 PM, Charles R Harris wrote: > Dude, it was the 60's, no one remembers. I can't say I remember much from then -- but probably because I was 4 years old, not because of too much partying -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Div

Re: [Numpy-discussion] contributing to numpy

2013-04-17 Thread Charles R Harris
On Wed, Apr 17, 2013 at 6:29 AM, andrew giessel wrote: > First, my apologies if this isn't the right forum for this question- I > looked for a dev list, but couldn't really find it. > > I have a small method I'd like to contribute to numpy, ideally as a method > on ndarrays and a general function

[Numpy-discussion] Gsoc : Performance parity between numpy arrays and Python scalars

2013-04-17 Thread Arink Verma
Hello everyone I am Arink, computer science student and open source enthusiastic. This year I am interested to work on project "Performance parity between numpy arrays and Python scalars"[1]. I tried to adobt rald's work on numpy1.7[2] (which was done for numpy1.6 [3]). Till now by avoiding a) th

Re: [Numpy-discussion] Finding the same value in List

2013-04-17 Thread Bob Nnamtrop
At bit OT, but I am new to numpy. The help for np.where says: Returns --- out : ndarray or tuple of ndarrays If both `x` and `y` are specified, the output array contains elements of `x` where `condition` is True, and elements from `y` elsewhere. If on

Re: [Numpy-discussion] Finding the same value in List

2013-04-17 Thread Happyman
okay Todd, I got it. There are some reasons why I preferred asking that question. Let me explain: I am using Excel data which contains 3 columns and say 12 rows to process some simple data. What I want to do with the code you provided is that In the first column A has data that indicates the sa

[Numpy-discussion] contributing to numpy

2013-04-17 Thread andrew giessel
First, my apologies if this isn't the right forum for this question- I looked for a dev list, but couldn't really find it. I have a small method I'd like to contribute to numpy, ideally as a method on ndarrays and a general function in the numpy namespace. I found it on a stackoverflow thread, an

Re: [Numpy-discussion] Finding the same value in List

2013-04-17 Thread Todd
> > The data type: > x in ndarray and x[ i ]--> int64 > type(f) --> ' list ' > type( f[ 0 ] ) --> ' tuple ' > type( f[ 0][0] ) --> 'ndarray' > type( f[ 0 ][ 0 ][ 0] ) --> 'int64' > > How do you think to avoid diversity if data type in this example? I

Re: [Numpy-discussion] Finding the same value in List

2013-04-17 Thread Happyman
Okay Todd, In both results, I got the proper values.. for me indices are important also counting.  From your code:  let's say function--> sort_out(data):        x , f = sort_out( data ) The data type: x in ndarray and x[ i ]--> int64 type(f)                     -->   ' list ' type( f[ 0 ] )    

Re: [Numpy-discussion] Finding the same value in List

2013-04-17 Thread Sebastian Berg
On Wed, 2013-04-17 at 13:32 +0400, Happyman wrote: > Hi Todd, > Greaaat thanks for your help.. By the way, the first one (I think) is > much simpler.. I tested it and ,of course, it is 1D, but it is also a > good idea to consider it for Ndimensional. > I prefer the first one! Do you you think first

Re: [Numpy-discussion] Finding the same value in List

2013-04-17 Thread Happyman
Hi Todd, Greaaat thanks for your help.. By the way, the first one (I think) is much simpler.. I tested it and ,of course, it is 1D, but it is also a good idea to consider it for Ndimensional. I prefer the first one! Do you you think first version is okay to use?  Среда, 17 апреля 2013, 11:02 +

Re: [Numpy-discussion] Finding the same value in List

2013-04-17 Thread Todd
On Wed, Apr 17, 2013 at 10:46 AM, Todd wrote: > x,i=numpy.unique(y, return_inverse=True) > f=[numpy.where(i==ind) for ind in range(len(x))] > > > A better version would be (np.where returns tuples, but we don't want tuples): x,i=numpy.unique(y, return_inverse=True) f=[numpy.where(i==ind)[0] for

Re: [Numpy-discussion] Finding the same value in List

2013-04-17 Thread Todd
x,i=numpy.unique(y, return_inverse=True) f=[numpy.where(i==ind) for ind in range(len(x))] x will give you the list of unique values, and f will give you the indices of each corresponding value in x. So f[0] is the indices of x[0] in y. To explain, unique in this form gives two outputs, a sorted,

[Numpy-discussion] Finding the same value in List

2013-04-17 Thread Happyman
Hello, I have had encountered some problem while I was trying to create the following code which finds number of the same values  and indexes in an array or list. Here is the code: y = [ 1, 12,  3,  3,  5,  1,  1, 34, 0, 0,  1,  5] OR  y = array( [ 1, 12,  3,  3,  5,  1,  1, 34, 0, 0,  1,  5 ]