Re: [Numpy-discussion] ragged array implimentation

2011-03-12 Thread Christopher Barker
Francesc Alted wrote:
 Just a C pointer to a malloc'ed area (it cannot be an ndarray, as the 
 data area might be compressed).

got it.

 Ok.  Thanks.  The code is really simple, and that's great.  However, 
 carray is quite more sophisticated, as it supports not only enlarging 
 arrays, but also shrinking,

that's handy.

 and since 0.4 on, it also supports n-
 dimensional arrays (although you can only resize along the first 
 dimension).

I've been meaning to add that, too - not much to it really, but haven't 
had a need yet, so haven't gotten around to it.

I hope it was a bit helpful, and I'm looking forward to seeing what's 
next for carray!

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

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


[Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Nadav Horesh
Having numpy, scipy, and matplotlib working reasonably with python3, a major 
piece of code I miss for a major python3 migration is an image IO. I found that 
pylab's imread works fine for png image, but I need to read all the other image 
format as well as png and jpeg output.

 Any hints (including advices how easyly construct my own module) are 
appreciated.

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


Re: [Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Christoph Gohlke


On 3/12/2011 1:08 AM, Nadav Horesh wrote:
 Having numpy, scipy, and matplotlib working reasonably with python3, a
 major piece of code I miss for a major python3 migration is an image IO.
 I found that pylab's imread works fine for png image, but I need to read
 all the other image format as well as png and jpeg output.
 Any hints (including advices how easyly construct my own module) are
 appreciated.
 Nadav.


On Windows, PIL (private port at 
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil), PythonMagick 
http://www.imagemagick.org/download/python/, and pygame 1.9.2pre 
http://www.pygame.org are working reasonably well for image IO. Also 
the FreeImage library http://freeimage.sourceforge.net/ is easy to use 
with ctypes http://docs.python.org/py3k/library/ctypes.html.

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


Re: [Numpy-discussion] how to compile Fortran using setup.py

2011-03-12 Thread Pearu Peterson
On Fri, Mar 11, 2011 at 3:58 AM, Ondrej Certik ond...@certik.cz wrote:

 Hi,

 I spent about an hour googling and didn't figure this out. Here is my
 setup.py:

 setup(
name = libqsnake,
cmdclass = {'build_ext': build_ext},
version = 0.1,
packages = [
'qsnake',
'qsnake.calculators',
'qsnake.calculators.tests',
'qsnake.data',
'qsnake.mesh2d',
'qsnake.tests',
],
package_data = {
'qsnake.tests': ['phaml_data/domain.*'],
},
include_dirs=[numpy.get_include()],
ext_modules = [Extension(qsnake.cmesh, [
qsnake/cmesh.pyx,
qsnake/fmesh.f90,
])],
description = Qsnake standard library,
license = BSD,
 )


You can specify Fortran code, that you don't want to process with f2py, in
the libraries list
and then use the corresponding library in the extension, for example:

setup(...
   libraries = [('foo', dict(sources=['qsnake/fmesh.f90']))],
   ext_modules = [Extension(qsnake.cmesh,
  sources =
[qsnake/cmesh.pyx],
  libraries = ['foo']
)],
  ...
)

See also scipy/integrate/setup.py that resolves the same issue but just
using the configuration function approach.

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


Re: [Numpy-discussion] how to compile Fortran using setup.py

2011-03-12 Thread David Cournapeau
On Fri, Mar 11, 2011 at 1:57 AM, Ondrej Certik ond...@certik.cz wrote:
 On Thu, Mar 10, 2011 at 8:25 PM, Robert Kern robert.k...@gmail.com wrote:
 On Thu, Mar 10, 2011 at 19:58, Ondrej Certik ond...@certik.cz wrote:
 Hi,

 I spent about an hour googling and didn't figure this out. Here is my 
 setup.py:

 setup(
    name = libqsnake,
    cmdclass = {'build_ext': build_ext},
    version = 0.1,
    packages = [
        'qsnake',
        'qsnake.calculators',
        'qsnake.calculators.tests',
        'qsnake.data',
        'qsnake.mesh2d',
        'qsnake.tests',
        ],
    package_data = {
        'qsnake.tests': ['phaml_data/domain.*'],
        },
    include_dirs=[numpy.get_include()],
    ext_modules = [Extension(qsnake.cmesh, [
        qsnake/cmesh.pyx,
        qsnake/fmesh.f90,
        ])],
    description = Qsnake standard library,
    license = BSD,
 )

 The qsnake.cmesh extension needs to compile .pyx into .c and later to
 .o, it needs to use gfortran to compile fmesh.f90 to fmesh.o, and then
 link both things. That's it. In other words, this is what I want
 distutils to do:

 $ cython cmesh.pyx
 $ gcc -fPIC -o cmesh.o -c cmesh.c -I$SPKG_LOCAL/include/python2.6
 -I$SPKG_LOCAL/lib/python2.6/site-packages/numpy/core/include
 $ gfortran -fPIC -o fmesh.o -c fmesh.f90
 $ gcc -shared -o cmesh.so cmesh.o fmesh.o

 Difficult if sticking with distutils of any flavor. You would have
 probably to replace the build_ext command to handle both the Fortran
 and the Cython. You may want to give David Cournapeau's Bento a try:

  http://pypi.python.org/pypi/bento/

 Thanks Robert. I burned most of my today's evening on this, trying to
 replace the command, but so far I didn't figure it out. It is indeed
 difficult, but I wasn't sure, whether it is because I am not so
 familiar with distutils.

 I looked at bento, but I'll simply stick to cmake. I thought that for
 a Python package (that uses cython + C or fortran, which I thought is
 a pretty standard configuration for scientific computing), I would use
 distutils, just like other Python packages.

The initial reason why I started bento is because this is practically
impossible: distutils is very adverse to changes, and you cannot
easily change this (I know because that's exactly what numscons was).

For example, if you generate a cmake file from distutils, you will
quickly realize that getting the necessary data is not easy - if you
create a build_cmake, you still need install options, but those are
not  fully available before install is run (you can do some very
horrible hacks to get most of them by copying running commands).
Instead bento is based around the usual configure/build/install ala
autoconf, where all the options are resolved after configure.

I am not pretending that bento can solve all your issues, but you can
*today* build non trivial python packages with it, including metadata,
eggs and windows installers. And there is already a proof of concept
to use either distutils compiler classes, waf and a custom build tool
without the need to customize anything outside the build phase (i.e.
install is exactly the same and does not even need to know about
build).

As for supporting setup.py, I have started something in that direction:

http://cournape.wordpress.com/2011/03/06/adding-a-distutils-compatibility-layer-to-bento/

cheers,

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


Re: [Numpy-discussion] assert_almost_equal bug?

2011-03-12 Thread Ralf Gommers
On Sat, Mar 12, 2011 at 12:10 AM, Keith Goodman kwgood...@gmail.com wrote:
 assert_almost_equal() and assert_array_almost_equal() raise a
 ValueError instead of an AssertionError when the array contains
 np.inf:

That's a bug, is fixed in 45269ee1. assert_array_compare was checking
for nans but not for infs.

Cheers,
Ralf



 a = np.array([[1., 2.], [3., 4.]])
 b = a.copy()
 np.testing.assert_almost_equal(a, b)
 b[0,0] = np.inf
 np.testing.assert_almost_equal(a, b)
 snip
 ValueError:
 Arrays are not almost equal
  x: array([[ 1.,  2.],
       [ 3.,  4.]])
  y: array([[ inf,   2.],
       [  3.,   4.]])
 np.testing.assert_array_almost_equal(a, b)
 snip
 ValueError:
 Arrays are not almost equal
  x: array([[ 1.,  2.],
       [ 3.,  4.]])
  y: array([[ inf,   2.],
       [  3.,   4.]])

 ticket: http://projects.scipy.org/numpy/ticket/1769
 ___
 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] Structured array copying by field name (was: Numpy 1.6 schedule)

2011-03-12 Thread Ralf Gommers
On Sat, Mar 12, 2011 at 6:51 AM, Benjamin Root ben.r...@ou.edu wrote:


 On Fri, Mar 11, 2011 at 2:20 PM, Mark Wiebe mwwi...@gmail.com wrote:

 On Fri, Mar 11, 2011 at 1:07 AM, Ralf Gommers
 ralf.gomm...@googlemail.com wrote:

 On Tue, Mar 8, 2011 at 1:35 AM, Pauli Virtanen p...@iki.fi wrote:
 
  Structured array copying copies by field name.
 
  Commit 22d96096bf7d5fb199ca80f2fcd04e8d27815476
 
  Before:
 
  x = np.array([(0, 1)], dtype=[('a', int), ('b', int)])
  y = np.array([(2, 3)], dtype=[('a', int), ('b', int)])
  y = np.array([(2, 3)], dtype=[('b', int), ('a', int)])
  x[:] = y
  x
  array([(2, 3)],
       dtype=[('a', 'i4'), ('b', 'i4')])
 
  After:
 
  x = np.array([(0, 1)], dtype=[('a', int), ('b', int)])
  y = np.array([(2, 3)], dtype=[('b', int), ('a', int)])
  x[:] = y
  x
  array([(3, 2)],
       dtype=[('a', 'i4'), ('b', 'i4')])
 
  This seems like a pretty hazardous change. Granted, it's in
  a bit of a grey area, but people may rely on this.

 This is still backwards incompatible in current master. Should it be
 changed back for 1.6?

 I strongly dislike the behavior in 1.5 and earlier, for reasons such as
 the example given here:
 http://mail.scipy.org/pipermail/numpy-discussion/2011-March/055214.html
 No problems so far have been traced back to this change, indicating that
 this type of assignment was previously utilized very little, so I'm strongly
 in favor of keeping it in. Based on my knowledge of the code, I'm pretty
 sure it's a significant performance improvement as well.
 -Mark

 Ditto on this.

If no problems turn up and no one objects, I am also okay with keeping
it in. Either way, I don't think this needs to be resolved before the
release of the first beta.

Cheers,
Ralf


 However, it isn't like this is fully featured anyway.
 Consider the following:

 x = np.array([(0, 1.1)], dtype=[('a', int), ('b', float)])
 y = np.array([(2.1, 4)], dtype=[('b', float), ('a', int)])

 print x + y

 Traceback (most recent call last):
   File stdin, line 1, in module
 TypeError: unsupported operand type(s) for +: 'numpy.ndarray' and
 'numpy.ndarray'

 So, how much has people been relying on either behaviors, given that basic
 math operations weren't permissible in a similar manner?  I doubt either
 approaches would be that noticeable.

 Note, I would love to be able to do the above eventually.  I see a lot of
 uses for labeled arrays, especially for in the matplotlib library.  I
 personally use the larry package from time to time.

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


Re: [Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Zachary Pincus
Here's a ctypes interface to FreeImage that I wrote a while back and  
was since cleaned up (and maintained) by the scikits.image folk:

https://github.com/stefanv/scikits.image/blob/master/scikits/image/io/_plugins/freeimage_plugin.py

If it doesn't work out of the box on python 3, then it should be  
pretty simple to fix.

Zach



On Mar 12, 2011, at 4:40 AM, Christoph Gohlke wrote:



 On 3/12/2011 1:08 AM, Nadav Horesh wrote:
 Having numpy, scipy, and matplotlib working reasonably with  
 python3, a
 major piece of code I miss for a major python3 migration is an  
 image IO.
 I found that pylab's imread works fine for png image, but I need to  
 read
 all the other image format as well as png and jpeg output.
 Any hints (including advices how easyly construct my own module) are
 appreciated.
 Nadav.


 On Windows, PIL (private port at
 http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil), PythonMagick
 http://www.imagemagick.org/download/python/, and pygame 1.9.2pre
 http://www.pygame.org are working reasonably well for image IO. Also
 the FreeImage library http://freeimage.sourceforge.net/ is easy to  
 use
 with ctypes http://docs.python.org/py3k/library/ctypes.html.

 Christoph
 ___
 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] Using ndpointer with ctypes argtypes

2011-03-12 Thread Josh Mayer
I found a solution that works. What I did was I wrote a custom class
to define the argtypes. The from_param(obj) method calls ndpointer
when it is a numpy array or if obj is none it returns a null pointer.

On Fri, Mar 11, 2011 at 1:25 PM, Josh Mayer joshuaama...@gmail.com wrote:
 I am trying to call a C function that takes a double array as one of
 its parameters.

 I am using ndpointer to define the argtypes so that I can pass a numpy
 array directly.  The issue I'm having is that this parameter need not
 always be set, and when it is not set, the C functions expects a null
 pointer to a double in it's place. Is there any way I can set up a
 numpy array such that when ndpointer calls from_param() it returns a
 null pointer? Or is there some other way to go about it?

 Thanks

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


Re: [Numpy-discussion] assert_almost_equal bug?

2011-03-12 Thread Keith Goodman
On Sat, Mar 12, 2011 at 4:16 AM, Ralf Gommers
ralf.gomm...@googlemail.com wrote:
 On Sat, Mar 12, 2011 at 12:10 AM, Keith Goodman kwgood...@gmail.com wrote:
 assert_almost_equal() and assert_array_almost_equal() raise a
 ValueError instead of an AssertionError when the array contains
 np.inf:

 That's a bug, is fixed in 45269ee1. assert_array_compare was checking
 for nans but not for infs.

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


Re: [Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Nadav Horesh
I forgot to mention that I work on linux (gentoo x86-64).Here are my 
achievements till now:

1. PythonMagick: Needs boost which I do not have it avaiable on python3
2. Pygame: I have the stable version(1.9.1) should it work?
3. FreeImage: I installed FreeImagePy on python3, but it doesn't work yet.
4. PIL: I patched setup.py and map.c so python3 setup.py build is working, 
but:

nadav@nadav_home /dev/shm/PIL-1.1.7-py3 $ sudo python3.1  setup.py install
/usr/lib64/python3.1/distutils/dist.py:259: UserWarning: Unknown distribution 
option: 'ext_comp_args'
  warnings.warn(msg)
running install
running build
running build_py
running build_ext

PIL 1.1.7 SETUP SUMMARY

version   1.1.7
platform  linux2 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
  [GCC 4.4.4]

--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
--- LITTLECMS support available

.
.
.

byte-compiling /usr/lib64/python3.1/site-packages/PIL/WalImageFile.py to 
WalImageFile.pyc
Traceback (most recent call last):
  File setup.py, line 520, in module
setup(*(), **configuration)  # old school :-)
  File /usr/lib64/python3.1/distutils/core.py, line 149, in setup
dist.run_commands()
  File /usr/lib64/python3.1/distutils/dist.py, line 919, in run_commands
self.run_command(cmd)
  File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
cmd_obj.run()
  File /usr/lib64/python3.1/distutils/command/install.py, line 592, in run
self.run_command(cmd_name)
  File /usr/lib64/python3.1/distutils/cmd.py, line 315, in run_command
self.distribution.run_command(command)
  File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
cmd_obj.run()
  File /usr/lib64/python3.1/distutils/command/install_lib.py, line 98, in run
self.byte_compile(outfiles)
  File /usr/lib64/python3.1/distutils/command/install_lib.py, line 135, in 
byte_compile
dry_run=self.dry_run)
  File /usr/lib64/python3.1/distutils/util.py, line 560, in byte_compile
compile(file, cfile, dfile)
  File /usr/lib64/python3.1/py_compile.py, line 137, in compile
codestring = f.read()
  File /usr/lib64/python3.1/codecs.py, line 300, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 1909: 
invalid continuation byte



Any idea on how to correct it? Any elegant way to avoid byte compiling?

  Nadav



From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
On Behalf Of Zachary Pincus [zachary.pin...@yale.edu]
Sent: 12 March 2011 14:35
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] [OT] any image io module that works with
python3?

Here's a ctypes interface to FreeImage that I wrote a while back and
was since cleaned up (and maintained) by the scikits.image folk:

https://github.com/stefanv/scikits.image/blob/master/scikits/image/io/_plugins/freeimage_plugin.py

If it doesn't work out of the box on python 3, then it should be
pretty simple to fix.

Zach



On Mar 12, 2011, at 4:40 AM, Christoph Gohlke wrote:



 On 3/12/2011 1:08 AM, Nadav Horesh wrote:
 Having numpy, scipy, and matplotlib working reasonably with
 python3, a
 major piece of code I miss for a major python3 migration is an
 image IO.
 I found that pylab's imread works fine for png image, but I need to
 read
 all the other image format as well as png and jpeg output.
 Any hints (including advices how easyly construct my own module) are
 appreciated.
 Nadav.


 On Windows, PIL (private port at
 http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil), PythonMagick
 http://www.imagemagick.org/download/python/, and pygame 1.9.2pre
 http://www.pygame.org are working reasonably well for image IO. Also
 the FreeImage library http://freeimage.sourceforge.net/ is easy to
 use
 with ctypes http://docs.python.org/py3k/library/ctypes.html.

 Christoph
 ___
 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

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


[Numpy-discussion] Inplace remove some array rows

2011-03-12 Thread Dmitrey
 hi all,
   currently I use
   a = array(m,n)
   ...
   a = delete(a, indices, 0) # delete some rows

   Can I somehow perform the operation in-place, without creating
   auxiliary array?
   If I'll use

   numpy.compress(condition, a, axis=0, out=a),
   or
   numpy.take(a, indices, axis=0, out=a)

   will the operation be inplace?

   Thank you in advance,
   D.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Inplace remove some array rows

2011-03-12 Thread David Warde-Farley

On 2011-03-12, at 12:43 PM, Dmitrey wrote:

 hi all,
 currently I use
 a = array(m,n)
 ...
 a = delete(a, indices, 0) # delete some rows
 
 Can I somehow perform the operation in-place, without creating auxiliary 
 array?
 If I'll use
 
 numpy.compress(condition, a, axis=0, out=a),
 or
 numpy.take(a, indices, axis=0, out=a)
 
 will the operation be inplace?


a will be the wrong shape to hold the output of either of those operations. You 
could use a[:len(indices)], and that will be in-place, though it looks like 
numpy makes a temporary copy internally to avoid conflicts when the input array 
and output array share memory (at least in the case of take()). I was expecting

In [15]: a = arange(50).reshape(10, 5)

In [16]: numpy.take(a,[2,0,1],axis=0, out=a[:3])

to place 3 copies of original row 2 in rows 0, 1 and 2. The fact that it 
doesn't seems to suggest NumPy is being more clever (but also more 
memory-hungry).

