[Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Richard D. Moores
If not now, when?

Thanks,

Dick Moores
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Crosstabulation

2010-07-19 Thread sandric ionut

Hi Friedrich:

For land-use a class would be for example forest, other would be orchard etc. 
For Slope gradient I would have values which 3 and between 3 and 7 etc. So, I 
will have 2 raster data with, let's say, 3 classes each: forest, orchards and 
built-up area and for slope gradient: 0-3, 3-15, 15-35. The cross-tabulation 
analysis should give me a table like:

forest orchards built-up
0-3 10 20   15
3-15   5   10   20
15-35 5   15   15

where the numbers represents all the common cells, for example: 10 cells with 
forest correspond to 10 cells with 0-3 slope gradient interval and so on
(by cells I mean the pixel from a raster data)

The analysis is better illustrated here: 
http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=tabulate_area 


Ionut  




From: Friedrich Romstedt friedrichromst...@gmail.com
To: Discussion of Numerical Python numpy-discussion@scipy.org
Sent: Sun, July 18, 2010 12:09:04 AM
Subject: Re: [Numpy-discussion] Crosstabulation

2010/7/17 Robert Kern robert.k...@gmail.com:
 On Sat, Jul 17, 2010 at 13:11, Friedrich Romstedt
 friedrichromst...@gmail.com wrote:
 2010/7/14 Ionut Sandric sandricio...@yahoo.com:
 I'm afraid also Zach does not understand what you are talking about
 ... So my first question (please bear with me) would be: What's a dem?

 Digital Elevation Map.

  (n/a in my dictionary)  And sorry for the cross-talk on the other
 first post by you ...

 And by slope gradient you mean second derivative?

 No, the first derivative. Slope gradient is a reasonably common,
 albeit somewhat redundant, idiom meaning the gradient of an elevation
 map.

Thanks Robert, that clarifies a lot.

But still I don't understand how the crosstabulation shall work.  What
are the classes?

Friedrich
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion



  ___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Complex nan ordering

2010-07-19 Thread Pauli Virtanen
  However, nans have been propagated by maximum and minimum since 1.4.0.
 There was a question, discussed on the list, as to what 'nan' complex to
 return in the propagation, but it was still a nan complex in your
 definition of such objects. The final choice was driven by using the
 first of the already available complex nans as it was the easiest thing
 to do. However, (nan, nan) would be just as easy to do now that nans are
 available. 

Then we would be creating an inconsistency between amax/argmax. Of course if we 
say all cnans are equivalent, it doesn't matter.

 I'm not sure what your modifications to the macros buys us,
 what do you want to achieve?

1) fix bugs in nan propagation,

maximum(1, complex(0, nan))

used to return 1. The result also depended previously on the order of arguments.

2) make complex nan behave similarly as a real nan in comparisons (non-sorting).

I think both of these are worthwhile.

Pauli

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Complex128

2010-07-19 Thread Pauli Virtanen
Sun, 18 Jul 2010 21:15:15 -0500, Ross Harder wrote:

 mac os x leopard 10.5..
 EPD installed
 
 i just don't understand why i get one thing when i ask for another. i
 can get what i want, but only by not asking for it.

Do you get the same behavior also from

import numpy as np
np.array([0,0], dtype=np.complex256)

-- 
Pauli Virtanen

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] f2py problem with complex inout in subroutine

2010-07-19 Thread Mark Bakker
Thanks for fixing this, Pearu.
Complex arrays with intent(inout) don't seem to work either.
They compile, but a problem occurs when calling the routine.
Did you fix that as well?

Here's an example that doesn't work (sorry, I cannot update to svn 8478 on
my machine right now):

subroutine test3(nlab,omega)
implicit none
integer, intent(in) :: nlab
complex(kind=8), dimension(nlab), intent(inout) :: omega
integer :: n
do n = 1,nlab
omega(n) = cmplx(1,1,kind=8)
end do
end subroutine test3


Thanks,

Mark


On 07/09/2010 02:03 PM, Mark Bakker wrote:
 Hello list. The following subroutine fails to compile with f2py.
 I use a complex variable with intent(inout). It works fine with two real
 variables, so I have a workaround, but it would be nicer with a complex
 variable.
 Any thoughts on what I am doing wrong?

compilation failed because of typos in the generated code. This is fixed
in svn revision 8478.

Pearu
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Crosstabulation

2010-07-19 Thread Vincent Schut


On 07/19/2010 09:55 AM, sandric ionut wrote:

 Hi Friedrich:

 For land-use a class would be for example forest, other would be orchard
 etc. For Slope gradient I would have values which 3 and between 3 and 7
 etc. So, I will have 2 raster data with, let's say, 3 classes each:
 forest, orchards and built-up area and for slope gradient: 0-3, 3-15,
 15-35. The cross-tabulation analysis should give me a table like:

 forest orchards built-up
 0-3 10 n bsp; 20 15
 3-15 5 10 20
 15-35 5 15 15

 where the numbers represents all the common cells, for example: 10 cells
 with forest correspond to 10 cells with 0-3 slope gradient interval and
 so on
 (by cells I mean the pixel from a raster data)

 The analysis is better illustrated here:
 http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=tabulate_area

 Ionut

Ha, we're messing up lingo's here :-) Need to switch to GIS (geographic 
information systems) dialect.
- DEM = digital elevation map, usually a 2d array ('raster') with 
elevation values (for a certain area on earth)
- slope gradient = the slope (literally, not as in math speak) of the 
surface depicted by the elevation map. Mostly defined as the maximum 
slope within a certain moving window; several competing methods to 
estimate/calculate slope exist.
- land use/cover class: raster (array) where each cell ('pixel') has an 
integer value, which maps to some well defined land use at that location 
(e.g. 0 means sea, 1 means forest, 2 means agriculture, etc)
- crosstabulation usually means some kind of 2d histogram, where the 
total number of raster cells with a certain value (e.g. depicting 'land 
use class') 'within' a range of values of another raster with the same 
shape (and matching locations). Like: how many cells of forest lie 
withing a slope range of 0-10 degrees?

Right. On to the answers. I think you should look into 
numpy.histogram2d, where you can do exactly what you want. Your land use 
array is x, your slope gradient array = y, then you define the bins as 
your class numbers (for x) and your slope gradient ranges (for y), and 
you will get a pixel count for each bin combination.

see: 
http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html

Regards,
Vincent Schut.


 
 *From:* Friedrich Romstedt friedrichromst...@gmail.com
 *To:* Discussion of Numerical Python numpy-discussion@scipy.org
 *Sent:* Sun, July 18, 2010 12:09:04 AM
 *Subject:* Re: [Numpy-discussion] Crosstabulation

 2010/7/17 Robert Kern robert.k...@gmail.com
 mailto:robert.k...@gmail.com:
   On Sat, Jul 17, 2010 at 13:11, Friedrich Romstedt
   friedrichromst...@gmail.com mailto:friedrichromst...@gmail.com wrote:
   2010/7/14 Ionut Sandric sandricio...@yahoo.com
 mailto:sandricio...@yahoo.com:
   I'm afraid also Zach does not understand what you are talking about
   ... So my first question (please bear with me) would be: What's a dem?
  
   Digital Elevation Map.
  
   (n/a in my dictionary) And sorry for the cross-talk on the other
   first post by you ...
  
   And by slope gradient you mean second derivative?
  
   No, the first derivative. Slope gradient is a reasonably common,
   albeit somewhat redundant, idiom meaning the gradient of an elevation
   map.

 Thanks Robert, that clarifies a lot.

 But still I don't understand how the crosstabulation shall work. What
 are the classes?

 Friedrich
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org mailto:NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion



 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Renato Fabbri
anyway, svn and tortoise are very useful.

do some trial an error. try stuff, its easier than one usually imagine.

(tip: checkout the svn address, whatever that should mean to you at the moment)

cheers,
rf

2010/7/19 David Cournapeau courn...@gmail.com:
 On Mon, Jul 19, 2010 at 12:35 PM, Richard D. Moores rdmoo...@gmail.com 
 wrote:
 On Mon, Jul 19, 2010 at 00:38, Scott Sinclair
 scott.sinclair...@gmail.com wrote:
On 19 July 2010 08:21, Richard D. Moores rdmoo...@gmail.com wrote:
 If not now, when?

 http://mail.scipy.org/pipermail/numpy-discussion/2010-July/051436.html

 I'm afraid I need some help with that page. I'm interested in

 if you are not comfortable with svn, I would advise you to just wait
 for binaries. Building numpy on windows is not so easy,

 David
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion




-- 
GNU/Linux User #479299
skype: fabbri.renato
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Renato Fabbri
dick,

The thing is:

1) get the path to where your python3 is installed (something like
c:\Python3) i don't remember that anymore.

