Re: how to shrink a numarray array?

2005-06-30 Thread Diez B. Roggisch
I need a method to shrink it to an 100-item array. > > x[::len(x)/panel_width] will not work. If the panel's width is 60, that > expression will return an array of 61 elements. > > I believe there is an existing function in numarray to do this, however > English is not my mothe

how to shrink a numarray array?

2005-06-29 Thread Qiangning Hong
[::len(x)/panel_width] will not work. If the panel's width is 60, that expression will return an array of 61 elements. I believe there is an existing function in numarray to do this, however English is not my mother tongue and math is not my speciality, I can't find it in the document full of

Re: Unhappy with numarray docs

2005-06-01 Thread Terry Reedy
"Matt Feinstein" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 01 Jun 2005 08:11:36 -0700, Scott David Daniels > <[EMAIL PROTECTED]> wrote: > >>Propose some fixes to the documents that will make this easier for >>the next one in line. You don't even need to get it exactly

Re: Unhappy with numarray docs

2005-06-01 Thread Matt Feinstein
On Wed, 01 Jun 2005 09:55:14 -0600, Fernando Perez <[EMAIL PROTECTED]> wrote: >Just a suggestion: post your message on the numeric discussion list (where >numarray is also discussed). Most of the num* developers only check c.l.py on >occasion, so it's very easy that your me

Re: Unhappy with numarray docs

2005-06-01 Thread Fernando Perez
umentation and why I didn't like it. Seriously, what more should I > do? It's plainly inappropriate for me to write documentation for a > module that I'm still struggling to learn. Just a suggestion: post your message on the numeric discussion list (where numarray is also disc

Re: Unhappy with numarray docs

2005-06-01 Thread Matt Feinstein
On Wed, 01 Jun 2005 08:11:36 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Propose some fixes to the documents that will make this easier for >the next one in line. You don't even need to get it exactly right; >the person after you can fix the mistakes you make. This is the >process we

Re: Unhappy with numarray docs

2005-06-01 Thread Scott David Daniels
Matt Feinstein wrote: > I spent all day yesterday trying to figure out how to do file IO in > the numarray module-- I -did- (I think) figure it all out, eventually, > but it's left me in a rather sour mood. > > Grr. Propose some fixes to the documents that will make this

Unhappy with numarray docs

2005-06-01 Thread Matt Feinstein
I spent all day yesterday trying to figure out how to do file IO in the numarray module-- I -did- (I think) figure it all out, eventually, but it's left me in a rather sour mood. 1. The basic functions and methods: fromfile, fromstring, tofile, and tostring, are buried, in non-alphabetical

Re: decimal numarray

2005-06-01 Thread chris
"km" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > is there any support for decimal type in numarray module ? > regards, > KM Still a noob but perhaps you can use gmpy, a wrapper for GMP arbitrary precision library. I found it here http://g

Re: decimal numarray

2005-05-30 Thread Robert Kern
km wrote: > Hi all, > is there any support for decimal type in numarray module ? Not specifically, no. However, there is the concept of an "object array," which are arrays of arbitrary Python objects. See numarray.objects . -- Robert Kern [EMAIL PROTECTED] "In the fie

decimal numarray

2005-05-30 Thread km
Hi all, is there any support for decimal type in numarray module ? regards, KM -- http://mail.python.org/mailman/listinfo/python-list

Re: Applying a function to a 2-D numarray

2005-05-16 Thread Robert Kern
Matt Feinstein wrote: > On Mon, 16 May 2005 12:03:24 -0600, Steven Bethard > <[EMAIL PROTECTED]> wrote: > >>Can you give an example of what you really want to do? Probably there >>are numarray functions that you can use. In general, you'll do better >>app

Re: Applying a function to a 2-D numarray

2005-05-16 Thread Steven Bethard
lse: > return x*f_out > return booltest If efficiency was a concern, I'd probably write this instead as: py> import numarray as na py> def genfunc(xmin, xmax, f_in, f_out): ... def booltest(arr): ... is_in = na.logical_and(arr > xmin, arr < xmax) ...

Re: Applying a function to a 2-D numarray