David

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


Re: [Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Christoph Gohlke


On 3/12/2011 8:45 AM, Nadav Horesh wrote:
 I forgot to mention that I work on linux (gentoo x86-64).Here are my 
 achievements till now:

 1. PythonMagick: Needs boost which I do not have it avaiable on python3
Boost works on Python 3.1. You might need to compile it.
 2. Pygame: I have the stable version(1.9.1) should it work?
You need the developer version from svn.
 3. FreeImage: I installed FreeImagePy on python3, but it doesn't work yet.
FreeImagePy is unmaintained, does not work on Python 3, and has problems 
on 64 bit platforms. Just wrap the functions you need in ctypes.
 4. PIL: I patched setup.py and map.c so python3 setup.py build is working, 
 but:
Try replace Hans Häggström with Hans Haggstrom in PIL/WalImageFile.py

Christoph


 nadav@nadav_home /dev/shm/PIL-1.1.7-py3 $ sudo python3.1  setup.py install
 /usr/lib64/python3.1/distutils/dist.py:259: UserWarning: Unknown distribution 
 option: 'ext_comp_args'
warnings.warn(msg)
 running install
 running build
 running build_py
 running build_ext
 
 PIL 1.1.7 SETUP SUMMARY
 
 version   1.1.7
 platform  linux2 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
[GCC 4.4.4]
 
 --- TKINTER support available
 --- JPEG support available
 --- ZLIB (PNG/ZIP) support available
 --- FREETYPE2 support available
 --- LITTLECMS support available

 .
 .
 .

 byte-compiling /usr/lib64/python3.1/site-packages/PIL/WalImageFile.py to 
 WalImageFile.pyc
 Traceback (most recent call last):
File setup.py, line 520, inmodule
  setup(*(), **configuration)  # old school :-)
File /usr/lib64/python3.1/distutils/core.py, line 149, in setup
  dist.run_commands()
File /usr/lib64/python3.1/distutils/dist.py, line 919, in run_commands
  self.run_command(cmd)
File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
  cmd_obj.run()
File /usr/lib64/python3.1/distutils/command/install.py, line 592, in run
  self.run_command(cmd_name)
File /usr/lib64/python3.1/distutils/cmd.py, line 315, in run_command
  self.distribution.run_command(command)
File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
  cmd_obj.run()
File /usr/lib64/python3.1/distutils/command/install_lib.py, line 98, in 
 run
  self.byte_compile(outfiles)
File /usr/lib64/python3.1/distutils/command/install_lib.py, line 135, in 
 byte_compile
  dry_run=self.dry_run)