2) run that setup with it, like c:\python3\python3 setup.py build

3) read CAREFULLY the output at your console. Specially the last
lines. Start looking for an error, try to find where all errors
start., that is, where the errors sequence is initiated.

4) When u find out what initiated the error sequence, solve it!

5) when c:\\python3 setup.py build runs smoothly, do
c:\...\python3 setup.py install

if i may, consider installing a linux distro, maybe ubuntu (ubuntu
10.04 is running very well). life gets better.

best of luck,
rf



2010/7/19 Richard D. Moores rdmoo...@gmail.com:
 On Mon, Jul 19, 2010 at 03:47, Renato Fabbri renato.fab...@gmail.com wrote:
 anyway, svn and tortoise are very useful.

 do some trial an error. try stuff, its easier than one usually imagine.

 (tip: checkout the svn address, whatever that should mean to you at the 
 moment)

 OK, I checked out, cd-ed to numpy, but python3 setup.py build
 doesn't work. Get

 c:\SVNRepository\numpypython3 setup.py build
 'python3' is not recognized as an internal or external command,
 operable program or batch file.

 So I tried just
 c:\SVNRepository\numpysetup.py build

 Saw stuff happen I didn't understand. Maybe complete screwed things
 up. How do I tell? What's next?

 Dick
 python3 setup.py build
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion




-- 
GNU/Linux User #479299
skype: fabbri.renato
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Richard D. Moores
On Mon, Jul 19, 2010 at 04:49, Alan G Isaac ais...@american.edu wrote:
 On 7/19/2010 7:33 AM, Richard D. Moores wrote:
 'python3' is not recognized as an internal or external command,
 operable program or batch file.

 It's just ``python``.
 hth,
 Alan Isaac

 C:\Python31dir *.exe
  Volume in drive C has no label.
  Volume Serial Number is 1464-2B08

  Directory of C:\Python31

 03/20/2010  10:58 PM            27,136 python.exe
 03/20/2010  11:01 PM            27,648 pythonw.exe
                2 File(s)         54,784 bytes
                0 Dir(s)  185,158,647,808 bytes free

 C:\Python31python
 Python 3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64 bit (AMD64)] 
 on
 win32
 Type help, copyright, credits or license for more information.
 exit()

 C:\Python31python.exe
 Python 3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64 bit (AMD64)] 
 on
 win32
 Type help, copyright, credits or license for more information.
 exit()

c:\Python31python.exe
ActivePython 3.1.2.3 (ActiveState Software Inc.) based on
Python 3.1.2 (r312:79147, Mar 22 2010, 12:30:45) [MSC v.1500 64 bit
(AMD64)] on win32
Type help, copyright, credits or license for more information.


Now what? Try simple commands? Like Lemme outta here!?

Dick
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy 1.5 or 2.0

2010-07-19 Thread Nadav Horesh
Till now I see that  numpy2 plays well with PIL, Matplotlib, scipy and maybe 
some other packages. Should I expect that it might break?


  Nadav.


-Original Message-
From: numpy-discussion-boun...@scipy.org on behalf of Pauli Virtanen
Sent: Mon 19-Jul-10 10:54
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] numpy 1.5 or 2.0
 
 What is the difference between these two versions? I usually check out
 the svn version (now 2.0) and it compiles well with python 2.6, 2.7 and
 3.1.

Binary compatibility with previous versions.
Moreover, 2.0 will likely contain a refactored core.

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

winmail.dat___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Matthieu Brucher
 Dave, I got:
 c:\SVNRepository\numpyC:\Python31python setup.py bdist_wininst
 'C:\Python31' is not recognized as an internal or external command,
 operable program or batch file.

 Or didn't I do exactly what you suggested?

python setup.py bdist_wininst

 Assuming you have a C compiler on your system (and in your path)

 I'm afraid I have no idea, nor how to find out.

I'm afraid that if you don't know if you have a compiler, you don't
have one. This also means you will not be able to compile Numpy, as
the official compiler is no longer available.

Matthieu
-- 
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Richard D. Moores
On Mon, Jul 19, 2010 at 05:28, Vincent Schut sc...@sarvision.nl wrote:

 Well, you might want to read up on some beginners guide for python? It's
 up to you, of course, but usually before starting with numpy (which
 extends python), it is advised to have at least some basic python
 understanding... Googling will give you plenty of good resources, if
 you'd like to.

I'm not a python beginner. Why did you assume I was?

 Then, for the sake of helping you further anyway:
 you'll have to mind the significance of paths (=directories or folders
 in windows speak I think). The folder you're currently in, will restrict
 what you find when typing commands. If you need to reference something
 from a different folder, you'll need to explicitly specify that.

Yes, I have that understanding.

 To build numpy, you'll need to be in the numpy source folder (the numpy
 you extracted from svn). But if you're there, simply typing 'python' or
 'python.exe' will probably not work because 'python.exe' is in a
 different folder (c:\Python31). You could go into that folder, but then
 you would not be able to find numpy's setup.py script. Best way to solve
 that: make sure you're in the numpy folder, and type something like:
 'c:\Python31\python.exe setup.py build'. That should get you started at
 least.

 However, if I'm allowed to give you some unaskedfor advice: this might
 become lots easier if you make sure you're at least a bit comfortable
 with 1) the windows command prompt, 2) python, and 3) building python
 stuff from svn source checkouts. No offence meant. But you sound as you
 feel a lot more comfortable with pre-built packages compared to building
 yourself from source on windows...

