Re: [Numpy-discussion] boolean arrays

2009-11-26 Thread René Dudfield
On Thu, Nov 26, 2009 at 7:35 PM, Nils Wagner wrote: > > > Sorry, I mixed up '+' and '&' > a = array(([True,True],[True,True])) b = array(([False,False],[False,False])) a & b > array([[False, False], >        [False, False]], dtype=bool) > > Cheers, > >              Nils hey, this

Re: [Numpy-discussion] Bytes vs. Unicode in Python3

2009-11-26 Thread René Dudfield
On Fri, Nov 27, 2009 at 1:37 AM, Charles R Harris wrote: > Hi Pauli, > > On Thu, Nov 26, 2009 at 4:08 PM, Pauli Virtanen wrote: >> >> Hi, >> >> The Python 3 porting needs some decisions on what is Bytes and >> what is Unicode. >> >> I'm currently taking the following approach. Comments? >> >>    

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

2009-11-26 Thread Skipper Seabold
On Fri, Nov 27, 2009 at 12:55 AM, Gökhan Sever wrote: > > > On Thu, Nov 26, 2009 at 11:30 PM, Richared Beare > 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

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 exampl

Re: [Numpy-discussion] Producing a Histogram When Bins Are Known

2009-11-26 Thread josef . pktd
On Fri, Nov 27, 2009 at 12:16 AM, Wayne Watson wrote: > I have a list that already has the frequencies from 0 to 255. However, > I'd like to make a histogram  that has say 32 bins whose ranges are 0-7, > 8-15, ... 248-255. Is it possible? If they have equal sized (width) bins, then you should be

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

2009-11-26 Thread Richared Beare
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, suppose a is a numpy array of integers and b is one containing strings, e.g.: a = np.array