File /usr/lib64/python3.1/distutils/util.py, line 560, in byte_compile
  compile(file, cfile, dfile)
File /usr/lib64/python3.1/py_compile.py, line 137, in compile
  codestring = f.read()
File /usr/lib64/python3.1/codecs.py, line 300, in decode
  (result, consumed) = self._buffer_decode(data, self.errors, final)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 1909: 
 invalid continuation byte



 Any idea on how to correct it? Any elegant way to avoid byte compiling?

Nadav


 
 From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
 On Behalf Of Zachary Pincus [zachary.pin...@yale.edu]
 Sent: 12 March 2011 14:35
 To: Discussion of Numerical Python
 Subject: Re: [Numpy-discussion] [OT] any image io module that works with  
   python3?

 Here's a ctypes interface to FreeImage that I wrote a while back and
 was since cleaned up (and maintained) by the scikits.image folk:

 https://github.com/stefanv/scikits.image/blob/master/scikits/image/io/_plugins/freeimage_plugin.py

 If it doesn't work out of the box on python 3, then it should be
 pretty simple to fix.

 Zach



 On Mar 12, 2011, at 4:40 AM, Christoph Gohlke wrote:



 On 3/12/2011 1:08 AM, Nadav Horesh wrote:
 Having numpy, scipy, and matplotlib working reasonably with
 python3, a
 major piece of code I miss for a major python3 migration is an
 image IO.
 I found that pylab's imread works fine for png image, but I need to
 read
 all the other image format as well as png and jpeg output.
 Any hints (including advices how easyly construct my own module) are
 appreciated.
 Nadav.


 On Windows, PIL (private port at
 http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil), PythonMagick
 http://www.imagemagick.org/download/python/, and pygame 1.9.2pre
 http://www.pygame.org  are working reasonably well for image IO. Also
 the FreeImage libraryhttp://freeimage.sourceforge.net/  is easy to
 use
 with ctypeshttp://docs.python.org/py3k/library/ctypes.html.

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

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 

Re: [Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Nadav Horesh
It started to work after processing it with 2to3 and omitting the conversion of 
file names with the str function (I supply the file names as bytes).
Issues:
  1. It refuses to save in jpeg format
  2. There is a worning of possible segfult on 64 bit machine (which is the 
target platform).

I'll keep on test it.

 Thank you
Nadav.


From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
On Behalf Of Zachary Pincus [zachary.pin...@yale.edu]
Sent: 12 March 2011 14:35
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] [OT] any image io module that works with
python3?

Here's a ctypes interface to FreeImage that I wrote a while back and
was since cleaned up (and maintained) by the scikits.image folk:

https://github.com/stefanv/scikits.image/blob/master/scikits/image/io/_plugins/freeimage_plugin.py

If it doesn't work out of the box on python 3, then it should be
pretty simple to fix.

Zach



On Mar 12, 2011, at 4:40 AM, Christoph Gohlke wrote:



 On 3/12/2011 1:08 AM, Nadav Horesh wrote:
 Having numpy, scipy, and matplotlib working reasonably with
 python3, a
 major piece of code I miss for a major python3 migration is an
 image IO.
 I found that pylab's imread works fine for png image, but I need to
 read
 all the other image format as well as png and jpeg output.
 Any hints (including advices how easyly construct my own module) are
 appreciated.
 Nadav.


 On Windows, PIL (private port at
 http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil), PythonMagick
 http://www.imagemagick.org/download/python/, and pygame 1.9.2pre
 http://www.pygame.org are working reasonably well for image IO. Also
 the FreeImage library http://freeimage.sourceforge.net/ is easy to
 use
 with ctypes http://docs.python.org/py3k/library/ctypes.html.

 Christoph
 ___
 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
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Nadav Horesh
After the  replacement of ö with o, the installation went without errors, but:

nadav@nadav_home ~ $ python3
Python 3.1.3 (r313:86834, Feb 25 2011, 11:08:33) 
[GCC 4.4.4] on linux2
Type help, copyright, credits or license for more information.
 import _imaging
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: /usr/lib64/python3.1/site-packages/PIL/_imaging.so: undefined 
symbol: Py_FindMethod

 Thank you,

Nadav.

From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
On Behalf Of Christoph Gohlke [cgoh...@uci.edu]
Sent: 12 March 2011 21:49
To: numpy-discussion@scipy.org
Subject: Re: [Numpy-discussion] [OT] any image io module that   works   with
python3?

On 3/12/2011 8:45 AM, Nadav Horesh wrote:
 I forgot to mention that I work on linux (gentoo x86-64).Here are my 
 achievements till now:

 1. PythonMagick: Needs boost which I do not have it avaiable on python3
Boost works on Python 3.1. You might need to compile it.
 2. Pygame: I have the stable version(1.9.1) should it work?
You need the developer version from svn.
 3. FreeImage: I installed FreeImagePy on python3, but it doesn't work yet.
FreeImagePy is unmaintained, does not work on Python 3, and has problems
on 64 bit platforms. Just wrap the functions you need in ctypes.
 4. PIL: I patched setup.py and map.c so python3 setup.py build is working, 
 but:
Try replace Hans Häggström with Hans Haggstrom in PIL/WalImageFile.py

Christoph


 nadav@nadav_home /dev/shm/PIL-1.1.7-py3 $ sudo python3.1  setup.py install
 /usr/lib64/python3.1/distutils/dist.py:259: UserWarning: Unknown distribution 
 option: 'ext_comp_args'
warnings.warn(msg)
 running install
 running build
 running build_py
 running build_ext
 
 PIL 1.1.7 SETUP SUMMARY
 
 version   1.1.7
 platform  linux2 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
[GCC 4.4.4]
 
 --- TKINTER support available
 --- JPEG support available
 --- ZLIB (PNG/ZIP) support available
 --- FREETYPE2 support available
 --- LITTLECMS support available

 .
 .
 .

 byte-compiling /usr/lib64/python3.1/site-packages/PIL/WalImageFile.py to 
 WalImageFile.pyc
 Traceback (most recent call last):
File setup.py, line 520, inmodule
  setup(*(), **configuration)  # old school :-)
File /usr/lib64/python3.1/distutils/core.py, line 149, in setup
  dist.run_commands()
File /usr/lib64/python3.1/distutils/dist.py, line 919, in run_commands
  self.run_command(cmd)
File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
  cmd_obj.run()
File /usr/lib64/python3.1/distutils/command/install.py, line 592, in run
  self.run_command(cmd_name)
File /usr/lib64/python3.1/distutils/cmd.py, line 315, in run_command
  self.distribution.run_command(command)
File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
  cmd_obj.run()
File /usr/lib64/python3.1/distutils/command/install_lib.py, line 98, in 
 run
  self.byte_compile(outfiles)
File /usr/lib64/python3.1/distutils/command/install_lib.py, line 135, in 
 byte_compile
  dry_run=self.dry_run)
File /usr/lib64/python3.1/distutils/util.py, line 560, in byte_compile
  compile(file, cfile, dfile)
File /usr/lib64/python3.1/py_compile.py, line 137, in compile
  codestring = f.read()
File /usr/lib64/python3.1/codecs.py, line 300, in decode
  (result, consumed) = self._buffer_decode(data, self.errors, final)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 1909: 
 invalid continuation byte



 Any idea on how to correct it? Any elegant way to avoid byte compiling?

Nadav


 
 From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
 On Behalf Of Zachary Pincus [zachary.pin...@yale.edu]
 Sent: 12 March 2011 14:35
 To: Discussion of Numerical Python
 Subject: Re: [Numpy-discussion] [OT] any image io module that works with  
   python3?

 Here's a ctypes interface to FreeImage that I wrote a while back and
 was since cleaned up (and maintained) by the scikits.image folk:

 https://github.com/stefanv/scikits.image/blob/master/scikits/image/io/_plugins/freeimage_plugin.py

 If it doesn't work out of the box on python 3, then it should be
 pretty simple to fix.

 Zach



 On Mar 12, 2011, at 4:40 AM, Christoph Gohlke wrote:



 On 3/12/2011 1:08 AM, Nadav Horesh wrote:
 Having numpy, scipy, and matplotlib working reasonably with
 python3, a
 major piece of code I miss for a major python3 migration is an
 image IO.
 I found that pylab's imread works fine for png image, but I need to
 read
 all the other image format as well as png and jpeg output.
 Any hints (including advices how 

[Numpy-discussion] import error after compiling from HEAD

2011-03-12 Thread Joshua Holbrook
Sup y'all,

I just installed numpy from github, but when I tried to import it I
got some odd errors! What's going on, and how can it be fixed?


josh@pidgey:~$ python -c 'import numpy; numpy.test()'
Traceback (most recent call last):
  File string, line 1, in module
  File /usr/local/lib/python2.6/dist-packages/numpy/__init__.py,
line 137, in module

  File /usr/local/lib/python2.6/dist-packages/numpy/add_newdocs.py,
line 9, in module
from numpy.lib import add_newdoc
  File /usr/local/lib/python2.6/dist-packages/numpy/lib/__init__.py,
line 4, in module
#
  File /usr/local/lib/python2.6/dist-packages/numpy/lib/type_check.py,
line 8, in module
  File /usr/local/lib/python2.6/dist-packages/numpy/core/__init__.py,
line 10, in module
#
ImportError: No module named _sort


Thanks,

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


Re: [Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Christoph Gohlke


On 3/12/2011 12:47 PM, Nadav Horesh wrote:
 After the  replacement of ö with o, the installation went without errors, but:

 nadav@nadav_home ~ $ python3
 Python 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
 [GCC 4.4.4] on linux2
 Type help, copyright, credits or license for more information.
 import _imaging
 Traceback (most recent call last):
File stdin, line 1, inmodule
 ImportError: /usr/lib64/python3.1/site-packages/PIL/_imaging.so: undefined 
 symbol: Py_FindMethod

Py_FindMethod should be excluded by `#ifndef PY3` or similar 
preprocessor statements. There is a typo in map.c line 65: change 
`#ifdef PY3` to `#ifndef PY3` and clean your build directory before 
rebuilding.

Christoph


   Thank you,

  Nadav.
 
 From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
 On Behalf Of Christoph Gohlke [cgoh...@uci.edu]
 Sent: 12 March 2011 21:49
 To: numpy-discussion@scipy.org
 Subject: Re: [Numpy-discussion] [OT] any image io module that   works   with  
   python3?

 On 3/12/2011 8:45 AM, Nadav Horesh wrote:
 I forgot to mention that I work on linux (gentoo x86-64).Here are my 
 achievements till now:

 1. PythonMagick: Needs boost which I do not have it avaiable on python3
 Boost works on Python 3.1. You might need to compile it.
 2. Pygame: I have the stable version(1.9.1) should it work?
 You need the developer version from svn.
 3. FreeImage: I installed FreeImagePy on python3, but it doesn't work yet.
 FreeImagePy is unmaintained, does not work on Python 3, and has problems
 on 64 bit platforms. Just wrap the functions you need in ctypes.
 4. PIL: I patched setup.py and map.c so python3 setup.py build is working, 
 but:
 Try replace Hans Häggström with Hans Haggstrom in PIL/WalImageFile.py

 Christoph


 nadav@nadav_home /dev/shm/PIL-1.1.7-py3 $ sudo python3.1  setup.py install
 /usr/lib64/python3.1/distutils/dist.py:259: UserWarning: Unknown 
 distribution option: 'ext_comp_args'
 warnings.warn(msg)
 running install
 running build
 running build_py
 running build_ext
 
 PIL 1.1.7 SETUP SUMMARY
 
 version   1.1.7
 platform  linux2 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
 [GCC 4.4.4]
 
 --- TKINTER support available
 --- JPEG support available
 --- ZLIB (PNG/ZIP) support available
 --- FREETYPE2 support available
 --- LITTLECMS support available

 .
 .
 .

 byte-compiling /usr/lib64/python3.1/site-packages/PIL/WalImageFile.py to 
 WalImageFile.pyc
 Traceback (most recent call last):
 File setup.py, line 520, inmodule
   setup(*(), **configuration)  # old school :-)
 File /usr/lib64/python3.1/distutils/core.py, line 149, in setup
   dist.run_commands()
 File /usr/lib64/python3.1/distutils/dist.py, line 919, in run_commands
   self.run_command(cmd)
 File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
   cmd_obj.run()
 File /usr/lib64/python3.1/distutils/command/install.py, line 592, in 
 run
   self.run_command(cmd_name)
 File /usr/lib64/python3.1/distutils/cmd.py, line 315, in run_command
   self.distribution.run_command(command)
 File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
   cmd_obj.run()
 File /usr/lib64/python3.1/distutils/command/install_lib.py, line 98, 
 in run
   self.byte_compile(outfiles)
 File /usr/lib64/python3.1/distutils/command/install_lib.py, line 135, 
 in byte_compile
   dry_run=self.dry_run)
 File /usr/lib64/python3.1/distutils/util.py, line 560, in byte_compile
   compile(file, cfile, dfile)
 File /usr/lib64/python3.1/py_compile.py, line 137, in compile
   codestring = f.read()
 File /usr/lib64/python3.1/codecs.py, line 300, in decode
   (result, consumed) = self._buffer_decode(data, self.errors, final)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 1909: 
 invalid continuation byte



 Any idea on how to correct it? Any elegant way to avoid byte compiling?

 Nadav


 
 From: numpy-discussion-boun...@scipy.org 
 [numpy-discussion-boun...@scipy.org] On Behalf Of Zachary Pincus 
 [zachary.pin...@yale.edu]
 Sent: 12 March 2011 14:35
 To: Discussion of Numerical Python
 Subject: Re: [Numpy-discussion] [OT] any image io module that works with 
python3?

 Here's a ctypes interface to FreeImage that I wrote a while back and
 was since cleaned up (and maintained) by the scikits.image folk:

 https://github.com/stefanv/scikits.image/blob/master/scikits/image/io/_plugins/freeimage_plugin.py

 If it doesn't work out of the box on python 3, then it should be
 pretty simple to fix.

 Zach



 On Mar 12, 2011, at 4:40 AM, Christoph Gohlke wrote:



 On 3/12/2011 1:08 AM, Nadav Horesh 

[Numpy-discussion] Not importing polynomial implementation functions by default

2011-03-12 Thread Charles R Harris
Hi All,

I'd like to change the polynomial package to only import the Classes,
leaving the large number of implementation functions to be imported directly
from the different modules if needed. I always regarded those functions as
implementation helpers and kept them separate from the class so that others
could use them to build their own classes if they desired. For most purposes
I think the classes are more useful. So I think it was a mistake to import
the functions by; default and I'm looking for a graceful and acceptable way
out. Any suggestions.

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


[Numpy-discussion] Call for GSoC 2011 NumPy mentors

2011-03-12 Thread Jarrod Millman
Hi,

It is time to start preparing for the 2011 Google Summer of Code
(SoC).  As in the past, we will participate in SoC with the Python
Software Foundation (PSF) as our mentoring organization.  The PSF has
requested that every project, which wishes to participate in the SoC,
provide a list of at least *three* potential mentors.

If you are interested and willing to potentially mentor someone this
summer to work on NumPy, please send me the following information by
Monday evening: Name, Email, Phone, and Link_ID.

You can find additional information on the 2011 SoC homepage:
  http://socghop.appspot.com/

Here is the PSF SoC page:
  http://wiki.python.org/moin/SummerOfCode

Please start thinking about potential projects and add them to the SoC
ideas page:
  http://projects.scipy.org/scipy/wiki/SummerofCodeIdeas

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


Re: [Numpy-discussion] Not importing polynomial implementation functions by default

2011-03-12 Thread David Warde-Farley

On 2011-03-12, at 9:32 PM, Charles R Harris wrote:

 I'd like to change the polynomial package to only import the Classes, leaving 
 the large number of implementation functions to be imported directly from the 
 different modules if needed. I always regarded those functions as 
 implementation helpers and kept them separate from the class so that others 
 could use them to build their own classes if they desired. For most purposes 
 I think the classes are more useful. So I think it was a mistake to import 
 the functions by; default and I'm looking for a graceful and acceptable way 
 out. Any suggestions.


I hope this wouldn't include polyfit, polyval, roots and vander at least (I'd 
also be -1 on removing poly{add,sub,mul,div,der,int}, but more weakly so). 
Those 4 seem useful and basic enough to leave in the default namespace. 

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


Re: [Numpy-discussion] [OT] any image io module that works with python3?

2011-03-12 Thread Nadav Horesh
This lead to another error probably due to line 68 in map.h. As much as I could 
trace it, ob_type is a member of PyObject,  not of PyTypeObject. I have no clue 
how to resolve this.

Nadav.

From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
On Behalf Of Christoph Gohlke [cgoh...@uci.edu]
Sent: 13 March 2011 00:37
To: numpy-discussion@scipy.org
Subject: Re: [Numpy-discussion] [OT] any image io   module  thatworks   
withpython3?

On 3/12/2011 12:47 PM, Nadav Horesh wrote:
 After the  replacement of ö with o, the installation went without errors, but:

 nadav@nadav_home ~ $ python3
 Python 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
 [GCC 4.4.4] on linux2
 Type help, copyright, credits or license for more information.
 import _imaging
 Traceback (most recent call last):
File stdin, line 1, inmodule
 ImportError: /usr/lib64/python3.1/site-packages/PIL/_imaging.so: undefined 
 symbol: Py_FindMethod

Py_FindMethod should be excluded by `#ifndef PY3` or similar
preprocessor statements. There is a typo in map.c line 65: change
`#ifdef PY3` to `#ifndef PY3` and clean your build directory before
rebuilding.

Christoph


   Thank you,

  Nadav.
 
 From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
 On Behalf Of Christoph Gohlke [cgoh...@uci.edu]
 Sent: 12 March 2011 21:49
 To: numpy-discussion@scipy.org
 Subject: Re: [Numpy-discussion] [OT] any image io module that   works   with  
   python3?

 On 3/12/2011 8:45 AM, Nadav Horesh wrote:
 I forgot to mention that I work on linux (gentoo x86-64).Here are my 
 achievements till now:

 1. PythonMagick: Needs boost which I do not have it avaiable on python3
 Boost works on Python 3.1. You might need to compile it.
 2. Pygame: I have the stable version(1.9.1) should it work?
 You need the developer version from svn.
 3. FreeImage: I installed FreeImagePy on python3, but it doesn't work yet.
 FreeImagePy is unmaintained, does not work on Python 3, and has problems
 on 64 bit platforms. Just wrap the functions you need in ctypes.
 4. PIL: I patched setup.py and map.c so python3 setup.py build is working, 
 but:
 Try replace Hans Häggström with Hans Haggstrom in PIL/WalImageFile.py

 Christoph


 nadav@nadav_home /dev/shm/PIL-1.1.7-py3 $ sudo python3.1  setup.py install
 /usr/lib64/python3.1/distutils/dist.py:259: UserWarning: Unknown 
 distribution option: 'ext_comp_args'
 warnings.warn(msg)
 running install
 running build
 running build_py
 running build_ext
 
 PIL 1.1.7 SETUP SUMMARY
 
 version   1.1.7
 platform  linux2 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
 [GCC 4.4.4]
 
 --- TKINTER support available
 --- JPEG support available
 --- ZLIB (PNG/ZIP) support available
 --- FREETYPE2 support available
 --- LITTLECMS support available

 .
 .
 .

 byte-compiling /usr/lib64/python3.1/site-packages/PIL/WalImageFile.py to 
 WalImageFile.pyc
 Traceback (most recent call last):
 File setup.py, line 520, inmodule
   setup(*(), **configuration)  # old school :-)
 File /usr/lib64/python3.1/distutils/core.py, line 149, in setup
   dist.run_commands()
 File /usr/lib64/python3.1/distutils/dist.py, line 919, in run_commands
   self.run_command(cmd)
 File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
   cmd_obj.run()
 File /usr/lib64/python3.1/distutils/command/install.py, line 592, in 
 run
   self.run_command(cmd_name)
 File /usr/lib64/python3.1/distutils/cmd.py, line 315, in run_command
   self.distribution.run_command(command)
 File /usr/lib64/python3.1/distutils/dist.py, line 938, in run_command
   cmd_obj.run()
 File /usr/lib64/python3.1/distutils/command/install_lib.py, line 98, 
 in run
   self.byte_compile(outfiles)
 File /usr/lib64/python3.1/distutils/command/install_lib.py, line 135, 
 in byte_compile
   dry_run=self.dry_run)
 File /usr/lib64/python3.1/distutils/util.py, line 560, in byte_compile
   compile(file, cfile, dfile)
 File /usr/lib64/python3.1/py_compile.py, line 137, in compile
   codestring = f.read()
 File /usr/lib64/python3.1/codecs.py, line 300, in decode
   (result, consumed) = self._buffer_decode(data, self.errors, final)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 1909: 
 invalid continuation byte



 Any idea on how to correct it? Any elegant way to avoid byte compiling?

 Nadav


 
 From: numpy-discussion-boun...@scipy.org 
 [numpy-discussion-boun...@scipy.org] On Behalf Of Zachary Pincus 
 [zachary.pin...@yale.edu]
 Sent: 12 March 2011 14:35
 To: Discussion of Numerical Python
 Subject: