Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 10:13 AM, Chao YUE wrote: > Dear all, > > sorry for this stupid question but I cannot find it in numpy tutorial or > google. > suppose I have a=np.arange(11). > > In [32]: a < 8 > Out[32]: > array([ True, True, True, True, True, True, True, True, False, >Fal

Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 3:21 PM, Zachary Pincus wrote: > I keep meaning to use matplotlib as well, but every time I try I also get > really turned off by the matlabish interface in the examples. I get that > it's a selling point for matlab refugees, but I find it counterintuitive in > the same way

Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 4:03 PM, Gökhan Sever wrote: > > I think, IPython is great for interaction with the OO interface of the > matlab. Just starting simple with: > > fig=plt.figure() > ax=plt.gca() > and keep tabbing ax., fig. or any object you create on the canvas >

Re: [Numpy-discussion] wanted: decent matplotlib alternative

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 4:15 PM, Benjamin Root wrote: > Myself and other developers would greatly appreciate help from the > community to point out which examples are too confusing or out of date. We > It would be nice to have a social interface for the mpl gallery like the one similar to the R-

Re: [Numpy-discussion] Re place array values

2012-03-14 Thread Gökhan Sever
Hi, You can try masked_array module: x = np.array([[0,1,2],[3,4,5],[6,7,8]]) I3 np.ma.masked_where(x<1, x) O3 masked_array(data = [[-- 1 2] [3 4 5] [6 7 8]], mask = [[ True False False] [False False False] [False False False]], fill_value = 99) There might be a sma

[Numpy-discussion] Question on numpy.ma.masked_values

2012-03-15 Thread Gökhan Sever
Hello, >From the masked_values() documentation -> http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.masked_values.html I10 np.ma.masked_values(x, 1.5) O10 masked_array(data = [ 1. 1.1 2. 1.1 3. ], mask = False, fill_value = 1.5) I12 np.ma.masked_values(x, 1.

Re: [Numpy-discussion] Question on numpy.ma.masked_values

2012-03-15 Thread Gökhan Sever
On Thu, Mar 15, 2012 at 12:56 PM, Gökhan Sever wrote: If not so, how can I return a set of False values if my masking condition > is not met? > Self-answer: I can force the mask to be filled with False's, however unsure if this is a safe operation. I50 x = np.array([1, 1.1, 2, 1.1,

Re: [Numpy-discussion] Question on numpy.ma.masked_values

2012-03-15 Thread Gökhan Sever
On Thu, Mar 15, 2012 at 1:12 PM, Pierre GM wrote: > Ciao Gökhan, > AFAIR, shrink is used only to force a collapse of a mask full of False, > not to force the creation of such a mask. > Now, it should work as you expected, meaning that it needs to be fixed. > Could you open a ticket? And put me in

Re: [Numpy-discussion] Question on numpy.ma.masked_values

2012-03-15 Thread Gökhan Sever
Submitted the ticket at http://projects.scipy.org/numpy/ticket/2082 On Thu, Mar 15, 2012 at 1:24 PM, Gökhan Sever wrote: > > > On Thu, Mar 15, 2012 at 1:12 PM, Pierre GM wrote: > >> Ciao Gökhan, >> AFAIR, shrink is used only to force a collapse of a mask full of Fa

Re: [Numpy-discussion] Question on numpy.ma.masked_values

2012-03-20 Thread Gökhan Sever
Yes, that's the behaviour that I expect setting the 'shrink' keyword to 'False' > Now, just to be clear, you'd want > 'np.ma.masked_values(...,shrink=False) to create a maked array w/ a > full boolean mask by default, right ? ___ NumPy-Discussion mailing

[Numpy-discussion] float32 to float64 casting

2012-11-15 Thread Gökhan Sever
Hello, Could someone briefly explain why are these two operations are casting my float32 arrays to float64? I1 (np.arange(5, dtype='float32')).dtype O1 dtype('float32') I2 (10*np.arange(5, dtype='float32')).dtype O2 dtype('float64') I3 (np.arange(5, dtype='float32')[0]).dtype O3 dtype('fl

Re: [Numpy-discussion] float32 to float64 casting

2012-11-16 Thread Gökhan Sever
np.float32()*5e38 O16 2.77749998e+42 I17 (np.float32()*5e38).dtype O17 dtype('float64') IDL> help, 5e38*float() FLOAT = Inf In IDL, the expression doesn't get converted to DOUBLE. Perhaps, its a design decision. On Thu, Nov 15, 2012 at 8:24 PM, G

Re: [Numpy-discussion] float32 to float64 casting

2012-11-17 Thread Gökhan Sever
On Sat, Nov 17, 2012 at 9:47 AM, Nathaniel Smith wrote: > On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever > wrote: > > Thanks for the explanations. > > > > For either case, I was expecting to get float32 as a resulting data type. > > Since, float32 is large enou

Re: [Numpy-discussion] Modern Fortran vs NumPy syntax

2013-02-08 Thread Gökhan Sever
Hi Ondřej, Any ideas that your manual syntax mapping would evolve to an automatic translation tool like i2py [http://code.google.com/p/i2py/] Thanks. On Thu, Feb 7, 2013 at 12:22 PM, Ondřej Čertík wrote: > Hi, > > I have recently setup a page about modern Fortran: > > http://fortran90.org/ > >

[Numpy-discussion] 2D array indexing

2014-02-28 Thread Gökhan Sever
Hello, Given this simple 2D array: In [1]: np.arange(9).reshape((3,3)) Out[1]: array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) In [2]: a = np.arange(9).reshape((3,3)) In [3]: a[:1:] Out[3]: array([[0, 1, 2]]) In [4]: a[:1,:] Out[4]: array([[0, 1, 2]]) Could you tell me why the last two

Re: [Numpy-discussion] 2D array indexing

2014-02-28 Thread Gökhan Sever
ylor.deb...@googlemail.com> wrote: > On 01.03.2014 00:32, Gökhan Sever wrote: > > > > Hello, > > > > Given this simple 2D array: > > > > In [1]: np.arange(9).reshape((3,3)) > > Out[1]: > > array([[0, 1, 2], > >[3, 4, 5], > >[6,

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread Gökhan Sever
On Wed, Aug 4, 2010 at 6:59 PM, wrote: > Hey folks, > > I've one array, x, that you could define as follows: > [[1, 2.25], > [2, 2.50], > [3, 2.25], > [4, 0.00], > [8, 0.00], > [9, 2.75]] > > Then my second array, y, is: > [[1, 0.00], > [2, 0.00], > [3, 0.00], > [4, 0.00], > [5, 0.00], >

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread Gökhan Sever
On Wed, Aug 4, 2010 at 8:00 PM, Gökhan Sever wrote: > > > On Wed, Aug 4, 2010 at 6:59 PM, wrote: > >> Hey folks, >> >> I've one array, x, that you could define as follows: >> [[1, 2.25], >> [2, 2.50], >> [3, 2.25], >> [4, 0.00], >

[Numpy-discussion] {OT} Mailing trends

2010-08-05 Thread Gökhan Sever
Hello, There is a nice e-mailing trend tool for Gmail users at http://code.google.com/p/mail-trends/ It is a command line tool producing an html output showing your e-mailing statistics. In my inbox, the following threads are highly ranked in the top threads section. [Numpy-discussion] Announcing

[Numpy-discussion] Broken links on new.scipy

2010-08-06 Thread Gökhan Sever
Hi, @ http://new.scipy.org/download.html numpy and scipy links for Fedora is broken. Could you update the links with these? https://admin.fedoraproject.org/pkgdb/acls/name/numpy https://admin.fedoraproject.org/pkgdb/acls/name/scipy Thanks

Re: [Numpy-discussion] summing over more than one axis

2010-08-19 Thread Gökhan Sever
On Thu, Aug 19, 2010 at 9:01 AM, greg whittier wrote: > I frequently deal with 3D data and would like to sum (or find the > mean, etc.) over the last two axes. I.e. sum a[i,j,k] over j and k. > I find using .sum() really convenient for 2d arrays but end up > reshaping 2d arrays to do this. I kn

Re: [Numpy-discussion] common significant diigits

2010-09-15 Thread Gökhan Sever
On Wed, Sep 15, 2010 at 2:34 PM, Benjamin Root wrote: > Hello, > > I am trying to solve a problem in matplotlib where I would have an array of > floating point numbers and I want to quickly determine what is the closest > common offset to a power of 10. In other words, if given: > > [12373.43, 1

Re: [Numpy-discussion] Viewer for 2D Numpy arrays (GUI)

2010-09-17 Thread Gökhan Sever
On Fri, Sep 17, 2010 at 12:16 AM, Mayank P Jain wrote: > Currently I am exporting them to csv files, but I wonder if there is a > viewer that can be used with native numpy array files to view and preferably > modify the 2D arrays. > Any help would be appreciated. > I would suggest using IPy

[Numpy-discussion] Question about masked arrays

2010-09-19 Thread Gökhan Sever
Hello, Consider these two sets of container arrays --one defined as usual np array the others as ma arrays: all_measured = np.ma.zeros((16, 18)) all_predicted = np.ma.zeros((16, 18)) all_measured2 = np.zeros((16, 18)) all_predicted2 = np.zeros((16, 18)) I do a computation within

Re: [Numpy-discussion] Question about masked arrays

2010-09-20 Thread Gökhan Sever
On Mon, Sep 20, 2010 at 1:05 PM, Robert Kern wrote: > Are you asking about when masked arrays are casted to ndarrays (and > thus losing the mask information)? Most times when a function uses > asarray() or array() to explicitly cast the inputs to an ndarray. The > reason that np.mean() gives the

Re: [Numpy-discussion] Question about masked arrays

2010-09-20 Thread Gökhan Sever
On Mon, Sep 20, 2010 at 3:34 PM, Benjamin Root wrote: > I have been using masked arrays quite extensively. My take on them is that > if a masked array makes sense in that operation, then they should still work > with the regular functions. However, there have been many cases where a > developer

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread Gökhan Sever
On Tue, Sep 21, 2010 at 1:55 AM, Peter Schmidtke wrote: > Dear all, > > I'd like to know if there is a pythonic / numpy way of retrieving unique > lines of a 2d numpy array. > > In a way I have this : > > [[409 152] > [409 152] > [409 152] > [409 152] > [409 152] > [409 152] > [409 152] > [

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread Gökhan Sever
On Tue, Sep 21, 2010 at 12:43 PM, wrote: > I'm a bit surprised, I think np.unique does some extra work to > maintain the order. > The tolist() might not be necessary if you iterate over rows. > Testing again with a smaller k array and more repeats I[25]: k = np.array((a.tolist()*5000)) I[27]:

Re: [Numpy-discussion] slicing / indexing question

2010-09-22 Thread Gökhan Sever
On Tue, Sep 21, 2010 at 6:20 PM, Timothy W. Hilton wrote: > Hello, > > I have an indexing problem which I suspect has a simple solution, but > I've not been able to piece together various threads I've read on this > list to solve. > > I have an 80x1200x1200 nd.array of floats this_par. I have a >

[Numpy-discussion] Appending/combining masked arrays

2010-09-29 Thread Gökhan Sever
Hello, Consider these two simple masked arrays: I[188]: a = np.ma.masked_equal([1,2,3], value=2) I[189]: b = np.ma.masked_equal([4,3,2], value=2) An operation like this voids the mask: I[190]: np.append(a,b) O[190]: masked_array(data = [1 2 3 4 3 2], mask = False, fill_valu

Re: [Numpy-discussion] Appending/combining masked arrays

2010-09-29 Thread Gökhan Sever
> You're using a standard numpy function on a masked array. It's hardly > surprising that you run into some issues. You should use the np.ma > equivalent. Except of course that the equivalent doesn't exist yet... Please > open a ticket. Here it comes -> http://projects.scipy.org/numpy/ticket/16

Re: [Numpy-discussion] Appending/combining masked arrays

2010-09-29 Thread Gökhan Sever
On Wed, Sep 29, 2010 at 5:09 PM, Pierre GM wrote: > > On Sep 29, 2010, at 11:46 PM, josef.p...@gmail.com wrote: >> >> any of the ma stack array function might also work, or not? > > In np.ma.extras ? Most likely, yes This seems to do what I want: I[262]: np.ma.hstack(all_measured) O[262]: masked

[Numpy-discussion] Return values stats.mstats.linregress

2010-10-01 Thread Gökhan Sever
Hello, mstats.linregress returns 6 values. I don't see this documented from the function docstring. I know 0.91... is r. What is masked_array return here? I[29]: stats.mstats.linregress(np.ma.hstack(all_measured[0::6]), np.ma.hstack(all_predicted[0::6])) O[29]: (2.6309756058562122, -358.84572340

Re: [Numpy-discussion] numpy speed question

2010-11-25 Thread Gökhan Sever
On Thu, Nov 25, 2010 at 4:13 AM, Jean-Luc Menut wrote: > Hello all, > > I have a little question about the speed of numpy vs IDL 7.0. I did a > very simple little check by computing just a cosine in a loop. I was > quite surprised to see an order of magnitude of difference between numpy > and IDL,

Re: [Numpy-discussion] NumPy speed tests by NASA

2011-02-22 Thread Gökhan Sever
On Tue, Feb 22, 2011 at 2:44 PM, Alan G Isaac wrote: > > > I don't believe the matrix multiplication results. > Maybe I misunderstand them ... > > >>> t = timeit.Timer("np.dot(A,B)","import numpy as > np;N=1500;A=np.random.random((N,N));B=np.random.random((N,N))") > >>> print t.timeit(numb

[Numpy-discussion] Anybody going to PyCon?

2011-03-07 Thread Gökhan Sever
Hello, I am going to the PyCon this week. I am presenting a poster about an atmospheric sciences related project -- the most active development from my coding site over at http://code.google.com/p/ccnworks/ Is there anybody in the community participating there as well? Any plans for sprinting or

Re: [Numpy-discussion] Anybody going to PyCon?

2011-03-10 Thread Gökhan Sever
Yung-Yu, We are advertised on this blog http://pycon.blogspot.com/2011/03/pycon-2011-outside-talks-poster-session.html I will be in the conference venue by tomorrow morning. There are many interesting talks and posters that I look forward seeing plus meeting those presenters. See you in Atlanta.

[Numpy-discussion] Segfault using "fromstring" and reading variable length string

2011-04-21 Thread Gökhan Sever
Hello, Given this piece of code (I can provide the meg file off-the list for those who wants to reproduce the error) import numpy as np f = open("a08A0122.341071.meg", "rb") dt = np.dtype([('line1', '|S80'), ('line2', np.object_), ('line3', '|S80'), ('line4', '|S80'), ('line5',

Re: [Numpy-discussion] Segfault using "fromstring" and reading variable length string

2011-04-22 Thread Gökhan Sever
On Fri, Apr 22, 2011 at 12:37 PM, Ralf Gommers wrote: > On Thu, Apr 21, 2011 at 10:06 PM, Gökhan Sever > wrote: > > Hello, > > Given this piece of code (I can provide the meg file off-the list for > those > > who wants to reproduce the error) > > Can you inst

Re: [Numpy-discussion] Segfault using "fromstring" and reading variable length string

2011-04-24 Thread Gökhan Sever
On Fri, Apr 22, 2011 at 6:32 PM, Mark Wiebe wrote: > I took a quick look at this issue and committed a fix. PyArray_FromString > was doing a check to exclude object arrays, but that check was incorrect. > Now it should appropriately raise an exception instead of creating an > invalid array. > > >

[Numpy-discussion] Unicode characters in a numpy array

2011-06-15 Thread Gökhan Sever
Hello, The following snippet works fine for a regular string and prints out the string without a problem. python Python 2.7 (r27:82500, Sep 16 2010, 18:02:00) [GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> mystr = u"öööğ

Re: [Numpy-discussion] Unicode characters in a numpy array

2011-06-17 Thread Gökhan Sever
On Thu, Jun 16, 2011 at 8:54 PM, Charles R Harris wrote: > > > On Wed, Jun 15, 2011 at 1:30 PM, Gökhan Sever wrote: >> >> Hello, >> >> The following snippet works fine for a regular string and prints out >> the string without a problem. >> >>

Re: [Numpy-discussion] Reading a big netcdf file

2011-08-03 Thread Gökhan Sever
Here are my values for your comparison: test.nc file is about 715 MB. The details are below: In [21]: netCDF4.__version__ Out[21]: '0.9.4' In [22]: np.__version__ Out[22]: '2.0.0.dev-b233716' In [23]: from netCDF4 import Dataset In [24]: f = Dataset("test.nc") In [25]: f.variables['reflectivi

Re: [Numpy-discussion] Reading a big netcdf file

2011-08-03 Thread Gökhan Sever
Message from syslogd@ccn at Aug 3 10:51:43 ... kernel:[48715.531332] Code: be 33 01 00 00 48 89 fb 48 c7 c7 67 31 7a 81 e8 b0 2d f1 ff e8 90 f2 33 00 48 89 df e8 86 db 00 00 48 83 bb 60 01 00 00 00 74 02 <0f> 0b 48 8b 83 10 02 00 00 a8 20 75 02 0f 0b a8 40 74 02 0f 0b On Wed, Aug 3, 2011

Re: [Numpy-discussion] Reading a big netcdf file

2011-08-03 Thread Gökhan Sever
This is what I get here: In [1]: a = np.zeros((21601, 10801), dtype=np.uint16) In [2]: a.tofile('temp.npa') In [3]: del a In [4]: timeit a = np.fromfile('temp.npa', dtype=np.uint16) 1 loops, best of 3: 251 ms per loop On Wed, Aug 3, 2011 at 10:50 AM, Christopher Barker wrote: > On 8/3/11 9:3

Re: [Numpy-discussion] Reading a big netcdf file

2011-08-03 Thread Gökhan Sever
f.variables['reflectivity'][:] In [6]: type z --> type(z) Out[6]: In [10]: id f.variables['reflectivity'][:] ---> id(f.variables['reflectivity'][:]) Out[10]: 37895488 In [11]: id z ---> id(z) Out[11]: 37901440 On Wed, Aug 3, 2011 at 12:40 PM, Christop

Re: [Numpy-discussion] Reading a big netcdf file

2011-08-03 Thread Gökhan Sever
On Wed, Aug 3, 2011 at 3:15 PM, Christopher Barker wrote: > On 8/3/11 1:57 PM, Gökhan Sever wrote: > > This is what I get here: > > > > In [1]: a = np.zeros((21601, 10801), dtype=np.uint16) > > > > In [2]: a.tofile('temp.npa') > > > > In [3]:

Re: [Numpy-discussion] Reading a big netcdf file

2011-08-03 Thread Gökhan Sever
Back to the reality. After clearing the cache using Warren's suggestion: In [1]: timeit -n1 -r1 a = np.fromfile('temp.npa', dtype=np.uint16) 1 loops, best of 1: 7.23 s per loop On Wed, Aug 3, 2011 at 4:52 PM, Eric Firing wrote: > On 08/03/2011 11:24 AM, Gökhan Sever wrote:

Re: [Numpy-discussion] Fastest way to parsing a specific binay file

2009-09-02 Thread Gökhan Sever
On Wed, Sep 2, 2009 at 1:58 PM, Robert Kern wrote: > On Wed, Sep 2, 2009 at 13:28, Gökhan Sever wrote: > > Put the reference manual in: > > > > http://drop.io/1plh5rt > > > > First few pages describe the data format they use. > > Ah. The fields are *not*

Re: [Numpy-discussion] Fastest way to parsing a specific binay file

2009-09-04 Thread Gökhan Sever
On Thu, Sep 3, 2009 at 12:22 AM, Robert Kern wrote: > On Wed, Sep 2, 2009 at 23:59, Gökhan Sever wrote: > > > Robert, > > > > You must have thrown a couple RTFM's while replying my emails :) > > Not really. There's no manual for this. Greg Wilson&#x

[Numpy-discussion] Simple pattern recognition

2009-09-16 Thread Gökhan Sever
Hello all, I want to be able to count predefined simple rectangle shapes on an image as shown like in this one: http://img7.imageshack.us/img7/2327/particles.png Which is in my case to count all the blue pixels (they are ice-snow flake shadows in reality) in one of the column. What is the way to

Re: [Numpy-discussion] Simple pattern recognition

2009-09-17 Thread Gökhan Sever
On Wed, Sep 16, 2009 at 8:43 PM, David Warde-Farley wrote: > On 16-Sep-09, at 8:22 PM, Gökhan Sever wrote: > > > Hello all, > > > > I want to be able to count predefined simple rectangle shapes on an > > image as > > shown like in this one: > http://img

Re: [Numpy-discussion] Simple pattern recognition

2009-09-17 Thread Gökhan Sever
On Wed, Sep 16, 2009 at 7:53 PM, Alan G Isaac wrote: > On 9/16/2009 8:22 PM, Gökhan Sever wrote: > > I want to be able to count predefined simple rectangle shapes on an > > image as shown like in this one: > > http://img7.imageshack.us/img7/2327/particles.png > > ch.9

Re: [Numpy-discussion] [Matplotlib-users] Simple pattern recognition

2009-09-17 Thread Gökhan Sever
On Wed, Sep 16, 2009 at 10:46 PM, Tony S Yu wrote: > > On Sep 16, 2009, at 8:22 PM, Gökhan Sever wrote: > > Hello all, > > I want to be able to count predefined simple rectangle shapes on an image > as shown like in this one: > http://img7.imageshack.us/img7/2327/particle

Re: [Numpy-discussion] Simple pattern recognition

2009-09-17 Thread Gökhan Sever
On Thu, Sep 17, 2009 at 10:14 AM, Gökhan Sever wrote: > > I use PIL to read my png file (after cropped the initial image to the > column of my interest) Like: > > from PIL import Image > myim = Image('seccol.png) > imdata = np.array(myim.getdata()) > > From this o

Re: [Numpy-discussion] Simple pattern recognition

2009-09-21 Thread Gökhan Sever
tions are welcome :) On Wed, Sep 16, 2009 at 7:22 PM, Gökhan Sever wrote: > Hello all, > > I want to be able to count predefined simple rectangle shapes on an image > as shown like in this one: > http://img7.imageshack.us/img7/2327/particles.png > > Which is in my case t

Re: [Numpy-discussion] [SciPy-User] Simple pattern recognition

2009-09-21 Thread Gökhan Sever
r a subset of them as specified). There are also > a ton of statistics you can calculate based on the labeled objects -- > look at the entire ndimage.measurements namespace. > > Zach > > On Sep 21, 2009, at 1:45 PM, Gökhan Sever wrote: > > > I asked this question at > http

Re: [Numpy-discussion] [SciPy-User] Simple pattern recognition

2009-09-21 Thread Gökhan Sever
n [60]: image[object_slices[0]] > Out[60]: > array([[1, 1, 0], >[1, 1, 1], >[1, 0, 0]]) > > In [61]: image[object_slices[1]] > Out[61]: > array([[1, 0], >[1, 1]]) > > In [62]: image[object_slices[2]] > Out[62]: > array([[1, 1, 0], >

Re: [Numpy-discussion] [IPython-dev] Testing matplotlib on IPython trunk

2009-09-21 Thread Gökhan Sever
menting oh that is possible in Python, oh this is too :) On Tue, Sep 22, 2009 at 12:18 AM, Fernando Perez wrote: > 2009/9/21 Gökhan Sever : > > > > It's a very late reply but I am wondering how to make these appear in the > Ipy dev loaded into the session but not visible t

Re: [Numpy-discussion] Create numpy array from a list error

2009-09-23 Thread Gökhan Sever
On Wed, Sep 23, 2009 at 9:06 AM, Dave Wood wrote: > Hi all, > > I've got a fairly large (but not huge, 58mb) tab seperated text file, with > approximately 200 columns and 56k rows of numbers and strings. > > Here's a snippet of my code to create a numpy matrix from the data file... > > > > d

Re: [Numpy-discussion] Create numpy array from a list error

2009-09-23 Thread Gökhan Sever
On Wed, Sep 23, 2009 at 9:06 AM, Dave Wood wrote: > Hi all, > > I've got a fairly large (but not huge, 58mb) tab seperated text file, with > approximately 200 columns and 56k rows of numbers and strings. > > Here's a snippet of my code to create a numpy matrix from the data file... > > > > d

Re: [Numpy-discussion] Numpy savetxt: change decimal separator

2009-09-24 Thread Gökhan Sever
On Thu, Sep 24, 2009 at 2:07 AM, wrote: > > Hello everyone, > > I save data to a file with the following statement: > > np.savetxt(fileName, transpose((average_dist, std_deviation, maximum_dist, > sum_of_dist)), delimiter = ';', fmt='%6.10f') > > is there a possibility to change the decimal seper

Re: [Numpy-discussion] Tuple outer product?

2009-09-25 Thread Gökhan Sever
On Fri, Sep 25, 2009 at 12:45 PM, Mads Ipsen wrote: > Is there a numpy operation on two arrays, say [1,2,3] and [4,5,6], that > will yield: > > [[(1,4),(1,5),(1,6)],[(2,4),(2,5),(2,6)],[(3,4),(3,5),(3,6)]] > > Any suggestions are most welcome. > > Mads > > I don't know if there is a function in

Re: [Numpy-discussion] Tuple outer product?

2009-09-25 Thread Gökhan Sever
On Fri, Sep 25, 2009 at 1:05 PM, Mads Ipsen wrote: > Gökhan Sever wrote: > > > > > > On Fri, Sep 25, 2009 at 12:45 PM, Mads Ipsen > <mailto:m...@comxnet.dk>> wrote: > > > > Is there a numpy operation on two arrays, say [1,2,3] and [4,5,6], > &

Re: [Numpy-discussion] Tuple outer product?

2009-09-25 Thread Gökhan Sever
On Fri, Sep 25, 2009 at 3:01 PM, Mads Ipsen wrote: > Robert Kern wrote: > > On Fri, Sep 25, 2009 at 14:19, Alan G Isaac wrote: > > > >> I do not see what is wrong with itertools.product, > >> but if you hate it, you can use numpy.meshgrid: > >> > >> > > np.array(np.meshgrid([1,2,3],[4,5,6]))

Re: [Numpy-discussion] glumpy: fast OpenGL numpy visualization + matplotlib integration

2009-09-28 Thread Gökhan Sever
On Mon, Sep 28, 2009 at 9:06 AM, Nicolas Rougier wrote: > > Hi all, > > glumpy is a fast OpenGL visualization tool for numpy arrays coded on > top of pyglet (http://www.pyglet.org/). The package contains many > demos showing basic usage as well as integration with matplotlib. As a > reference, the

Re: [Numpy-discussion] making the distinction between -0.0 and 0.0..

2009-09-29 Thread Gökhan Sever
On Tue, Sep 29, 2009 at 11:53 AM, Christopher Barker wrote: > Hi folks, > > This isn't really a numpy question, and I'm doing this with regular old > python, but I figure you are the folks that would know this: > > How do I get python to make a distinction between -0.0 and 0.0? IN this > case, I'm

[Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Gökhan Sever
Hello, How to conditionally index an array as shown below : a = arange(10) a[5___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Gökhan Sever
? On Wed, Sep 30, 2009 at 1:32 PM, Joe Kington wrote: > There may be a more elegant way, but: > > In [2]: a = np.arange(10) > > In [3]: a[(a>5) & (a<8)] > Out[3]: array([6, 7]) > > > On Wed, Sep 30, 2009 at 1:27 PM, Gökhan Sever wrote: > >> Hello, >

Re: [Numpy-discussion] Compound conditional indexing

2009-09-30 Thread Gökhan Sever
On Wed, Sep 30, 2009 at 2:45 PM, Robert Kern wrote: > On Wed, Sep 30, 2009 at 14:40, Gökhan Sever wrote: > > Thanks this works. > > > > My second question how to access a second array using this condition? > > > > I am trying slice another array using a comp

Re: [Numpy-discussion] difficulty with numpy.where

2009-10-01 Thread Gökhan Sever
On Thu, Oct 1, 2009 at 12:10 PM, Zachary Pincus wrote: > Hello, > > a < b < c (or any equivalent expression) is python syntactic sugar for > (a < b) and (b < c). > > Now, for numpy arrays, a < b gives an array with boolean True or False > where the elements of a are less than those of b. So this g

Re: [Numpy-discussion] A numpy accumulator...

2009-10-03 Thread Gökhan Sever
On Sat, Oct 3, 2009 at 2:26 AM, Christopher Barker wrote: > Hasi all, > > This idea was inspired by a discussion at SciPY, in which we spent a > LOT of time during the numpy tutorial talking about how to accumulate > values in an array when you don't know how big the array needs to be > when you

[Numpy-discussion] Questions about masked arrays

2009-10-06 Thread Gökhan Sever
Hello, I have a sample masked array data as shown below. 1-) When I list the whole array I see the fill value correctly. However below that line, when I do access the 5th element, fill_value flies upto 1e+20. What might be wrong here? I[5]: c.data['Air_Temp'] O[5]: masked_array(data = [13.1509 1

Re: [Numpy-discussion] Questions about masked arrays

2009-10-06 Thread Gökhan Sever
On Tue, Oct 6, 2009 at 4:28 PM, Pierre GM wrote: > > On Oct 6, 2009, at 4:42 PM, Gökhan Sever wrote: > > > Hello, > > > > I have a sample masked array data as shown below. > > > > 1-) When I list the whole array I see the fill value correctly. > >

Re: [Numpy-discussion] Questions about masked arrays

2009-10-06 Thread Gökhan Sever
On Tue, Oct 6, 2009 at 7:38 PM, Pierre GM wrote: > > On Oct 6, 2009, at 6:57 PM, Gökhan Sever wrote: > > Seeing a different filling value is causing confusion. Both for > > myself, and when I try to demonstrate the usage of masked array to > > other people. > >

Re: [Numpy-discussion] Questions about masked arrays

2009-10-06 Thread Gökhan Sever
On Tue, Oct 6, 2009 at 9:22 PM, Pierre GM wrote: > > On Oct 6, 2009, at 9:54 PM, Gökhan Sever wrote: > > > > > Also say, if I want to replace that one element back to its original > > > state will it use fill_value as 1e+20 or 99.? > > > >

Re: [Numpy-discussion] Questions about masked arrays

2009-10-06 Thread Gökhan Sever
On Tue, Oct 6, 2009 at 10:15 PM, Pierre GM wrote: > > On Oct 6, 2009, at 10:58 PM, Gökhan Sever wrote: > > > > I see your points. I don't want to give you extra work, don't > > worry :) It just seem a bit bizarre: > > > > I[27]: c.data['

Re: [Numpy-discussion] Questions about masked arrays

2009-10-06 Thread Gökhan Sever
Created the ticket http://projects.scipy.org/numpy/ticket/1253 Could you tell me briefly what was the source of leak in arccos case? And how do you write a test code for these cases? On Tue, Oct 6, 2009 at 10:15 PM, Pierre GM wrote: > > On Oct 6, 2009, at 10:58 PM, Gökhan Sever

Re: [Numpy-discussion] Questions about masked arrays

2009-10-06 Thread Gökhan Sever
On Tue, Oct 6, 2009 at 11:33 PM, Pierre GM wrote: > > On Oct 7, 2009, at 12:10 AM, Gökhan Sever wrote: > > > Created the ticket http://projects.scipy.org/numpy/ticket/1253 > > Want even more confusion ? > >>> x = ma.array([1,2,3],mask=[0,1,0], dtype=int)

Re: [Numpy-discussion] Questions about masked arrays

2009-10-06 Thread Gökhan Sever
On Wed, Oct 7, 2009 at 12:47 AM, Pierre GM wrote: > > On Oct 7, 2009, at 1:12 AM, Gökhan Sever wrote: > > One more from me: > > I[1]: a = np.arange(5) > > I[2]: mask = 999 > > I[6]: a[3] = 999 > > I[7]: am = ma.masked_equal(a, mask) > > > > I[8]:

[Numpy-discussion] Building a new copy of NumPy

2009-10-07 Thread Gökhan Sever
Hello, I checked-out the latest trunk and make a new installation of NumPy. My question: Is it a known behaviour that this action will result with re-building other packages that are dependent on NumPy. In my case, I had to re-built matplotlib, and now scipy. Here is the error message that I am g

Re: [Numpy-discussion] Questions about masked arrays

2009-10-07 Thread Gökhan Sever
Added as comment in the same entry: http://projects.scipy.org/numpy/ticket/1253#comment:1 Guessing that this one should be easy to fix :) On Wed, Oct 7, 2009 at 3:05 AM, Pierre GM wrote: > > On Oct 7, 2009, at 2:57 AM, Gökhan Sever wrote: > > One more example. (I still think the

Re: [Numpy-discussion] Questions about masked arrays

2009-10-07 Thread Gökhan Sever
On Wed, Oct 7, 2009 at 12:21 PM, Christopher Barker wrote: > Gökhan Sever wrote: > > > Sorry too much time spent in ipython -pylab :) > > > Good reflex. Saves you from making extra explanations. But it works with > > just typing array why should I type n

Re: [Numpy-discussion] Building a new copy of NumPy

2009-10-07 Thread Gökhan Sever
at 09:55, Gökhan Sever wrote: > > Hello, > > > > I checked-out the latest trunk and make a new installation of NumPy. My > > question: Is it a known behaviour that this action will result with > > re-building other packages that are dependent on NumPy. In my case, I had

Re: [Numpy-discussion] finding nonzero elements in list

2009-10-12 Thread Gökhan Sever
On Mon, Oct 12, 2009 at 9:18 AM, per freem wrote: > hi all, > > i'm trying to find nonzero elements in an array, as follows: > > a = array([[1, 0], > [1, 1], > [1, 1], > [0, 1]]) > > i want to find all elements that are [1,1]. i tried: nonzero(a == > [1,0]) but i cannot interpre

Re: [Numpy-discussion] finding nonzero elements in list

2009-10-12 Thread Gökhan Sever
On Mon, Oct 12, 2009 at 9:39 AM, Gökhan Sever wrote: > > > On Mon, Oct 12, 2009 at 9:18 AM, per freem wrote: > >> hi all, >> >> i'm trying to find nonzero elements in an array, as follows: >> >> a = array([[1, 0], >> [1, 1], >&g

[Numpy-discussion] Multiple string formatting while writing an array into a file

2009-10-18 Thread Gökhan Sever
Hello, I have a relatively simple question which I couldn't figure out myself yet. I have an array that I am writing into a file using the following savetxt method. np.savetxt(fid, output_array, fmt='%12.4f', delimiter='') However, I have made some changes on the code and I require to write aft

Re: [Numpy-discussion] Multiple string formatting while writing an array into a file

2009-10-19 Thread Gökhan Sever
On Sun, Oct 18, 2009 at 12:03 PM, Gökhan Sever wrote: > Hello, > > I have a relatively simple question which I couldn't figure out myself yet. > I have an array that I am writing into a file using the following savetxt > method. > > np.savetxt(fid, output_arra

[Numpy-discussion] Using matplotlib's prctile on masked arrays

2009-10-27 Thread Gökhan Sever
Hello, Consider this sample two columns of data: 99. 99. 99. 99. 99. 99. 99. 1693.9069 99. 1676.1059 99. 1621.5875 651.8040 1542.1373 691.0138 1650.4214 678.5558 1710.7311 621.577

Re: [Numpy-discussion] Using matplotlib's prctile on masked arrays

2009-10-28 Thread Gökhan Sever
On Tue, Oct 27, 2009 at 8:25 AM, wrote: > This should not be the correct results if you use > scipy.stats.scoreatpercentile, > it doesn't have correct missing value handling, it treats nans or > mask/fill values as regular numbers sorted to the end. > > stats.mstats.scoreatpercentile is the corr

Re: [Numpy-discussion] Using matplotlib's prctile on masked arrays

2009-10-28 Thread Gökhan Sever
On Tue, Oct 27, 2009 at 12:23 PM, Pierre GM wrote: > > On Oct 27, 2009, at 7:56 AM, Gökhan Sever wrote: > > > > > > Unfortunately, matplotlib.mlab's prctile cannot handle this division: > > Actually, the division's OK, it's mlab.prctile which is bo

[Numpy-discussion] Comparing variable time-shifted two measurements

2009-11-05 Thread Gökhan Sever
Hello, I have two aircraft based aerosol measurements. The first one is dccnConSTP (blue), and the latter is CPCConc (red) as shown in this screen capture. ( http://img513.imageshack.us/img513/7498/ccncpclag.png). My goal is to compare these two measurements. It is expected to see that they must h

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Gökhan Sever
On Tue, Nov 10, 2009 at 12:09 PM, Darryl Wallace wrote: > Hello again, > The best way so far that's come to my attention is to use: > numpy.ma.masked_object > The problem with this is that it's looking for a specific instance of an > object.  So if the user had some elements of their array that we

Re: [Numpy-discussion] parsing tab separated files into dictionaries - alternative to genfromtxt?

2009-11-11 Thread Gökhan Sever
On Wed, Nov 11, 2009 at 11:53 AM, per freem wrote: > hi all, > > i've been using genfromtxt to parse tab separated files for plotting > purposes in matplotlib. the problem is that genfromtxt seems to give > only two ways to access the contents of the file: one is by column, > where you can use: >

Re: [Numpy-discussion] Multiple Regression

2009-11-12 Thread Gökhan Sever
On Thu, Nov 12, 2009 at 9:14 PM, Sturla Molden wrote: > Alexey Tigarev skrev: >> I have implemented multiple regression in a following way: >> >> > You should be using QR or SVD for this. > > Sturla > Seeing this QR and SVD terms I recalled the answer to the "I am the very model for a student mat

Re: [Numpy-discussion] numpy distutils and distribute

2009-11-14 Thread Gökhan Sever
On Sat, Nov 14, 2009 at 9:29 AM, Darren Dale wrote: > Please excuse the cross-post. I have installed distribute-0.6.8 and > numpy-svn into my ~/.local/lib/python2.6/site-packages (using "python > setup.py install --user"). I am now trying to install Enthought's > Enable from a fresh svn checkout

[Numpy-discussion] Fitting a curve on a log-normal distributed data

2009-11-16 Thread Gökhan Sever
Hello, I have a data which represents aerosol size distribution in between 0.1 to 3.0 micrometer ranges. I would like extrapolate the lower size down to 10 nm. The data in this context is log-normally distributed. Therefore I am looking a way to fit a log-normal curve onto my data. Could you pleas

Re: [Numpy-discussion] Fitting a curve on a log-normal distributed data

2009-11-17 Thread Gökhan Sever
On Tue, Nov 17, 2009 at 12:13 AM, Ian Mallett wrote: > Theory wise: > -Do a linear regression on your data. > -Apply a logrithmic transform to your data's dependent variable, and do > another linear regression. > -Apply a logrithmic transform to your data's independent variable, and do > another

Re: [Numpy-discussion] Fitting a curve on a log-normal distributed data

2009-11-20 Thread Gökhan Sever
On Thu, Nov 19, 2009 at 9:12 PM, Ian Mallett wrote: > Hello, > > My analysis shows that the exponential regression gives the best result > (r^2=87%)--power regression gives worse results (r^2=77%). Untransformed > data gives r^2=76%. > > I don't think you want lognorm. If I'm not mistaken, that

Re: [Numpy-discussion] Fitting a curve on a log-normal distributed data

2009-11-21 Thread Gökhan Sever
when long-term data sets are analyzed, and (4) it is a useful tool in the studies of atmospheric aerosol particle formation and transformation." The full-text is freely available at: http://www.borenv.net/BER/pdfs/ber10/ber10-337.pdf On Mon, Nov 16, 2009 at 11:44 PM, Gökhan Sever wrote: >

  1   2   >