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(x1, 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

[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,

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 gokhanse...@gmail.comwrote: 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

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 pgmdevl...@gmail.com 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

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 gokhanse...@gmail.com wrote: On Thu, Mar 15, 2012 at 1:12 PM, Pierre GM pgmdevl...@gmail.com wrote: Ciao Gökhan, AFAIR, shrink is used only to force a collapse of a mask full

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

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() ExpressionFLOAT = 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ökhan

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 n...@pobox.com wrote: On Fri, Nov 16, 2012 at 9:53 PM, Gökhan Sever gokhanse...@gmail.com wrote: Thanks for the explanations. For either case, I was expecting to get float32 as a resulting data type. Since, float32 is large enough

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 ondrej.cer...@gmail.comwrote: Hi, I have recently setup a page about modern Fortran:

[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

Re: [Numpy-discussion] 2D array indexing

2014-02-28 Thread Gökhan Sever
...@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, 7, 8]]) In [2]: a = np.arange(9).reshape((3,3)) In [3]: a[:1:] Out[3]: array([[0, 1, 2

[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,

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/1623

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 pgmdevl...@gmail.com 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)

[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,

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 alan.is...@gmail.com 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

[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

[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 ralf.gomm...@googlemail.comwrote: On Thu, Apr 21, 2011 at 10:06 PM, Gökhan Sever gokhanse...@gmail.com 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

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 mwwi...@gmail.com 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

[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öööğğğ mystr

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 charlesr.har...@gmail.com wrote: On Wed, Jun 15, 2011 at 1:30 PM, Gökhan Sever gokhanse...@gmail.com wrote: Hello, The following snippet works fine for a regular string and prints out the string without a problem. python Python 2.7 (r27

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]:

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

2011-08-03 Thread Gökhan Sever
@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 at 10:46 AM, Gökhan Sever

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

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

2011-08-03 Thread Gökhan Sever
...@noaa.govwrote: On 8/3/11 9:46 AM, Gökhan Sever wrote: In [23]: from netCDF4 import Dataset In [24]: f = Dataset(test.nc http://test.nc) In [25]: f.variables['reflectivity'].shape Out[25]: (6, 18909, 506) In [26]: f.variables['reflectivity'].size Out[26]: 57407724 In [27

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 chaoyue...@gmail.com 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,

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 gokhanse...@gmail.com 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.tab, fig.tab or any object you create on the canvas .tab

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 ben.r...@ou.edu 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

[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

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 darryl.wall...@prosensus.ca 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

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 perfr...@gmail.com 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

Re: [Numpy-discussion] Multiple Regression

2009-11-12 Thread Gökhan Sever
On Thu, Nov 12, 2009 at 9:14 PM, Sturla Molden stu...@molden.no 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

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 dsdal...@gmail.com 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

[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

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 geometr...@gmail.com 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,

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 geometr...@gmail.com 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

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

2009-11-21 Thread Gökhan Sever
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 gokhanse

Re: [Numpy-discussion] Python 2.6, NumPy on CentOS 5.3

2009-11-24 Thread Gökhan Sever
On Mon, Nov 23, 2009 at 7:07 PM, rkdeli...@gmail.com wrote: An application package that I have requires Python 2.6 and NumPy. I've installed Python 2.6 in a parallel manner as follows: NO modification of the core Python2.4 in /usr/bin has been done. Rather, I installed Python 2.6 under

Re: [Numpy-discussion] using numpy.savetxt to save columns of numerical values and columns of text values

2009-11-26 Thread Gökhan Sever
On Thu, Nov 26, 2009 at 11:30 PM, Richared Beare richard.be...@sci.monash.edu.au wrote: I have been unable to find a way of doing a very simple thing: saving data that contains both arrays of numerical values and arrays of string values, using savetxt in numpy. As a very simple example,

[Numpy-discussion] Another numpy svn installation error

2009-12-21 Thread Gökhan Sever
Hello, Here are the steps that I went through to install the numpy from the svn-repo: svn co http://svn.scipy.org/svn/numpy/trunk numpy Be su and type: python setupegg.py develop Successful installation so far, but import fails with the given error: [gse...@ccn Desktop]$ python Python 2.6

Re: [Numpy-discussion] [ANN] numpy 1.4.0 rc2

2009-12-22 Thread Gökhan Sever
On Tue, Dec 22, 2009 at 9:05 AM, David Cournapeau courn...@gmail.comwrote: Hi, I have just released the 2nd release candidate for numpy 1.4.0, which fixes a few critical bugs founds since the RC1. Tarballs and binary installers for numpy/scipy may be found on

Re: [Numpy-discussion] [ANN] numpy 1.4.0 rc2

2009-12-26 Thread Gökhan Sever
On Thu, Dec 24, 2009 at 4:57 PM, David Cournapeau courn...@gmail.comwrote: On Wed, Dec 23, 2009 at 1:41 AM, Gökhan Sever gokhanse...@gmail.com wrote: On Tue, Dec 22, 2009 at 9:05 AM, David Cournapeau courn...@gmail.com wrote: Hi, I have just released the 2nd release candidate

Re: [Numpy-discussion] [ANN] numpy 1.4.0 rc2

2009-12-26 Thread Gökhan Sever
On Sat, Dec 26, 2009 at 4:15 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Dec 26, 2009 at 2:19 PM, Gökhan Sever gokhanse...@gmail.comwrote: On Thu, Dec 24, 2009 at 4:57 PM, David Cournapeau courn...@gmail.comwrote: On Wed, Dec 23, 2009 at 1:41 AM, Gökhan Sever gokhanse

Re: [Numpy-discussion] [ANN] numpy 1.4.0 rc2

2009-12-28 Thread Gökhan Sever
On Sat, Dec 26, 2009 at 6:09 PM, David Cournapeau courn...@gmail.comwrote: On Sun, Dec 27, 2009 at 6:19 AM, Gökhan Sever gokhanse...@gmail.com wrote: For the develop, it is one of easiest ways to catch up the bug-fixes even though I don't work on the source directly. So far besides a few

Re: [Numpy-discussion] [ANN] numpy 1.4.0 rc2

2009-12-28 Thread Gökhan Sever
On Mon, Dec 28, 2009 at 10:31 AM, Gökhan Sever gokhanse...@gmail.comwrote: On Sat, Dec 26, 2009 at 6:09 PM, David Cournapeau courn...@gmail.comwrote: On Sun, Dec 27, 2009 at 6:19 AM, Gökhan Sever gokhanse...@gmail.com wrote: For the develop, it is one of easiest ways to catch up

Re: [Numpy-discussion] [ANN] numpy 1.4.0 rc2

2009-12-28 Thread Gökhan Sever
On Mon, Dec 28, 2009 at 11:07 AM, Robert Kern robert.k...@gmail.com wrote: On Mon, Dec 28, 2009 at 11:00, Gökhan Sever gokhanse...@gmail.com wrote: One interesting thing I have noticed while installing the numpy from the source is that numpy dependent libraries must be re-installed

Re: [Numpy-discussion] [ANN] numpy 1.4.0 rc2

2009-12-28 Thread Gökhan Sever
On Mon, Dec 28, 2009 at 11:16 AM, Gökhan Sever gokhanse...@gmail.comwrote: On Mon, Dec 28, 2009 at 11:07 AM, Robert Kern robert.k...@gmail.comwrote: On Mon, Dec 28, 2009 at 11:00, Gökhan Sever gokhanse...@gmail.com wrote: One interesting thing I have noticed while installing the numpy

Re: [Numpy-discussion] [ANN] numpy 1.4.0 rc2

2009-12-28 Thread Gökhan Sever
On Mon, Dec 28, 2009 at 12:15 PM, Gökhan Sever gokhanse...@gmail.comwrote: On Mon, Dec 28, 2009 at 11:16 AM, Gökhan Sever gokhanse...@gmail.comwrote: On Mon, Dec 28, 2009 at 11:07 AM, Robert Kern robert.k...@gmail.comwrote: On Mon, Dec 28, 2009 at 11:00, Gökhan Sever gokhanse

[Numpy-discussion] Interact with matplotlib in Sage

2010-01-24 Thread Gökhan Sever
Hello, I have thought of this might interesting to share. Register at www.sagenb.org or try on your local Sage-notebook and using the following code: # Simple example demonstrating how to interact with matplotlib directly. # Comment plt.clf() to get the plots overlay in each update. # Gokhan

[Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Gökhan Sever
Hi, Simple question: I[4]: a = np.arange(10) I[5]: b = np.array(5) I[8]: a*b.cumsum() O[8]: array([ 0, 5, 10, 15, 20, 25, 30, 35, 40, 45]) I[9]: np.array(a*b).cumsum() O[9]: array([ 0, 5, 15, 30, 50, 75, 105, 140, 180, 225]) Is there a syntactic equivalent for the I[9] --for instance

Re: [Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Gökhan Sever
On Wed, Feb 10, 2010 at 10:06 AM, Angus McMorland amcm...@gmail.com wrote: On 10 February 2010 11:02, Gökhan Sever gokhanse...@gmail.com wrote: Hi, Simple question: I[4]: a = np.arange(10) I[5]: b = np.array(5) I[8]: a*b.cumsum() O[8]: array([ 0, 5, 10, 15, 20, 25, 30, 35

Re: [Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Gökhan Sever
On Wed, Feb 10, 2010 at 10:12 AM, Gökhan Sever gokhanse...@gmail.comwrote: On Wed, Feb 10, 2010 at 10:06 AM, Angus McMorland amcm...@gmail.comwrote: On 10 February 2010 11:02, Gökhan Sever gokhanse...@gmail.com wrote: Hi, Simple question: I[4]: a = np.arange(10) I[5]: b

Re: [Numpy-discussion] Request for testing

2010-02-21 Thread Gökhan Sever
On Sun, Feb 21, 2010 at 4:30 AM, Charles R Harris charlesr.har...@gmail.com wrote: Hi All, I would be much obliged if some folks would run the attached script and report the output, numpy version, and python version. It just runs np.isinf(np.inf), which raises an invalid value warning with

[Numpy-discussion] ask.scipy.org

2010-02-21 Thread Gökhan Sever
Hello, Since after Robert Kern showed http://advice.mechanicalkern.com/ on SciPy09 there are many similar initiatives that uses stackoverflow.com (SO) layout. Some smart guys come up with this site http://stackexchange.com/ to those who want to have a simple but a paid solution. I don't have an

Re: [Numpy-discussion] ask.scipy.org

2010-02-21 Thread Gökhan Sever
On Sun, Feb 21, 2010 at 4:06 PM, Robert Kern robert.k...@gmail.com wrote: On Sun, Feb 21, 2010 at 16:00, Gökhan Sever gokhanse...@gmail.com wrote: Hello, Since after Robert Kern showed http://advice.mechanicalkern.com/ on SciPy09 there are many similar initiatives that uses

[Numpy-discussion] For-less code

2010-02-24 Thread Gökhan Sever
Hello, I am working on a code shown at http://code.google.com/p/ccnworks/source/browse/trunk/thesis/part1/logn-fit.py I use the code to analyse a couple dataset also placed in the same directory. In the first part I use for-loops all over, but later decided to write them without using for loops.

Re: [Numpy-discussion] printing structured arrays

2010-03-05 Thread Gökhan Sever
On Fri, Mar 5, 2010 at 8:00 AM, Bruce Schultz bruce.schu...@gmail.comwrote: Hi, I've just started playing with numpy and have noticed that when printing a structured array that the output is not nicely formatted. Is there a way to make the formatting look the same as it does for an

[Numpy-discussion] ask.scipy.org is online

2010-03-18 Thread Gökhan Sever
Hello, Please tolerate my impatience for being the first announcing the new discussion platform :) and my cross-posting over the lists. The new site is beating at ask.scipy.org . David Warde-Farley is moving the questions from the old-site at advice.mechanicalkern.com (announced at SciPy09 by

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread Gökhan Sever
On Fri, Mar 19, 2010 at 10:17 AM, Joe Kington jking...@wisc.edu wrote: See itertools.permutations (python standard library) e.g. In [3]: list(itertools.permutations([1,1,0,0])) Out[3]: [(1, 1, 0, 0), (1, 1, 0, 0), (1, 0, 1, 0), (1, 0, 0, 1), (1, 0, 1, 0), (1, 0, 0, 1), (1, 1, 0,

[Numpy-discussion] Simple way to shift array elements

2010-04-10 Thread Gökhan Sever
Hello, Is there a simpler way to get c from a I[1]: a = np.arange(10) I[2]: b = a[3:] I[3]: b O[3]: array([3, 4, 5, 6, 7, 8, 9]) I[4]: c = np.insert(b, [7]*3, 0) O[5]: array([3, 4, 5, 6, 7, 8, 9, 0, 0, 0]) a and c have to be same in length and the left shift must be balanced with equal

Re: [Numpy-discussion] Simple way to shift array elements

2010-04-10 Thread Gökhan Sever
On Sat, Apr 10, 2010 at 7:31 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Apr 10, 2010 at 6:17 PM, Gökhan Sever gokhanse...@gmail.comwrote: Hello, Is there a simpler way to get c from a I[1]: a = np.arange(10) I[2]: b = a[3:] I[3]: b O[3]: array([3, 4, 5, 6, 7, 8

Re: [Numpy-discussion] Sum over array elements

2010-04-12 Thread Gökhan Sever
On Mon, Apr 12, 2010 at 9:21 AM, Nicola Creati ncre...@inogs.it wrote: Hello, I want to calculate, given a one dimension array, the sum over every two elements of the array. I found this working solution: a = N.arange(10) b = a.reshape(a, (5, 2)) c = b.sum(axis=1) Is there any better

Re: [Numpy-discussion] indexing to sort with argsort(..., axis=1)

2010-04-12 Thread Gökhan Sever
On Mon, Apr 12, 2010 at 9:41 PM, Angus McMorland amcm...@gmail.com wrote: Hi all, I want to sort a 2d array along one dimension, with the indices returned by argsort, but the subsequent indexing syntax to get the sorted array is not obvious. The following works, but I wonder if there is a

Re: [Numpy-discussion] how to tally the values seen

2010-04-14 Thread Gökhan Sever
On Wed, Apr 14, 2010 at 1:10 AM, Peter Shinners p...@shinners.org wrote: I have an array that represents the number of times a value has been given. I'm trying to find a direct numpy way to add into these sums without requiring a Python loop. For example, say there are 10 possible values. I

Re: [Numpy-discussion] how to tally the values seen

2010-04-14 Thread Gökhan Sever
On Wed, Apr 14, 2010 at 1:34 AM, Warren Weckesser warren.weckes...@enthought.com wrote: Gökhan Sever wrote: On Wed, Apr 14, 2010 at 1:10 AM, Peter Shinners p...@shinners.org mailto:p...@shinners.org wrote: I have an array that represents the number of times a value has been

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread Gökhan Sever
On Wed, Apr 14, 2010 at 10:16 AM, Nikolaus Rath nikol...@rath.org wrote: Hello, How do I best find out the indices of the largest x elements in an array? Example: a = [ [1,8,2], [2,1,3] ] magic_function(a, 2) == [ (0,1), (1,2) ] Since the largest 2 elements are at positions (0,1) and

[Numpy-discussion] Question about numpy.arange()

2010-05-01 Thread Gökhan Sever
Hello, Is b an expected value? I am suspecting another floating point arithmetic issue. I[1]: a = np.arange(1.6, 1.8, 0.1, dtype='float32') I[2]: a O[2]: array([ 1.6002, 1.7005], dtype=float32) I[3]: b = np.arange(1.7, 1.8, 0.1, dtype='float32') I[4]: b O[4]: array([ 1.7005,

Re: [Numpy-discussion] Question about numpy.arange()

2010-05-03 Thread Gökhan Sever
On Sat, May 1, 2010 at 3:36 PM, Gökhan Sever gokhanse...@gmail.com wrote: Hello, Is b an expected value? I am suspecting another floating point arithmetic issue. I[1]: a = np.arange(1.6, 1.8, 0.1, dtype='float32') I[2]: a O[2]: array([ 1.6002, 1.7005], dtype=float32) I[3]: b

[Numpy-discussion] Question about numpy.ma masking

2010-05-04 Thread Gökhan Sever
Hello, I have the following arrays read as masked array. I[10]: basic.data['Air_Temp'].mask O[10]: array([ True, False, False, ..., False, False, False], dtype=bool) [12]: basic.data['Press_Alt'].mask O[12]: False I[13]: len basic.data['Air_Temp'] - len(basic.data['Air_Temp']) O[13]: 1758

[Numpy-discussion] Another masked array question

2010-05-08 Thread Gökhan Sever
Hello, Consider my masked arrays: I[28]: type basic.data['Air_Temp'] - type(basic.data['Air_Temp']) O[28]: numpy.ma.core.MaskedArray I[29]: basic.data['Air_Temp'] O[29]: masked_array(data = [-- -- -- ..., -- -- --], mask = [ True True True ..., True True True],

Re: [Numpy-discussion] Another masked array question

2010-05-08 Thread Gökhan Sever
On Sat, May 8, 2010 at 9:16 PM, Ryan May rma...@gmail.com wrote: On Sat, May 8, 2010 at 7:52 PM, Gökhan Sever gokhanse...@gmail.com wrote: Hello, Consider my masked arrays: I[28]: type basic.data['Air_Temp'] - type(basic.data['Air_Temp']) O[28]: numpy.ma.core.MaskedArray I

Re: [Numpy-discussion] Another masked array question

2010-05-08 Thread Gökhan Sever
On Sat, May 8, 2010 at 9:29 PM, Eric Firing efir...@hawaii.edu wrote: On 05/08/2010 04:16 PM, Ryan May wrote: On Sat, May 8, 2010 at 7:52 PM, Gökhan Severgokhanse...@gmail.com wrote: Hello, Consider my masked arrays: I[28]: type basic.data['Air_Temp'] -

Re: [Numpy-discussion] Question about numpy.ma masking

2010-05-09 Thread Gökhan Sever
On Fri, May 7, 2010 at 3:28 PM, Pierre GM pgmdevl...@gmail.com wrote: On May 4, 2010, at 8:38 PM, Gökhan Sever wrote: Hello, I have the following arrays read as masked array. I[10]: basic.data['Air_Temp'].mask O[10]: array([ True, False, False, ..., False, False, False], dtype=bool

Re: [Numpy-discussion] Question about numpy.ma masking

2010-05-10 Thread Gökhan Sever
On Sun, May 9, 2010 at 2:42 PM, Eric Firing efir...@hawaii.edu wrote: The mask attribute can be a full array, or it can be a scalar to indicate that nothing is masked. This is an optimization in masked arrays; it adds complexity, but it can save space and/or processing time. You can always

Re: [Numpy-discussion] Wrong Eigenvalue (Approximation?)

2010-05-16 Thread Gökhan Sever
Floating point numbers; one of my recent favorite subjects... See this hot Slashdot discussion subject: what every programmer should know about floating-point arithmetic On 5/16/10, Alan G Isaac ais...@american.edu wrote: On 5/16/2010 12:03 AM, Gabriel Mihalache wrote: The eigenvalue should be

Re: [Numpy-discussion] np.choose() question

2010-06-08 Thread Gökhan Sever
On Tue, Jun 8, 2010 at 11:24 AM, Andreas Hilboll li...@hilboll.de wrote: Hi there, I have a problem, which I'm sure can somehow be solved using np.choose() - but I cannot figure out how :( I have an array idx, which holds int values and has a 2d shape. All values inside idx are 0 = idx n.

Re: [Numpy-discussion] np.choose() question

2010-06-08 Thread Gökhan Sever
If we were at so or ask.scipy I would vote for Mark's solution :) Usually in cases like yours, I tend to use the shortest version of the solutions. On Tue, Jun 8, 2010 at 2:08 PM, Andreas Hilboll li...@hilboll.de wrote: Hi, newtimes = [times[idx[x][y]] for x in range(2) for y in range(2)]

Re: [Numpy-discussion] np.choose() question

2010-06-08 Thread Gökhan Sever
On Tue, Jun 8, 2010 at 2:32 PM, Hans Meine me...@informatik.uni-hamburg.dewrote: Funny, that's exactly what I wanted to do (idx being a label/region image here), and what I tried today. You will be happy to hear that the even simpler solution is to just use fancy indexing (the name is

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, phob...@geosyntec.com 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,

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 gokhanse...@gmail.com wrote: On Wed, Aug 4, 2010 at 6:59 PM, phob...@geosyntec.com 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

[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]

[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/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 gre...@gmail.com 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

Re: [Numpy-discussion] common significant diigits

2010-09-15 Thread Gökhan Sever
On Wed, Sep 15, 2010 at 2:34 PM, Benjamin Root ben.r...@ou.edu 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:

[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 robert.k...@gmail.com 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

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 ben.r...@ou.edu 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

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread Gökhan Sever
On Tue, Sep 21, 2010 at 1:55 AM, Peter Schmidtke pschmid...@mmb.pcb.ub.eswrote: 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]

[Numpy-discussion] Masking an array with another array

2009-04-22 Thread Gökhan SEVER
Hello, Could you please give me some hints about how to mask an array using another arrays like in the following example. In [14]: a = arange(5) In [15]: a Out[15]: array([0, 1, 2, 3, 4]) and my secondary array is b In [16]: b = array([2,3]) What I want to do is to mask a with b values and

Re: [Numpy-discussion] Masking an array with another array

2009-04-22 Thread Gökhan SEVER
, simplicity, clarity and elegance about it. Gökhan On Wed, Apr 22, 2009 at 4:49 PM, Pierre GM pgmdevl...@gmail.com wrote: On Apr 22, 2009, at 5:21 PM, Gökhan SEVER wrote: Hello, Could you please give me some hints about how to mask an array using another arrays like in the following example

Re: [Numpy-discussion] Masking an array with another array

2009-04-22 Thread Gökhan SEVER
On Thu, Apr 23, 2009 at 12:16 AM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Wed, Apr 22, 2009 at 04:21:05PM -0500, Gökhan SEVER wrote: Could you please give me some hints about how to mask an array using another arrays like in the following example. In [14]: a = arange

[Numpy-discussion] Savetxt usage question

2009-05-17 Thread Gökhan SEVER
Hello, Is there a way to write a header information to a text file using savetxt command besides dumping arrays in the same file? In little detailed fashion: I have to write a few long column of arrays into a text file. While doing that I need to put some information regarding to the context of

Re: [Numpy-discussion] Savetxt usage question

2009-05-17 Thread Gökhan SEVER
Thanks for the quick reply. Exact solution ! Gökhan On Sun, May 17, 2009 at 6:57 PM, Michael S. Gilbert michael.s.gilb...@gmail.com wrote: fid = open( 'file' , 'w' ) fid.write( 'header\n' ) savetxt( fid , data ) fid.close() On Sun, 17 May 2009 18:54:33 -0500 Gökhan SEVER wrote

Re: [Numpy-discussion] Interactive Shell/Editor/Workspace(variables)View/Plots

2009-06-08 Thread Gökhan SEVER
On Mon, Jun 8, 2009 at 12:11 PM, Jonno jonnojohn...@gmail.com wrote: On Mon, Jun 8, 2009 at 11:35 AM, Gökhan SEVERgokhanse...@gmail.com wrote: Hello, To me, IPython is the right way to follow. Try whos to see what's in your namespace. You may want see this instructional video (A

Re: [Numpy-discussion] Interactive Shell/Editor/Workspace(variables)View/Plots

2009-06-08 Thread Gökhan SEVER
On Mon, Jun 8, 2009 at 4:47 PM, Christopher Barker chris.bar...@noaa.govwrote: Gael Varoquaux wrote: Click in the menu: 'new file in remote browser', or something like this. If you have editra installed, it will launch it, with a special plugin allowing you to execute selected code in

[Numpy-discussion] Question about memmap

2009-06-09 Thread Gökhan SEVER
Hello, I am having problem while trying to memory map a simple file (attached as test.txt) In IPython data = memmap('test.txt', mode='r', dtype=double, shape=(3,5)) data memmap([[ 3.45616501e-86, 4.85780149e-33, 4.85787493e-33, 5.07185821e-86, 4.85780159e-33], [

Re: [Numpy-discussion] Question about memmap

2009-06-09 Thread Gökhan SEVER
On Wed, Jun 10, 2009 at 12:34 AM, Matthew Brett matthew.br...@gmail.comwrote: Hi, I am having problem while trying to memory map a simple file (attached as test.txt) The file looks like a text file, but memmap is for binary files. Could that be the problem? Best, Matthew I don't

  1   2   >