No, I fail your number 3.

 Good luck anyway!
 Vincent Schut.

Thanks, Vincent. And I am more comfortable with pre-built packages.

Dick
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Richard D. Moores
On Mon, Jul 19, 2010 at 05:53, Matthieu Brucher
matthieu.bruc...@gmail.com wrote:
 Dave, I got:
 c:\SVNRepository\numpyC:\Python31python setup.py bdist_wininst
 'C:\Python31' is not recognized as an internal or external command,
 operable program or batch file.

 Or didn't I do exactly what you suggested?

 python setup.py bdist_wininst

 Assuming you have a C compiler on your system (and in your path)

 I'm afraid I have no idea, nor how to find out.

 I'm afraid that if you don't know if you have a compiler, you don't
 have one. This also means you will not be able to compile Numpy, as
 the official compiler is no longer available.

Ah, Thanks, Matthieu. When I had a shell account long ago, I had a C
compiler available, or gcc, I think it was. I used it while learning a
bit of C.

Dick
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Jean-Luc Menut
 Dave, I got:
 c:\SVNRepository\numpyC:\Python31python setup.py bdist_wininst
 'C:\Python31' is not recognized as an internal or external command,
 operable program or batch file.

I shouldn't type C:\Python31python setup.py bdist_wininst. but python 
setup.py bdist_wininst

You might have a look at these 2 windows prompt/command line tutorials :
http://www.bleepingcomputer.com/tutorials/tutorial76.html
http://www.voidspace.org.uk/python/articles/command_line.shtml


J.L.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Dave
Richard D. Moores rdmoores at gmail.com writes:

 
 
  The commands should therefore be:
  cd c:\SVNRepository\numpy
  C:\Python31python setup.py bdist_wininst
 
 Dave, I got:
 c:\SVNRepository\numpyC:\Python31python setup.py bdist_wininst
 'C:\Python31' is not recognized as an internal or external command,
 operable program or batch file.
 
 Or didn't I do exactly what you suggested?
 
  Assuming you have a C compiler on your system (and in your path)
 
 I'm afraid I have no idea, nor how to find out.
 

My bad - typo. The command to build numpy should have been:

C:\Python31\python setup.py bdist_wininst

i.e. the full path and filename of the program you want to run (Python3). Paths
are seperated by backslash characters, not greater than signs!

As Matthieu says, if you don't know if you have a C-compiler then you probably
don't have one.

I've got gcc installed so if I enter gcc at the command line it'll give me an
error saying that I didn't specify the input files:


M:\Code\sandboxgcc
gcc: no input files

M:\Code\sandbox

if you don't have it installed (and on your path) you'll get the not recognized
as an internal or external command error.

-Dave



___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Vincent Schut


On 07/19/2010 02:56 PM, Richard D. Moores wrote:
 On Mon, Jul 19, 2010 at 05:28, Vincent Schutsc...@sarvision.nl  wrote:

 Well, you might want to read up on some beginners guide for python? It's
 up to you, of course, but usually before starting with numpy (which
 extends python), it is advised to have at least some basic python
 understanding... Googling will give you plenty of good resources, if
 you'd like to.

 I'm not a python beginner. Why did you assume I was?

I appologize, then. This, however, made me think you were:
'Now what? Try simple commands? Like Lemme outta here!?'
Now english is not my native language, so some subtle humour might have 
escaped me and I may have understood that entirely wrong... :-)


 Then, for the sake of helping you further anyway:
 you'll have to mind the significance of paths (=directories or folders
 in windows speak I think). The folder you're currently in, will restrict
 what you find when typing commands. If you need to reference something
 from a different folder, you'll need to explicitly specify that.

 Yes, I have that understanding.
Good.
The fact that you were starting python from the Python31 folder, and 
then typed 'now what?' gave me the idea you did not...

 To build numpy, you'll need to be in the numpy source folder (the numpy
 you extracted from svn). But if you're there, simply typing 'python' or
 'python.exe' will probably not work because 'python.exe' is in a
 different folder (c:\Python31). You could go into that folder, but then
 you would not be able to find numpy's setup.py script. Best way to solve
 that: make sure you're in the numpy folder, and type something like:
 'c:\Python31\python.exe setup.py build'. That should get you started at
 least.

 However, if I'm allowed to give you some unaskedfor advice: this might
 become lots easier if you make sure you're at least a bit comfortable
 with 1) the windows command prompt, 2) python, and 3) building python
 stuff from svn source checkouts. No offence meant. But you sound as you
 feel a lot more comfortable with pre-built packages compared to building
 yourself from source on windows...

 No, I fail your number 3.

Well, than you've come along quite far already, and are on the right 
list :-)
Then, please post the output of your 'python setup.py build' command, 
which will give us some clues about *why* you fail... (or, if the output 
is long, try to find the relevant lines indicating where and what goes 
wrong)


 Good luck anyway!
 Vincent Schut.

 Thanks, Vincent. And I am more comfortable with pre-built packages.
Most of us are ;-) But sometimes you just need to bite the bullet...

 Dick

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Python 2.7 MSI installer for NumPy

2010-07-19 Thread Ralf Gommers
On Mon, Jul 19, 2010 at 6:06 AM, Christoph Gohlke cgoh...@uci.edu wrote:



 On 7/18/2010 2:20 PM, David Cournapeau wrote:

 On Sun, Jul 18, 2010 at 8:34 PM, Peter
 numpy-discuss...@maubp.freeserve.co.uk  wrote:

 On Sun, Jul 18, 2010 at 6:02 PM, cool-RRcool...@cool-rr.com  wrote:

 Hello.
 I'd appreciate if the NumPy team could provide an MSI installer
 for Python 2.7.
 Thanks,
 Ram Rachum.


 You're not the only person who would like this - it was discussed
 here just 9 days ago, thread title A release for python 2.7?, and
 the conclusion was we'd have to wait for Numpy 1.5, probably in
 August.


 It seems that building from the 1.4.x branch works out of the box, so
 at least a numpy msi should be straightforward,


 Binaries built from the numpy 1.4.x branch do crash on Python 2.7 because
 of this: http://projects.scipy.org/numpy/ticket/1345. The fix is easy to
 backport (attached). Until yesterday another reason not to release numpy
 1.4.1 binaries for Python 2.7 was the projected use of PyCapsule instead of
 PyCObject in numpy 1.5+.

 I don't think we can apply this patch, compile some binaries and still call
it 1.4.1. It would be 1.4.2, which wouldn't take that much less time to
arrive than 1.5.0. Maybe it does make sense to apply the patch for people
wanting to create their own binaries, or in (the not so likely) case there
is another reason to release 1.4.2.

Cheers,
Ralf
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Vincent Schut