2005-05-16 Thread Matt Feinstein
On Mon, 16 May 2005 12:03:24 -0600, Steven Bethard <[EMAIL PROTECTED]> wrote: >Can you give an example of what you really want to do? Probably there >are numarray functions that you can use. In general, you'll do better >applying a sequence of numarray functions than opera

Re: Applying a function to a 2-D numarray

2005-05-16 Thread Steven Bethard
Matt Feinstein wrote: > On Mon, 16 May 2005 11:07:06 -0600, Steven Bethard > <[EMAIL PROTECTED]> wrote: > > > >>I must be missing something, because the simplest possible thing seems >>to work for me: >> >>py> import numarray as na >>py>

Re: Applying a function to a 2-D numarray

2005-05-16 Thread Matt Feinstein
On Mon, 16 May 2005 11:07:06 -0600, Steven Bethard <[EMAIL PROTECTED]> wrote: > >I must be missing something, because the simplest possible thing seems >to work for me: > >py> import numarray as na >py> def plus1(arr): >... return arr + 1 >... >py>

Re: Applying a function to a 2-D numarray

2005-05-16 Thread Steven Bethard
Matt Feinstein wrote: > Is there an optimal way to apply a function to the elements of a two-d > array? > > What I'd like to do is define some function: > > def plone(x): > return x+1 > > and then apply it elementwise to a 2-D numarray. I intend to treat

Applying a function to a 2-D numarray

2005-05-16 Thread Matt Feinstein
Is there an optimal way to apply a function to the elements of a two-d array? What I'd like to do is define some function: def plone(x): return x+1 and then apply it elementwise to a 2-D numarray. I intend to treat the function as a variable, so ufuncs are probably not appropriat

Re: Numarray question

2005-05-13 Thread Robert Kern
Am I missing > something? logical_and(), logical_or(), etc. These will handle arrays of truth values rather than treating the array as a single truth value like "and" and "or" will do. The reason why the latter is left undefined is because there isn't much solid agreem

Numarray question

2005-05-13 Thread Matt Feinstein
If I try >>> 2 < array([1,2,3]) I get: array([0, 0, 1], type=Bool) which is pretty slick, However if I set >>> q = 2 < array([1,2,3]) >>> q and q I get a runtime error: "An array doesn't make sense as a truth value." So.. why not? It seems to me that if I could vectorize logical expressions

Re: Numeric/Numarray equivalent to zip ?

2005-05-01 Thread George Sakkis
"Peter Otten" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > > Though not the fastest to execute; using concatenate instead of > > initializing an array from a list [a,a] is more than 2,5 time faster in > > my system (~4.6 vs 11.8 usec per loop according to timeit.py), and it's > > not harde

Re: Numeric/Numarray equivalent to zip ?

2005-05-01 Thread Peter Otten
George Sakkis wrote: > Though not the fastest to execute; using concatenate instead of > initializing an array from a list [a,a] is more than 2,5 time faster in > my system (~4.6 vs 11.8 usec per loop according to timeit.py), and it's > not harder either. That surprises me. I would expect essent

Re: Numeric/Numarray equivalent to zip ?

2005-05-01 Thread George Sakkis
"Peter Otten" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > > What's the fastest and most elegant equivalent of zip() in > > Numeric/Numarray between two equally sized 1D arrays ? That is, how to > > combine two (N,)-shaped arrays to one (N,2)

Re: Numeric/Numarray equivalent to zip ?

2005-05-01 Thread Peter Otten
George Sakkis wrote: > What's the fastest and most elegant equivalent of zip() in > Numeric/Numarray between two equally sized 1D arrays ? That is, how to > combine two (N,)-shaped arrays to one (N,2) (or (2,N)) shaped ? I > expect the fastest and the most elegant idiom to be id

Re: Numeric/Numarray equivalent to zip ?

2005-04-30 Thread Robert Kern
George Sakkis wrote: What's the fastest and most elegant equivalent of zip() in Numeric/Numarray between two equally sized 1D arrays ? That is, how to combine two (N,)-shaped arrays to one (N,2) (or (2,N)) shaped ? I expect the fastest and the most elegant idiom to be identical, as it is us

Numeric/Numarray equivalent to zip ?

2005-04-30 Thread George Sakkis
What's the fastest and most elegant equivalent of zip() in Numeric/Numarray between two equally sized 1D arrays ? That is, how to combine two (N,)-shaped arrays to one (N,2) (or (2,N)) shaped ? I expect the fastest and the most elegant idiom to be identical, as it is usually the case in

Re: Lexicographical sort for numarray

2005-04-27 Thread Jason Mobarak
Ah, okay, I didn't remember correctly what arr.tolist did. My mistake. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lexicographical sort for numarray

2005-04-27 Thread Robert Kern
Jason Mobarak wrote: It does what the OPs example does, but with numeric types. It certainly does not. In [15]:arr = na.arange(100) In [16]:random.shuffle(arr) In [17]:arr.shape = (10,10) In [18]:arr2 = na.array(arr) In [19]:L = arr.tolist() In [20]:L.sort() In [21]:na.array(L) Out[21]: array([[ 8,

Re: Lexicographical sort for numarray

2005-04-27 Thread Jason Mobarak
It does what the OPs example does, but with numeric types. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lexicographical sort for numarray

2005-04-27 Thread Robert Kern
Jason Mobarak wrote: import numarray as na import random # example array arr = range(100) random.shuffle(arr) arr = na.array(arr) arr = na.reshape(arr, (10,10)) print arr # not rowsort'ed arr.flat.sort() # key line print arr # rowsort'ed That's definitely not a lexicographic sort.

Re: Lexicographical sort for numarray

2005-04-27 Thread Jason Mobarak
import numarray as na import random # example array arr = range(100) random.shuffle(arr) arr = na.array(arr) arr = na.reshape(arr, (10,10)) print arr # not rowsort'ed arr.flat.sort() # key line print arr # rowsort'ed -- http://mail.python.org/mailman/listinfo/python-list

Lexicographical sort for numarray

2005-04-26 Thread Edward C. Jones
Suppose arr is a two dimensional numarray array. Suppose we do the following: def rowsort(arr): a = arr.tolist() a.sort() return numarray.array(a) Can this sort be done efficiently in numarray? This function is called "rowsort" in MatLab. -- http://mail.python.org/mailma

Re: New versions of numarray?

2005-04-25 Thread Robert Kern
Matt Feinstein wrote: Hi-- I notice that there are some new versions of numarray available for download-- is there any documentation on what's new/fixed/broken? You could ask on the numarray list. When you do, you should specify what version you're coming from so you can get the a

New versions of numarray?

2005-04-25 Thread Matt Feinstein
Hi-- I notice that there are some new versions of numarray available for download-- is there any documentation on what's new/fixed/broken? Matt Feinstein -- There is no virtue in believing something that can be proved to be true. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does numarray search for blas and lapack during installation?

2005-04-23 Thread RickMuller
IIRC, no. But the setup.py script is fairly easy to hack to link in your own blas/lapack libraries. -- http://mail.python.org/mailman/listinfo/python-list

Does numarray search for blas and lapack during installation?

2005-04-23 Thread Edward C. Jones
I have a PC with Debian sid installed. I install all my Python stuff in /usr/local. I just installed numarray 1.3.1. Blaslite and lapacklite were compiled. Did the installation process search for blas and lapack? -- http://mail.python.org/mailman/listinfo/python-list

Re: Matplotlib question-- Numeric or numarray?

2005-04-08 Thread John Hunter
equences if I use the Matt> 'wrong' array package-- e.g., put numarray in the .matlabrc Matt> file if the compile-time package is Numeric. But there's Matt> only one current, unlabeled, windows installer and there Matt> seems to have been a change, some t

Matplotlib question-- Numeric or numarray?

2005-04-08 Thread Matt Feinstein
I'm working my way through the matplotlib documentation & there's a point that's ambiguous-- the pdf file (dated Mar. 1, 2005) warns of dire consequences if I use the 'wrong' array package-- e.g., put numarray in the .matlabrc file if the compile-time package is

Re: Numarray newbie question

2005-03-31 Thread Colin J. Williams
ChinStrap wrote: I know there are probably alternatives for this with the standard library, but I think that would kill the speed I get with numarray: Say I have two 2-dimensional numarrays (x_mat and y_mat, say), and a function f(x,y) that I would like to evaluate at every index. Basically I want

Re: Numarray newbie question

2005-03-29 Thread ChinStrap
Oh well. I am downloading all the things to build it, but in the mean time I just did: def get_y_mat(x_ind,y_ind): return self.y_min + y_ind*self.dy def get_x_mat(x_ind,y_ind): return self.x_min + x_ind*self.dx self.x_mat=fromfunction(get_x_mat,m

Re: Numarray newbie question

2005-03-29 Thread Robert Kern
ChinStrap wrote: Are there no windows binaries for SciPy for python 2.4 yet? I try to run the installer and it complains that it can't find python 2.3. No, not yet. Besides that, vectorize is exactly what i want. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high A

Re: Numarray newbie question

2005-03-29 Thread ChinStrap
Are there no windows binaries for SciPy for python 2.4 yet? I try to run the installer and it complains that it can't find python 2.3. Besides that, vectorize is exactly what i want. -- http://mail.python.org/mailman/listinfo/python-list

Re: Numarray newbie question

2005-03-28 Thread Robert Kern
ChinStrap wrote: I know there are probably alternatives for this with the standard library, but I think that would kill the speed I get with numarray: Say I have two 2-dimensional numarrays (x_mat and y_mat, say), and a function f(x,y) that I would like to evaluate at every index. Basically I want

Numarray newbie question

2005-03-28 Thread ChinStrap
I know there are probably alternatives for this with the standard library, but I think that would kill the speed I get with numarray: Say I have two 2-dimensional numarrays (x_mat and y_mat, say), and a function f(x,y) that I would like to evaluate at every index. Basically I want to be able to

Re: Problem using/installing numarray

2005-02-17 Thread maxwell
Thanks, that explains why the CygWin Python will not import the .pyd files: >>> imp.get_suffixes() [('.dll', 'rb', 3), ('module.dll', 'rb', 3), ('.py', 'U', 1), ('.pyc', 'rb', 2)] Doesn't look like there's a way to get the CygWin Python to load .pyd files. So I guess I have to figure out why the

Re: Problem using/installing numarray

2005-02-17 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > ImportError: No module named _conv > The file _conf.pyd exists, but my guess is that the .pyd suffix is not > recognized under the CygWin version of Python. (But that doesn't make > sense...) you can use imp.get_suffixes() to get a list of supported extensions. her

Problem using/installing numarray

2005-02-16 Thread maxwell
I'm trying to use the 'numarray' package (v1.1.1) under Python 2.4 running under CygWin. I initially downloaded the Windows executable version of the numarray package, and installed it under C:\program files\python\lib\site-packages. That works with the Windows version of Pyth

Re: Connecting to numarray. Problem with the setup program

2004-12-08 Thread Colin J. Williams
Jean Moser wrote: I tried many times to connect to numarray without success. I choosed the release: numarray-1.1.1.win32py2.2.exe then I went to the setup program made by Greenfield and I tried to follow the commands.The mentioned Python directory is C:\PROGRA~2 which is not covenient. I tried to

Connecting to numarray. Problem with the setup program

2004-12-08 Thread Jean Moser
I tried many times to connect to numarray without success. I choosed the release: numarray-1.1.1.win32py2.2.exe then I went to the setup program made by Greenfield and I tried to follow the commands.The mentioned Python directory is C:\PROGRA~2 which is not covenient. I tried to change it but

Re: Rounding the elements of a Python array (numarray module)

2004-12-03 Thread Chris P.
S I wasn't sure if no one replied because a) this question was too dumb or b) this question was too hard... it was definitely the former. But I'll post the answer, anyway: I forgot to keep in mind - when reading the documentation, assume that a >>> from numarray import *

Rounding the elements of a Python array (numarray module)

2004-11-30 Thread Chris P.
Hi. I have a very simple task to perform and I'm having a hard time doing it. Given an array called 'x' (created using the numarray library), is there a single command that rounds each of its elements to the nearest integer? I've already tried something like >

<    1   2