Re: [Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread Wayne Watson
josef.p...@gmail.com wrote: > On Thu, Nov 26, 2009 at 9:48 PM, wrote: > >> On Thu, Nov 26, 2009 at 8:18 PM, Wayne Watson >> wrote: >> >>> Yes, I'm just beginning to deal with the contents of NumPy, SciLab, and >>> SciPy. They all have seemed part of one another, but I think I see how >

[Numpy-discussion] Producing a Histogram When Bins Are Known

2009-11-26 Thread Wayne Watson
I have a list that already has the frequencies from 0 to 255. However, I'd like to make a histogram that has say 32 bins whose ranges are 0-7, 8-15, ... 248-255. Is it possible? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N)

Re: [Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread josef . pktd
On Thu, Nov 26, 2009 at 9:48 PM, wrote: > On Thu, Nov 26, 2009 at 8:18 PM, Wayne Watson > wrote: >> Yes, I'm just beginning to deal with the contents of NumPy, SciLab, and >> SciPy. They all have seemed part of one another, but I think I see how >> they've divided up the game. NumPy has no graph

Re: [Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread josef . pktd
On Thu, Nov 26, 2009 at 8:18 PM, Wayne Watson wrote: > Yes, I'm just beginning to deal with the contents of NumPy, SciLab, and > SciPy. They all have seemed part of one another, but I think I see how > they've divided up the game. NumPy has no graphics. PyLab has them, > basically under matplotlib

Re: [Numpy-discussion] another numpy/ATLAS problem

2009-11-26 Thread Charles R Harris
On Thu, Nov 26, 2009 at 6:53 PM, David Warde-Farley wrote: > It seems like I've done this enough times on enough machines but I'm > still running into problems... > > After installing what I'm pretty sure is a complete ATLAS+LAPACK and > building numpy against it (appropriately editing site.cfg, e

[Numpy-discussion] another numpy/ATLAS problem

2009-11-26 Thread David Warde-Farley
It seems like I've done this enough times on enough machines but I'm still running into problems... After installing what I'm pretty sure is a complete ATLAS+LAPACK and building numpy against it (appropriately editing site.cfg, etc.) I'm faced with this when building numpy-1.3.0: d...@mirag

Re: [Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread Wayne Watson
Yes, I'm just beginning to deal with the contents of NumPy, SciLab, and SciPy. They all have seemed part of one another, but I think I see how they've divided up the game. NumPy has no graphics. PyLab has them, basically under matplotlib. histogram seems a bit odd to me. Here's what I mean. I

Re: [Numpy-discussion] Bytes vs. Unicode in Python3

2009-11-26 Thread Charles R Harris
Hi Pauli, On Thu, Nov 26, 2009 at 4:08 PM, Pauli Virtanen wrote: > Hi, > > The Python 3 porting needs some decisions on what is Bytes and > what is Unicode. > > I'm currently taking the following approach. Comments? > >*** > > dtype field names > >Either Bytes or Unicode. >

Re: [Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread Pauli Virtanen
to, 2009-11-26 kello 15:08 -0800, Wayne Watson kirjoitti: > I guess the answer is easy about why a plot is not produced. The remark > in the histogram line says this will not work in numpy. Oh, well. It works as it is intended to work. Numpy's histogram function just computes the histogram -- you

[Numpy-discussion] Bytes vs. Unicode in Python3

2009-11-26 Thread Pauli Virtanen
Hi, The Python 3 porting needs some decisions on what is Bytes and what is Unicode. I'm currently taking the following approach. Comments? *** dtype field names Either Bytes or Unicode. But 'a' and b'a' are *different* fields. The issue is that: Pyt

Re: [Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread Wayne Watson
I guess the answer is easy about why a plot is not produced. The remark in the histogram line says this will not work in numpy. Oh, well. Wayne Watson wrote: > josef.p...@gmail.com wrote: > >> On Thu, Nov 26, 2009 at 2:44 PM, Wayne Watson >> wrote: >> >> >>> I decided to try some exam

Re: [Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread Wayne Watson
josef.p...@gmail.com wrote: > On Thu, Nov 26, 2009 at 2:44 PM, Wayne Watson > wrote: > >> I decided to try some example code from Subject. >> >> import numpy >> import pylab >> # Build a vector of 1 normal deviates with variance 0.5^2 and mean 2 >> mu, sigma = 2, 0.5 >> v = numpy.random.nor

Re: [Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread josef . pktd
On Thu, Nov 26, 2009 at 2:44 PM, Wayne Watson wrote: > I decided to try some example code from Subject. > > import numpy > import pylab > # Build a vector of 1 normal deviates with variance 0.5^2 and mean 2 > mu, sigma = 2, 0.5 > v = numpy.random.normal(mu,sigma,1) > # Plot a normalized hi

[Numpy-discussion] NumPy Histogram for Tentative NumPy Tutorial Questions

2009-11-26 Thread Wayne Watson
I decided to try some example code from Subject. import numpy import pylab # Build a vector of 1 normal deviates with variance 0.5^2 and mean 2 mu, sigma = 2, 0.5 v = numpy.random.normal(mu,sigma,1) # Plot a normalized histogram with 50 bins pylab.hist(v, bins=50, normed=1) # matplot

Re: [Numpy-discussion] boolean arrays

2009-11-26 Thread Nils Wagner
On Thu, 26 Nov 2009 15:14:04 +0100 Fabrice Silva wrote: > Le jeudi 26 novembre 2009 à 14:44 +0100, Gael Varoquaux >a écrit : >> On Thu, Nov 26, 2009 at 02:43:14PM +0100, Fabrice Silva >>wrote: >> > Le jeudi 26 novembre 2009 à 18:26 +0200, Nadav Horesh >>a écrit : >> > > It is obvious to me th

Re: [Numpy-discussion] matrix inverse

2009-11-26 Thread josef . pktd
On Thu, Nov 26, 2009 at 11:49 AM, wrote: > On Thu, Nov 26, 2009 at 11:34 AM,   wrote: >> why is http://docs.scipy.org/numpy/docs/numpy.matrixlib.defmatrix.matrix.I/ >> classified as unimportant?   .T ? >> >> I was looking at http://projects.scipy.org/numpy/ticket/1093 and >> didn't find any docs

Re: [Numpy-discussion] matrix inverse

2009-11-26 Thread josef . pktd
On Thu, Nov 26, 2009 at 11:34 AM, wrote: > why is http://docs.scipy.org/numpy/docs/numpy.matrixlib.defmatrix.matrix.I/ > classified as unimportant?   .T ? > > I was looking at http://projects.scipy.org/numpy/ticket/1093 and > didn't find any docs for the matrix inverse. Ok looking some more, I f

[Numpy-discussion] matrix inverse

2009-11-26 Thread josef . pktd
why is http://docs.scipy.org/numpy/docs/numpy.matrixlib.defmatrix.matrix.I/ classified as unimportant? .T ? I was looking at http://projects.scipy.org/numpy/ticket/1093 and didn't find any docs for the matrix inverse. Josef ___ NumPy-Discussion mailin

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread mdekauwe
Yep that will do nicely, code becomes import sys, os, glob import numpy as np def averageEightDays(files, numrows, numcols, year, doy): """ Read in 8 files at a time, sum the valid LST, keep a count of the valid pixels and average the result every 8days. """

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread Vincent Schut
mdekauwe wrote: > > Vincent Schut-2 wrote: >> Oh, and minor issue: creating a array of zeros and then multiplying with >> -999 still makes an array of zeros... I'd incorporated an array of >> *ones* multiplied with -999, because for the last chunk of days you >> could end up with a 8day array o

Re: [Numpy-discussion] boolean arrays

2009-11-26 Thread Fabrice Silva
Le jeudi 26 novembre 2009 à 14:44 +0100, Gael Varoquaux a écrit : > On Thu, Nov 26, 2009 at 02:43:14PM +0100, Fabrice Silva wrote: > > Le jeudi 26 novembre 2009 à 18:26 +0200, Nadav Horesh a écrit : > > > It is obvious to me that True+False == True,. Why do you think it should > > > be False? > >

Re: [Numpy-discussion] boolean arrays

2009-11-26 Thread Alan G Isaac
On 11/26/2009 8:20 AM, Nils Wagner wrote: > a = array(([True,True],[True,True])) > b = array(([False,False],[False,False])) > a+b NumPy's boolean operations are very well behaved. >>> a = np.array(([True,True],[True,True])) >>> a+a array([[ True, True], [ True, True]], dtype=bool) Comp

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread mdekauwe
Vincent Schut-2 wrote: > > Oh, and minor issue: creating a array of zeros and then multiplying with > -999 still makes an array of zeros... I'd incorporated an array of > *ones* multiplied with -999, because for the last chunk of days you > could end up with a 8day array only partly filled wi

Re: [Numpy-discussion] boolean arrays

2009-11-26 Thread Gael Varoquaux
On Thu, Nov 26, 2009 at 02:43:14PM +0100, Fabrice Silva wrote: > Le jeudi 26 novembre 2009 à 18:26 +0200, Nadav Horesh a écrit : > > It is obvious to me that True+False == True,. Why do you think it should > > be False? > I would understand it is not obvious that '+' stands for logical 'or', > and

Re: [Numpy-discussion] boolean arrays

2009-11-26 Thread Fabrice Silva
Le jeudi 26 novembre 2009 à 18:26 +0200, Nadav Horesh a écrit : > It is obvious to me that True+False == True,. Why do you think it should > be False? > I would understand it is not obvious that '+' stands for logical 'or', and '*' for logical 'and'... -- Fabrice Silva LMA UPR CNRS 7051 _

Re: [Numpy-discussion] boolean arrays

2009-11-26 Thread Nadav Horesh
It is obvious to me that True+False == True,. Why do you think it should be False? Nadav On Thu, 2009-11-26 at 14:20 +0100, Nils Wagner wrote: > Hi all, > > is the following behaviour correct > > >>> a = array(([True,True],[True,True])) > >>> b = array(([False,False],[False,False])) > > >>>

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread Vincent Schut
mdekauwe wrote: > Thanks...I have adopted that and as you said it is a lot neater! Though I > need to keep the pixel count for a weighting in another piece of code so > have amended your logic slightly. Alternatively, you could simply take the sum over axis=0 of the weight array to get the pixel

[Numpy-discussion] boolean arrays

2009-11-26 Thread Nils Wagner
Hi all, is the following behaviour correct >>> a = array(([True,True],[True,True])) >>> b = array(([False,False],[False,False])) >>> a+b array([[ True, True], [ True, True]]) I have expected False. Nils ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread mdekauwe
Thanks...I have adopted that and as you said it is a lot neater! Though I need to keep the pixel count for a weighting in another piece of code so have amended your logic slightly. #!/usr/bin/env python import sys, os, glob import numpy as np def averageEightDays(filenamesList, numrows, numcol

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread Vincent Schut
Hi mdekauwe, as long as your data size is small enough to fit a 8x array in memory and use it, why not just skip the running total and average 8 data arrays each 8day period? And skip the x and y loops; these are real performance killers. As a bonus, your code gets a lot smaller and more reade

Re: [Numpy-discussion] Help making better use of numpy array functions

2009-11-26 Thread mdekauwe
Thanks. Agreed it will break down under that scenario but that shouldn't be encountered as I am simply checking the value is greater than what I have set the undefined to be (-999.0). Here is the refjigged logic using numpy functionality for anyone who it might help. Would appreciate any suggestio