On 07/19/2010 03:34 PM, Richard D. Moores wrote:
 On Mon, Jul 19, 2010 at 06:15, Vincent Schutsc...@sarvision.nl  wrote:


 On 07/19/2010 02:56 PM, Richard D. Moores wrote:
 On Mon, Jul 19, 2010 at 05:28, Vincent Schutsc...@sarvision.nlwrote:

 Well, you might want to read up on some beginners guide for python? It's
 up to you, of course, but usually before starting with numpy (which
 extends python), it is advised to have at least some basic python
 understanding... Googling will give you plenty of good resources, if
 you'd like to.

 I'm not a python beginner. Why did you assume I was?

 I appologize, then. This, however, made me think you were:
 'Now what? Try simple commands? Like Lemme outta here!?'
 Now english is not my native language, so some subtle humour might have
 escaped me and I may have understood that entirely wrong... :-)

 Oh, that's OK. But it's otherwise hard to believe English is not your
 native language.
Ha, thanks :-) Dutch it is, however realizing that we're just a tiny 
speck on the world's stage we get tought english from our 10th...


 Then, for the sake of helping you further anyway:
 you'll have to mind the significance of paths (=directories or folders
 in windows speak I think). The folder you're currently in, will restrict
 what you find when typing commands. If you need to reference something
 from a different folder, you'll need to explicitly specify that.

 Yes, I have that understanding.
 Good.
 The fact that you were starting python from the Python31 folder, and
 then typed 'now what?' gave me the idea you did not...

 To build numpy, you'll need to be in the numpy source folder (the numpy
 you extracted from svn). But if you're there, simply typing 'python' or
 'python.exe' will probably not work because 'python.exe' is in a
 different folder (c:\Python31). You could go into that folder, but then
 you would not be able to find numpy's setup.py script. Best way to solve
 that: make sure you're in the numpy folder, and type something like:
 'c:\Python31\python.exe setup.py build'. That should get you started at
 least.

 However, if I'm allowed to give you some unaskedfor advice: this might
 become lots easier if you make sure you're at least a bit comfortable
 with 1) the windows command prompt, 2) python, and 3) building python
 stuff from svn source checkouts. No offence meant. But you sound as you
 feel a lot more comfortable with pre-built packages compared to building
 yourself from source on windows...

 No, I fail your number 3.

 Well, than you've come along quite far already, and are on the right
 list :-)
 Then, please post the output of your 'python setup.py build' command,
 which will give us some clues about *why* you fail... (or, if the output
 is long, try to find the relevant lines indicating where and what goes
 wrong)

 I posted the output as an attached text file in my reply to Dave. Not
 sure that got to the list as I'm not familiar with the list's rules
 about attachments.

I, my fault then, I didn't see that. Seen  read it now, though. I'm not 
a windows users, and am afraid that I can't help you any further anymore 
with this as your problems seem to be pretty much windows/msvc 
related... Others on this list will know more, probably.


 Thanks, Vincent. And I am more comfortable with pre-built packages.
 Most of us are ;-) But sometimes you just need to bite the bullet...

 I'm biting, I'm biting (that's another kind of U.S. joking). Actually,
 several years ago I was using Ulipad, an IDE for Python. It was under
 active development and frequently updated via svn. So I had and used
 TortoiseSVN then, but on an old computer.  So I'm starting over
 getting the details of how to use it back.
Ha, I've used ulipad too. Mostly because it's lean 'n mean and doesn't 
force you to create an entire 'project' to just create a new python 
script (like eclipse/pydev et.al. do). Have newer hardware now, so the 
lean 'n' mean argument is of less significance, but still use it 
sometimes for some quick hacking...

 Dick
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Richard D. Moores
On Mon, Jul 19, 2010 at 06:56, Vincent Schut sc...@sarvision.nl wrote:


 On 07/19/2010 03:34 PM, Richard D. Moores wrote:
 On Mon, Jul 19, 2010 at 06:15, Vincent Schutsc...@sarvision.nl  wrote:


 several years ago I was using Ulipad, an IDE for Python. It was under
 active development and frequently updated via svn. So I had and used
 TortoiseSVN then, but on an old computer.  So I'm starting over
 getting the details of how to use it back.

 Ha, I've used ulipad too. Mostly because it's lean 'n mean and doesn't
 force you to create an entire 'project' to just create a new python
 script (like eclipse/pydev et.al. do). Have newer hardware now, so the
 lean 'n' mean argument is of less significance, but still use it
 sometimes for some quick hacking...

Too bad you can't use Wing. The project problem is there, but easily
gotten around. And the support is excellent.

Dick
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Dave
Richard D. Moores rdmoores at gmail.com writes:

 
 On Mon, Jul 19, 2010 at 06:03, Dave dave.hirschfeld at gmail.com wrote:
  My bad - typo. The command to build numpy should have been:
 
  C:\Python31\python setup.py bdist_wininst
 
 I tried that. See the attached.
 
  i.e. the full path and filename of the program you want to run (Python3). 
 No module named msvccompiler in numpy.distutils; trying from distutils
 error: Unable to find vcvarsall.bat
 
 c:\SVNRepository\numpy
 

All I meant by that was that the full path and filename of your Python3
interpreter was C:\Python31\python.exe (the .exe  isn't necessary but is part
of the filename.)

By default on Windoze python will try to use the Microsoft compilers and the
error message above is saying it can't find them.

When you say you do have one I'm assuming that when you entered gcc at the
command line you got the gcc: no input files error message back. In this case
we need to tell python to use the gcc compilers.

In Python 2.5 you can do this by creating a text file called distutils.cfg in
the C:\Python31\Lib\distutils directory with the following statements:

[build]
compiler=mingw32

[config]
compiler = mingw32

I don't have Python 3 so not sure if this still works.

HTH,
Dave


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Robin
On Mon, Jul 19, 2010 at 1:53 PM, Matthieu Brucher
matthieu.bruc...@gmail.com wrote:
 I'm afraid that if you don't know if you have a compiler, you don't
 have one. This also means you will not be able to compile Numpy, as
 the official compiler is no longer available.

Is this the VS 2008 Express Edition? I saw something posted a while
ago about how it was no longer available, but I think it was a mistake
as it still seems to be easily available from:

http://www.microsoft.com/express/downloads/#2008-All

Even 2005 is still available so I imagine there is some time before we
have to worry about 2008.

http://www.microsoft.com/downloads/details.aspx?familyid=7B0B0339-613A-46E6-AB4D-080D4D4A8C4Edisplaylang=en

Cheers

Robin
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Richard D. Moores
On Mon, Jul 19, 2010 at 07:38, Dave dave.hirschf...@gmail.com wrote:
 When you say you do have one I'm assuming that when you entered gcc at the
 command line you got the gcc: no input files error message back. In this 
 case
 we need to tell python to use the gcc compilers.

No, I don't have gcc. I had access to gcc on a shell account, and used it.

Dick
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] missing string formatting functionality?

2010-07-19 Thread Benjamin Root
On Thu, Jul 15, 2010 at 7:53 AM, Neal Becker ndbeck...@gmail.com wrote:

 It looks like np.savetxt is pretty flexible, accepting fmt, and delimiter
 args.  But to format into a string, we have array_repr and array_str, which
 are not flexible.

 Of course, one can use np.savetxt with python stringio, but that's more
 work.  Would be nice if np.savetxt could just return a string.  Better
 still, if np.savestring (returning a string) would implement core
 functionality, and np.savetxt would just us it.


At first, I was thinking that this might not be a bad idea, however, on
second thought there might be memory issues.  Probably not huge memory
issues, but depending on the amount of data, it might be too costly in the
general use case.  I would guess that doing a StringIO approach would
probably be better than reworking savetxt.  Because savetxt already accepts
a file-like object, StringIO fits very nicely to the existing numpy
framework.

My 2 cents...

Ben Root
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Richard D. Moores
On Mon, Jul 19, 2010 at 07:48, Robin robi...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 1:53 PM, Matthieu Brucher
 matthieu.bruc...@gmail.com wrote:
 I'm afraid that if you don't know if you have a compiler, you don't
 have one. This also means you will not be able to compile Numpy, as
 the official compiler is no longer available.

 Is this the VS 2008 Express Edition? I saw something posted a while
 ago about how it was no longer available, but I think it was a mistake
 as it still seems to be easily available from:

 http://www.microsoft.com/express/downloads/#2008-All

Would Visual Basic 2008 Express Edition have the C compiler? I know
some visual basic and wouldn't mine having this limited version of
2008.

Dick
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy 1.4.1 fails to build on (Debian) alpha and powepc

2010-07-19 Thread David Cournapeau
On Sun, Jul 18, 2010 at 12:53 PM, Sandro Tosi mo...@debian.org wrote:
 Hello,
 I finally found the time to update numpy in Debian. But, there is a problem...

 As you probably know, we support several architectures and we need to
 have any package available on each of them. After the upload I noticed
 numpy has problem building on alpha [1] (ieee754.c compilation error,
 probably related to the conversion from .src) and powerpc [2]
 (long_double identification)

The alpha issue should be easy to fix: it is just a code path which
has never been tested so far, but the code is there.

The ppc one is more annoying, and known. The problem is that linux on
ppc uses the IBM format for long double (sum of two double), which
requires to implement non trivial, heavily platform dependent code. I
have just added code to correctly detect the long double format at the
configure stage.

Do you have shell access to the machines ? It would makes the work
much easier for me to fix those issues,

David
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Richard D. Moores
On Mon, Jul 19, 2010 at 09:00, Robert Kern robert.k...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 11:53, Richard D. Moores rdmoo...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 07:48, Robin robi...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 1:53 PM, Matthieu Brucher
 matthieu.bruc...@gmail.com wrote:
 I'm afraid that if you don't know if you have a compiler, you don't
 have one. This also means you will not be able to compile Numpy, as
 the official compiler is no longer available.

 Is this the VS 2008 Express Edition? I saw something posted a while
 ago about how it was no longer available, but I think it was a mistake
 as it still seems to be easily available from:

 http://www.microsoft.com/express/downloads/#2008-All

 Would Visual Basic 2008 Express Edition have the C compiler? I know
 some visual basic and wouldn't mine having this limited version of
 2008.

 You need Visual Studio 2008 Express Edition. Visual Basic 2008 Express
 Edition is just a component of Visual Studio and does not have the C
 compiler. Visual C++ 2008 Express Edition is probably sufficient,

You mean it probably has the C compiler. If it does, I'd just as soon
not install any more of VS. And if it does, does that mean that the
setup.py in question would find it?

 but
 I recommend getting the whole Visual Studio if you can afford the time
 and disk space.

Because you think VS is a good application -- quite apart from its
being a source of a C compiler?

Dick
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread Robert Kern
On Mon, Jul 19, 2010 at 14:17, Richard D. Moores rdmoo...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 09:00, Robert Kern robert.k...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 11:53, Richard D. Moores rdmoo...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 07:48, Robin robi...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 1:53 PM, Matthieu Brucher
 matthieu.bruc...@gmail.com wrote:
 I'm afraid that if you don't know if you have a compiler, you don't
 have one. This also means you will not be able to compile Numpy, as
 the official compiler is no longer available.

 Is this the VS 2008 Express Edition? I saw something posted a while
 ago about how it was no longer available, but I think it was a mistake
 as it still seems to be easily available from:

 http://www.microsoft.com/express/downloads/#2008-All

 Would Visual Basic 2008 Express Edition have the C compiler? I know
 some visual basic and wouldn't mine having this limited version of
 2008.

 You need Visual Studio 2008 Express Edition. Visual Basic 2008 Express
 Edition is just a component of Visual Studio and does not have the C
 compiler. Visual C++ 2008 Express Edition is probably sufficient,

 You mean it probably has the C compiler.

It definitely has the C compiler. That is *probably* sufficient for
compiling Python extensions, but I am not sure.

 If it does, I'd just as soon
 not install any more of VS. And if it does, does that mean that the
 setup.py in question would find it?

Probably. If you try it, but setup.py still tells you error: Unable
to find vcvarsall.bat, then you may need to find where the file
vcvarsall.bat is in your VS-C++ installation and add it to your %PATH%
environment variable. Then start a new command shell and try the
setup.py again.

 but
 I recommend getting the whole Visual Studio if you can afford the time
 and disk space.

 Because you think VS is a good application -- quite apart from its
 being a source of a C compiler?

No, because it is most likely to work the first time.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy for Python 3?

2010-07-19 Thread David Cournapeau
On Mon, Jul 19, 2010 at 8:31 PM, Robert Kern robert.k...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 14:17, Richard D. Moores rdmoo...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 09:00, Robert Kern robert.k...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 11:53, Richard D. Moores rdmoo...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 07:48, Robin robi...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 1:53 PM, Matthieu Brucher
 matthieu.bruc...@gmail.com wrote:
 I'm afraid that if you don't know if you have a compiler, you don't
 have one. This also means you will not be able to compile Numpy, as
 the official compiler is no longer available.

 Is this the VS 2008 Express Edition? I saw something posted a while
 ago about how it was no longer available, but I think it was a mistake
 as it still seems to be easily available from:

 http://www.microsoft.com/express/downloads/#2008-All

 Would Visual Basic 2008 Express Edition have the C compiler? I know
 some visual basic and wouldn't mine having this limited version of
 2008.

 You need Visual Studio 2008 Express Edition. Visual Basic 2008 Express
 Edition is just a component of Visual Studio and does not have the C
 compiler. Visual C++ 2008 Express Edition is probably sufficient,

 You mean it probably has the C compiler.

 It definitely has the C compiler. That is *probably* sufficient for
 compiling Python extensions, but I am not sure.

I can confirm it is (but I don't know if it works as is for python 3.x)

David
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy 1.4.1 fails to build on (Debian) alpha and powepc

2010-07-19 Thread Sandro Tosi
Hi David,
thanks for your reply!

On Mon, Jul 19, 2010 at 20:10, David Cournapeau courn...@gmail.com wrote:
 On Sun, Jul 18, 2010 at 12:53 PM, Sandro Tosi mo...@debian.org wrote:
 Hello,
 I finally found the time to update numpy in Debian. But, there is a 
 problem...

 As you probably know, we support several architectures and we need to
 have any package available on each of them. After the upload I noticed
 numpy has problem building on alpha [1] (ieee754.c compilation error,
 probably related to the conversion from .src) and powerpc [2]
 (long_double identification)

 The alpha issue should be easy to fix: it is just a code path which
 has never been tested so far, but the code is there.

ah if you say so, I trust you :)

 The ppc one is more annoying, and known. The problem is that linux on
 ppc uses the IBM format for long double (sum of two double), which
 requires to implement non trivial, heavily platform dependent code. I
 have just added code to correctly detect the long double format at the
 configure stage.

yes, I see it at r8510

 Do you have shell access to the machines ? It would makes the work
 much easier for me to fix those issues,

Yes, as a Debian developer I have access to a porterbox of any
architecture we support, so I can do any test/recompilation and so you
want. I can understand that using me as a proxy might be a little bit
tedious and slow, so if you prefer to have direct access I have to ask
for it, but it might be refused (I'm not sure), and/or only be
temporary.

Just let me know: I'm fully available for you.

Regards,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Crosstabulation

2010-07-19 Thread eat
Ionut Sandric sandricionut at yahoo.com writes:

 Thank you Zack:
 
 By raster data I mean classified slope gradient (derived from a dem), 
landuse-landcover, lithology etc. A
 crosstabulation analysis will give me a table with the common areas for each 
class from each raster and
 this will go into other analysis. I can do it with other softwares (like 
ArcGIS DEsktop etc), but I would
 like to have all with numpy or to build something on top of numpy
 
 Thanks's again
 
 Ionut
 
 - Original Message -
 From: Zachary Pincus zachary.pincus at yale.edu
 To: Discussion of Numerical Python numpy-discussion at scipy.org
 Sent: Wednesday, July 14, 2010 9:42:49 PM GMT +02:00 Athens, Beirut, 
Bucharest, Istanbul
 Subject: Re: [Numpy-discussion] Crosstabulation
 
 Hi Ionut,
 
 Check out the tabular package:
 http://parsemydata.com/tabular/index.html
 
 It seems to be basically what you want... it does pivot tables (aka  
 crosstabulation), it's built on top of numpy, and has simple data IO  
 tools.
 
 Also check out this discussion on pivot tables from the numpy list a  
 while ago:
 http://mail.scipy.org/pipermail/numpy-discussion/2007-August/028739.html
 
 One question -- what do you mean by raster data? In my arena, that  
 usually means images... and I'm not sure what a crosstabulation on  
 image data would mean!
 
 Zach
 
 On Jul 14, 2010, at 2:28 PM, Ionut Sandric wrote:
 
 
  Sorry, the first email was sent before to finish it...
 
 
  Hi:
 
  I have two raster data and I would like to do a crosstabulation  
  between them and export the results to a table in a text file. Is it  
  possible to do it with NumPy? Does someone have an example?
 
  Thank you,
 
  Ionut
 
 
 
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion at scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion at scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
Hi,

You may be able to adapt this simple script to your case.

import numpy as np

# generate some test data
def gen(b, e, m, n):
return np.arange(b, e+ 1), np.random.randint(b, e+ 1, (m, n))
m, n= 15, 15
c1, d1= gen(0, 3, m, n); print d1
c2, d2= gen(3, 5, m, n); print d2

# perform actual x-tabulation
xtab= np.zeros((len(c1), len(c2)), np.int)
for i in xrange(len(c1)):
tmp= d2[c1[i]== d1]
for j in xrange(len(c2)):
xtab[i, j]= np.sum(c2[j]== tmp)
print xtab, np.sum(xtab)== np.prod(d1.shape)


Anyway it's straightforward to extend it to nd x-tabulations ;-).


My 2 cents,
eat



___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Crosstabulation

2010-07-19 Thread Friedrich Romstedt
2010/7/19 sandric ionut sandricio...@yahoo.com:
 For land-use a class would be for example forest, other would be orchard
 etc. For Slope gradient I would have values which 3 and between 3 and 7
 etc. So, I will have 2 raster data with, let's say, 3 classes each: forest,
 orchards and built-up area and for slope gradient: 0-3, 3-15, 15-35. The
 cross-tabulation analysis should give me a table like:

     forest orchards built-up
 0-3 10 20   15
 3-15   5   10   20
 15-35 5   15           15

 where the numbers represents all the common cells, for example: 10 cells
 with forest correspond to 10 cells with 0-3 slope gradient interval and so
 on
 (by cells I mean the pixel from a raster data)

Okay everything is clear now.  I would suggestest looping over the
cells of the table.  E.g. when:

landuse_catmap
slope_map

are the respective maps, you can categorise the slope_map with

slope_catmap = 0 * (0 = slope_map) * (slope_map  3) + 1 * (3 =
slope_map) * (slope_map  15) + 2 * (15 = slope_map)

to get categories 0, 1, and 2, where the zero case is included here
only for illustration, since it's just zero it can be omitted.

Then you are maybe supposed to do:

table = numpy.zeros((N_slope_cats, N_landuse_cats))

and finally the looping over its elements, where the looping over the
map cells is done entirely by numpy:

for slope_cat in xrange(0, N_slope_cats):
for landuse_cat in xrange(0, N_landuse_cats):
table[slope_cat, landuse_cat] = \
((slope_catmap == slope_cat) * \
(landuse_catmap == landuse_cat)).sum()

I believe there is some slightly faster but more obscure way doing
this table creation in one single large step by putting the maps into
a hyperdimensianal array but I also believe this is beyond our scope
here if this is already fast enough.

Friedrich
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] numpy records in C

2010-07-19 Thread Caius Howcroft
Hi all

I'm playing with writing some C code to speed up an inner loop in my
python code. This loop operates on a numpy record, e.g. soemthing like
this:

a = numpy.zeros((10,), dtype=[(myfvalue ,float), (myc, int8),
(anotheri, uint64)])

which is then passed into c code like so:

myCFunc(a, blah)

I was wondering if someone had an example of how to access particular
columns of a in the C func. Clearly, this is going to involve  a
PyArray_Descr.fields somewhere, but an example would really help make
things clearer for me.

Thanks
Regards

Caius
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy Trac emails

2010-07-19 Thread Vincent Davis
On Sun, Jul 18, 2010 at 10:06 AM, Pauli Virtanen p...@iki.fi wrote:
 Sun, 18 Jul 2010 23:59:24 +0800, Ralf Gommers wrote:

 Scipy Trac seems to work very well now, I get notification emails for
 comments on tickets etc. For numpy Trac, nothing right now. Can this be
 fixed?
I do think that the signup for this is separate for each, I think I
get the emails because I have signed up for the lists at the bottom of
this page.
http://www.scipy.org/Mailing_Lists

Vincent


 Works for me.

 Did you check if your email address is correct there? (- Preferences)

 --
 Pauli Virtanen

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy Trac emails

2010-07-19 Thread Charles R Harris
On Sun, Jul 18, 2010 at 9:59 AM, Ralf Gommers
ralf.gomm...@googlemail.comwrote:

 Scipy Trac seems to work very well now, I get notification emails for
 comments on tickets etc. For numpy Trac, nothing right now. Can this be
 fixed?


I have a different problem, scipy trac sends all my notices to the wrong
address. Even if I unsubscribe and then resubscribe it still uses the wrong
address. Yet it sends the subscription confirmation to the correct address.
Strange. Maybe I need to subscribe as someone else.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy Trac emails

2010-07-19 Thread Ralf Gommers
On Tue, Jul 20, 2010 at 6:55 AM, Charles R Harris charlesr.har...@gmail.com
 wrote:



 On Sun, Jul 18, 2010 at 9:59 AM, Ralf Gommers ralf.gomm...@googlemail.com
  wrote:

 Scipy Trac seems to work very well now, I get notification emails for
 comments on tickets etc. For numpy Trac, nothing right now. Can this be
 fixed?


 I have a different problem, scipy trac sends all my notices to the wrong
 address. Even if I unsubscribe and then resubscribe it still uses the wrong
 address. Yet it sends the subscription confirmation to the correct address.
 Strange. Maybe I need to subscribe as someone else.


 For the record, my problem is fixed. Somehow my real name and email address
were completely blank, reentering them helped.

Ralf
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] comparing floating point numbers

2010-07-19 Thread Ondrej Certik
Hi,

I was always using something like

abs(x-y)  eps

or

(abs(x-y)  eps).all()

but today I needed to also make sure this works for larger numbers,
where I need to compare relative errors, so I found this:

http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

and wrote this:

def feq(a, b, max_relative_error=1e-12, max_absolute_error=1e-12):
a = float(a)
b = float(b)
# if the numbers are close enough (absolutely), then they are equal
if abs(a-b)  max_absolute_error:
return True
# if not, they can still be equal if their relative error is small
if abs(b)  abs(a):
relative_error = abs((a-b)/b)
else:
relative_error = abs((a-b)/a)
return relative_error = max_relative_error


Is there any function in numpy, that implements this? Or maybe even
the better, integer based version, as referenced in the link above?

I need this in tests, where I calculate something on some mesh, then
compare to the correct solution projected on some other mesh, so I
have to deal with accuracy issues.

Ondrej
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] comparing floating point numbers

2010-07-19 Thread Keith Goodman
On Mon, Jul 19, 2010 at 6:31 PM, Ondrej Certik ond...@certik.cz wrote:
 Hi,

 I was always using something like

 abs(x-y)  eps

 or

 (abs(x-y)  eps).all()

 but today I needed to also make sure this works for larger numbers,
 where I need to compare relative errors, so I found this:

 http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

 and wrote this:

 def feq(a, b, max_relative_error=1e-12, max_absolute_error=1e-12):
    a = float(a)
    b = float(b)
    # if the numbers are close enough (absolutely), then they are equal
    if abs(a-b)  max_absolute_error:
        return True
    # if not, they can still be equal if their relative error is small
    if abs(b)  abs(a):
        relative_error = abs((a-b)/b)
    else:
        relative_error = abs((a-b)/a)
    return relative_error = max_relative_error


 Is there any function in numpy, that implements this? Or maybe even
 the better, integer based version, as referenced in the link above?

 I need this in tests, where I calculate something on some mesh, then
 compare to the correct solution projected on some other mesh, so I
 have to deal with accuracy issues.

Is allclose close enough?

np.allclose(a, b, rtol=1.0001e-05, atol=1e-08)

Returns True if two arrays are element-wise equal within a tolerance.

The tolerance values are positive, typically very small numbers.  The
relative difference (`rtol` * abs(`b`)) and the absolute difference
`atol` are added together to compare against the absolute difference
between `a` and `b`.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] lstsq functionality

2010-07-19 Thread Charles R Harris
Hi All,

I'm thinking about adding some functionality to lstsq because I find myself
doing the same fixes over and over. List follows.


   1. Add weights so data points can be weighted.
   2. Use column scaling so condition numbers make more sense.
   3. Compute covariance approximation?

Unfortunately, the last will require using svd since there no linear least
squares routines in LAPACK that also compute the covariance, at least that
google knows about.

Thoughts?

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] lstsq functionality

2010-07-19 Thread Joshua Holbrook
On Mon, Jul 19, 2010 at 5:50 PM, Charles R Harris
charlesr.har...@gmail.com wrote:
 Hi All,

 I'm thinking about adding some functionality to lstsq because I find myself
 doing the same fixes over and over. List follows.

 Add weights so data points can be weighted.
 Use column scaling so condition numbers make more sense.
 Compute covariance approximation?

 Unfortunately, the last will require using svd since there no linear least
 squares routines in LAPACK that also compute the covariance, at least that
 google knows about.

 Thoughts?

 Chuck

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion



Maybe make 2 functions--one which implements 1 and 2, and another
which implements 3? I think weights is an excellent idea!

--Josh
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] lstsq functionality

2010-07-19 Thread Keith Goodman
On Mon, Jul 19, 2010 at 6:53 PM, Joshua Holbrook
josh.holbr...@gmail.com wrote:
 On Mon, Jul 19, 2010 at 5:50 PM, Charles R Harris
 charlesr.har...@gmail.com wrote:
 Hi All,

 I'm thinking about adding some functionality to lstsq because I find myself
 doing the same fixes over and over. List follows.

 Add weights so data points can be weighted.
 Use column scaling so condition numbers make more sense.
 Compute covariance approximation?

 Unfortunately, the last will require using svd since there no linear least
 squares routines in LAPACK that also compute the covariance, at least that
 google knows about.

 Thoughts?

 Maybe make 2 functions--one which implements 1 and 2, and another
 which implements 3? I think weights is an excellent idea!

I'd like a lstsq that did less, like not calculate the sum of squared
residuals. That's useful in tight loops. So I also think having two
lstsq makes sense. One as basic as possible; one with bells. How does
scipy's lstsq fit into all this?
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] lstsq functionality

2010-07-19 Thread Charles R Harris
On Mon, Jul 19, 2010 at 9:02 PM, Keith Goodman kwgood...@gmail.com wrote:

 On Mon, Jul 19, 2010 at 6:53 PM, Joshua Holbrook
 josh.holbr...@gmail.com wrote:
  On Mon, Jul 19, 2010 at 5:50 PM, Charles R Harris
  charlesr.har...@gmail.com wrote:
  Hi All,
 
  I'm thinking about adding some functionality to lstsq because I find
 myself
  doing the same fixes over and over. List follows.
 
  Add weights so data points can be weighted.
  Use column scaling so condition numbers make more sense.
  Compute covariance approximation?
 
  Unfortunately, the last will require using svd since there no linear
 least
  squares routines in LAPACK that also compute the covariance, at least
 that
  google knows about.
 
  Thoughts?
 
  Maybe make 2 functions--one which implements 1 and 2, and another
  which implements 3? I think weights is an excellent idea!

 I'd like a lstsq that did less, like not calculate the sum of squared
 residuals. That's useful in tight loops. So I also think having two
 lstsq makes sense. One as basic as possible; one with bells. How does
 scipy's lstsq fit into all this?
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] lstsq functionality

2010-07-19 Thread Charles R Harris
On Mon, Jul 19, 2010 at 9:02 PM, Keith Goodman kwgood...@gmail.com wrote:

 On Mon, Jul 19, 2010 at 6:53 PM, Joshua Holbrook
 josh.holbr...@gmail.com wrote:
  On Mon, Jul 19, 2010 at 5:50 PM, Charles R Harris
  charlesr.har...@gmail.com wrote:
  Hi All,
 
  I'm thinking about adding some functionality to lstsq because I find
 myself
  doing the same fixes over and over. List follows.
 
  Add weights so data points can be weighted.
  Use column scaling so condition numbers make more sense.
  Compute covariance approximation?
 
  Unfortunately, the last will require using svd since there no linear
 least
  squares routines in LAPACK that also compute the covariance, at least
 that
  google knows about.
 
  Thoughts?
 
  Maybe make 2 functions--one which implements 1 and 2, and another
  which implements 3? I think weights is an excellent idea!

 I'd like a lstsq that did less, like not calculate the sum of squared
 residuals. That's useful in tight loops. So I also think having two
 lstsq makes sense. One as basic as possible; one with bells. How does
 scipy's lstsq fit into all this?


I think the computation of the residues is cheap in lstsq. The algolrithm
used starts by reducing the design matrix to bidiagonal from and reduces the
rhs at the same time. In other words an mxn problem becomes a (n+1)xn
problem. That's why the summed square of residuals is available but not the
individual residuals, after the reduction there is only one residual and its
square it the residue.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] lstsq functionality

2010-07-19 Thread Keith Goodman
On Mon, Jul 19, 2010 at 8:27 PM, Charles R Harris
charlesr.har...@gmail.com wrote:


 On Mon, Jul 19, 2010 at 9:02 PM, Keith Goodman kwgood...@gmail.com wrote:

 On Mon, Jul 19, 2010 at 6:53 PM, Joshua Holbrook
 josh.holbr...@gmail.com wrote:
  On Mon, Jul 19, 2010 at 5:50 PM, Charles R Harris
  charlesr.har...@gmail.com wrote:
  Hi All,
 
  I'm thinking about adding some functionality to lstsq because I find
  myself
  doing the same fixes over and over. List follows.
 
  Add weights so data points can be weighted.
  Use column scaling so condition numbers make more sense.
  Compute covariance approximation?
 
  Unfortunately, the last will require using svd since there no linear
  least
  squares routines in LAPACK that also compute the covariance, at least
  that
  google knows about.
 
  Thoughts?
 
  Maybe make 2 functions--one which implements 1 and 2, and another
  which implements 3? I think weights is an excellent idea!

 I'd like a lstsq that did less, like not calculate the sum of squared
 residuals. That's useful in tight loops. So I also think having two
 lstsq makes sense. One as basic as possible; one with bells. How does
 scipy's lstsq fit into all this?

 I think the computation of the residues is cheap in lstsq. The algolrithm
 used starts by reducing the design matrix to bidiagonal from and reduces the
 rhs at the same time. In other words an mxn problem becomes a (n+1)xn
 problem. That's why the summed square of residuals is available but not the
 individual residuals, after the reduction there is only one residual and its
 square it the residue.

That does sound good. But it must take some time. There's indexing,
array creation, if statement, summing:

if results['rank'] == n and m  n:
resids = sum((transpose(bstar)[n:,:])**2, axis=0).astype(result_t)

Here are the timings after removing the sum of squared residuals:

 x = np.random.rand(1000,10)
 y = np.random.rand(1000)
 timeit np.linalg.lstsq(x, y)
1000 loops, best of 3: 369 us per loop
 timeit np.linalg.lstsq2(x, y)
1000 loops, best of 3: 344 us per loop

 x = np.random.rand(10,2)
 y = np.random.rand(10)
 timeit np.linalg.lstsq(x, y)
1 loops, best of 3: 102 us per loop
 timeit np.linalg.lstsq2(x, y)
1 loops, best of 3: 77 us per loop
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] lstsq functionality

2010-07-19 Thread Charles R Harris
On Mon, Jul 19, 2010 at 9:40 PM, Keith Goodman kwgood...@gmail.com wrote:

 On Mon, Jul 19, 2010 at 8:27 PM, Charles R Harris
 charlesr.har...@gmail.com wrote:
 
 
  On Mon, Jul 19, 2010 at 9:02 PM, Keith Goodman kwgood...@gmail.com
 wrote:
 
  On Mon, Jul 19, 2010 at 6:53 PM, Joshua Holbrook
  josh.holbr...@gmail.com wrote:
   On Mon, Jul 19, 2010 at 5:50 PM, Charles R Harris
   charlesr.har...@gmail.com wrote:
   Hi All,
  
   I'm thinking about adding some functionality to lstsq because I find
   myself
   doing the same fixes over and over. List follows.
  
   Add weights so data points can be weighted.
   Use column scaling so condition numbers make more sense.
   Compute covariance approximation?
  
   Unfortunately, the last will require using svd since there no linear
   least
   squares routines in LAPACK that also compute the covariance, at least
   that
   google knows about.
  
   Thoughts?
  
   Maybe make 2 functions--one which implements 1 and 2, and another
   which implements 3? I think weights is an excellent idea!
 
  I'd like a lstsq that did less, like not calculate the sum of squared
  residuals. That's useful in tight loops. So I also think having two
  lstsq makes sense. One as basic as possible; one with bells. How does
  scipy's lstsq fit into all this?
 
  I think the computation of the residues is cheap in lstsq. The algolrithm
  used starts by reducing the design matrix to bidiagonal from and reduces
 the
  rhs at the same time. In other words an mxn problem becomes a (n+1)xn
  problem. That's why the summed square of residuals is available but not
 the
  individual residuals, after the reduction there is only one residual and
 its
  square it the residue.

 That does sound good. But it must take some time. There's indexing,
 array creation, if statement, summing:

if results['rank'] == n and m  n:
resids = sum((transpose(bstar)[n:,:])**2,
 axis=0).astype(result_t)

 Here are the timings after removing the sum of squared residuals:

  x = np.random.rand(1000,10)
  y = np.random.rand(1000)
  timeit np.linalg.lstsq(x, y)
 1000 loops, best of 3: 369 us per loop
  timeit np.linalg.lstsq2(x, y)
 1000 loops, best of 3: 344 us per loop
 
  x = np.random.rand(10,2)
  y = np.random.rand(10)
  timeit np.linalg.lstsq(x, y)
 1 loops, best of 3: 102 us per loop
  timeit np.linalg.lstsq2(x, y)
 1 loops, best of 3: 77 us per loop
 _


Now that I've looked through the driver program I see that you are right.
Also, all the info needed for the covariance is almost available in the
LAPACK driver program. Hmm, it seems that maybe the best thing to do here is
to pull out the lapack_lite driver program, modify it, and make it a
standalone python module that links to either the lapack_lite programs or
the ATLAS versions.  But that is more work than just doing things in python
:-\ It does have the added advantage that all the work arrays can be handled
internally.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion