| 7 Oct 21:39

Merge of generalised ufuncs branch

Hi all,

The generalised ufuncs branch was made available before SciPy'08.  We
solicited comments on its implementation and structuring, but received
very little feedback.  Unless there are any further comments from the
community, I propose that we merge it.

It is unfortunate that we have so many patches waiting for review
(SciPy suffers worst, I'm afraid); clearly there are too few hours in
a day.  Nothing discourages contributions as much as a stale project,
and I hope we can avoid that.

Regards,
Stéfan
John Harrold | 7 Oct 21:22

ImportError: No module named ma

Howdy,

I'm trying to run some scripts associated with a paper I was reading. They use
the matplotlib to generate figures which in turn calles numpy. I'm new to
python, but I'm very familiar with perl. I'm getting the following error, and
I'm not quite sure what is causing it. Can anyone here offer any suggestions?

jmh <at> dhcp068-156:$ python2.5  Bb-plot.py 
Traceback (most recent call last):
  File "Bb-plot.py", line 7, in <module>
    from pylab import *
  File "/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5.egg/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File
"/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5.egg/matplotlib/__init__.py",
line 128, in <module>
    from rcsetup import defaultParams, validate_backend, validate_toolbar
  File "/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5.egg/matplotlib/rcsetup.py",
line 19, in <module>
    from matplotlib.colors import is_color_like
  File "/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5.egg/matplotlib/colors.py",
line 39, in <module>
    import matplotlib.cbook as cbook
  File "/Library/Python/2.5/site-packages/matplotlib-0.98.3-py2.5.egg/matplotlib/cbook.py",
line 9, in <module>
    import numpy.ma as ma
ImportError: No module named ma

--

-- 
 John M Harrold              
(Continue reading)

paul taney | 7 Oct 20:27

collecting the bluest pixels

Hi,

I have this silly color filter that Stefan gave me:

def vanderwalt(image, f):
    """colorfilter, thanks to Stefan van der Walt"""
    RED, GRN, BLU = 0, 1, 2
    bluemask = (image[...,BLU] > f*image[...,GRN]) & \
               (image[...,BLU] > f*image[...,RED])

    return bluemask

To collect the right number of the bluest pixels I am calling it from this arduous successive approximation
routine.  It occured to me that someone on this list knows how to do this in a couple of lines...

def successive_approximation(image, density, width, height, bpp):
    """keep calling vanderwalt till line length is within 10% of density target"""
    count = 0
    failsafe = 20  # max iterations
    gimp.progress_init("this is the fun part...")
    init_high = 1.400001
    init_low = 1.399991
    high_guesses = [(init_high, width*height*bpp)]  # we collect recent stats in this list
    low_guesses  = [(init_low, 0)]
    crossed_high = crossed_low = False
    factor = 1.4
    delta_high = .18   # adjust the factor by this much when it is too high
    delta_low = .14    # adjust the factor by this much when it is too low 
                       # if they were the same amount then they"d cancel
    xlength = 0
(Continue reading)

Paul Lucek | 7 Oct 19:40

can't build numpy 1.2.0 under python 2.6 (windows-amd64) using VS9

I get the following errors in umathmodule.c.src:

 

D:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nolog

o /Ox /MD /W3 /GS- /DNDEBUG -Ibuild\src.win-amd64-2.6\numpy\core\src -Inumpy\cor

e\include -Ibuild\src.win-amd64-2.6\numpy\core\include/numpy -Inumpy\core\src -I

numpy\core\include -Id:\python26\include -Id:\python26\PC /Tcbuild\src.win-amd64

-2.6\numpy\core\src\umathmodule.c /Fobuild\temp.win-amd64-2.6\Release\build\src.

win-amd64-2.6\numpy\core\src\umathmodule.obj

umathmodule.c

numpy\core\src\umathmodule.c.src(64) : error C2059: syntax error : 'type'

numpy\core\src\umathmodule.c.src(70) : error C2059: syntax error : 'type'

numpy\core\src\ufuncobject.c(1701) : warning C4244: '=' : conversion from 'npy_i

ntp' to 'int', possible loss of data

numpy\core\src\ufuncobject.c(2422) : warning C4244: '=' : conversion from 'npy_i

ntp' to 'int', possible loss of data

error: Command "D:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\

cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ibuild\src.win-amd64-2.6\numpy\core

\src -Inumpy\core\include -Ibuild\src.win-amd64-2.6\numpy\core\include/numpy -In

umpy\core\src -Inumpy\core\include -Id:\python26\include -Id:\python26\PC /Tcbui

ld\src.win-amd64-2.6\numpy\core\src\umathmodule.c /Fobuild\temp.win-amd64-2.6\Re

lease\build\src.win-amd64-2.6\numpy\core\src\umathmodule.obj" failed with exit s

tatus 2

 

 

 

 

 

 

 

 

 

 

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion <at> scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Nadav Horesh | 7 Oct 05:45

Re: Scipy in Python 2.6


Scipy from svn compiles with python2.6 with no problem. Problems that came later:
1. Could not install packages of scikits: I got a strange error about unknown name: log
2. When trying to run from "idle" warnings become errors. I think that is a bug of idle.

  Nadav.

-----הודעה מקורית-----
מאת: jah [mailto:jah.mailinglist <at> gmail.com]
נשלח: ג 07-אוקטובר-08 00:45
אל: Nadav Horesh
נושא: Scipy in Python 2.6

Hi Nadav,

I saw:

http://projects.scipy.org/pipermail/numpy-discussion/2008-July/035968.html

where you reported some compilation problems with scipy in Python 2.6.  Did
you resolve this issue?  Do you have any knowledge if the current svn still
has this problem?

Thanks

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion <at> scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
John | 6 Oct 21:29

multi-comparison expressions

hi,

why does the ValueError appear below, and how can i make that 2<a<5 
expression work when a is an array?

thanks.

 >>> from numpy import reshape,arange
 >>> a=reshape(arange(9),(3,3))
 >>> a
array([[0, 1, 2],
      [3, 4, 5],
      [6, 7, 8]])
 >>> 2<a
array([[False, False, False],
      [ True,  True,  True],
      [ True,  True,  True]], dtype=bool)
 >>> a<5
array([[ True,  True,  True],
      [ True,  True, False],
      [False, False, False]], dtype=bool)
 >>> 2<a<5
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ValueError: The truth value of an array with more than one element is 
ambiguous. Use a.any() or a.all()

nor does it work with constant arrays:

 >>> from numpy import zeros
 >>> twos=zeros(a.shape)+2
 >>> fives=zeros(a.shape)+5
 >>> twos<a
array([[False, False, False],
      [ True,  True,  True],
      [ True,  True,  True]], dtype=bool)
 >>> a<fives
array([[ True,  True,  True],
      [ True,  True, False],
      [False, False, False]], dtype=bool)
 >>> twos<a<fives
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ValueError: The truth value of an array with more than one element is 
ambiguous. Use a.any() or a.all()

but it works with builtin numbers:

 >>> b=3
 >>> 2<b<5
True
Roeland Huys | 6 Oct 09:57

install without admin rights


Hi,

I am very interested in my work to switch from Matlab to Numpy.  However,
I want to test some algorithms first.
I tried to install NumPy on one of our corporate servers.  However, I do
not have root access, so i did following:

tar -xvzf numpy-1.2.0.tar.gz   [OK]
cd numpy-1.2.0
python setup.py build   [OK]
set PYTHONPATH=$HOME/pythonlib
mv numpy ~/pythonlib
python
import numpy   [ FAILS!]

Could you tell me how I can install NumPy on my local account, (without
admin rights) ?

Thanks,

Roeland.
Jarrod Millman | 6 Oct 04:59

Please backport fixes to the 1.2.x branch

Hello,

I would like to get a 1.2.1 release out ASAP.  There are several
bug-fixes on the trunk that need to be backported.  If you have made a
bug-fix to the trunk that you have been waiting to backport to the
1.2.x branch, please do so now:
http://svn.scipy.org/svn/numpy/branches/1.2.x

Ideally, I would like to freeze the branch for the 1.2.1 release in
about 1 week.  Please let me know if you need more time or if there is
something in particular that you would like to see backported.

Thanks,

--

-- 
Jarrod Millman
Computational Infrastructure for Research Labs
10 Giannini Hall, UC Berkeley
phone: 510.643.4014
http://cirl.berkeley.edu/
T J | 5 Oct 22:52

Test failures on 2.6

Hi,

I'm getting a couple of test failures with Python 2.6, Numpy 1.2.0, Nose 0.10.4:

nose version 0.10.4
..........................................................................................................................................................................................................................................................................................................................................................................................................................................F................K....................................................................................................................................................................................................................................................................................................................................................................
 ..............................................................................................................................................................................................
 ......./share/home/me/usr/lib/python2.6/site-packages/numpy/lib/tests/test_io.py:68:
SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(c.readlines(),
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................./share/home/me/usr/lib/python2.6/site-packages/numpy/ma/tests/test_core.py:1315:
SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(store._mask, True)
/home/me/usr/lib/python2.6/site-packages/numpy/ma/tests/test_core.py:1322:
SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(store._mask, True)
/home/me/usr/lib/python2.6/site-packages/numpy/ma/tests/test_core.py:1989:
SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert(test.mask, [0,1,0,0,0,0,0,0,0,0])
...............................................E................................................................................................................................................................................
======================================================================
ERROR: Tests the min/max functions with explicit outputs
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/me/usr/lib/python2.6/site-packages/numpy/ma/tests/test_core.py",
line 653, in test_minmax_funcs_with_output
    result = npfunc(xm,axis=0,out=nout)
  File "/home/me/usr/lib/python2.6/site-packages/numpy/core/fromnumeric.py",
line 1525, in amin
    return amin(axis, out)
  File "/home/me/usr/lib/python2.6/site-packages/numpy/ma/core.py",
line 2978, in min
    np.putmask(out, newmask, np.nan)
ValueError: cannot convert float NaN to integer

======================================================================
FAIL: test_umath.TestComplexFunctions.test_against_cmath
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/me/usr/lib/python2.6/site-packages/nose-0.10.4-py2.6.egg/nose/case.py",
line 182, in runTest
    self.test(*self.arg)
  File "/home/me/usr/lib/python2.6/site-packages/numpy/core/tests/test_umath.py",
line 268, in test_against_cmath
    assert abs(a - b) < atol, "%s %s: %s; cmath: %s"%(fname,p,a,b)
AssertionError: arcsin 2: (1.57079632679-1.31695789692j); cmath:
(1.57079632679+1.31695789692j)

----------------------------------------------------------------------
Ran 1726 tests in 8.856s

FAILED (KNOWNFAIL=1, errors=1, failures=1)
<nose.result.TextTestResult run=1726 errors=1 failures=1>
dmitrey | 5 Oct 11:29

asscalar(number) - why yields error, why can't return the number?!

hi all,
I wonder why numpy.asscalar(1.5) yields error, why it can't just return 
1.5? Is it intended to be ever changed?

 >>> numpy.__version__
'1.3.0.dev5864'

D.
David Cournapeau | 5 Oct 10:25

Merged clean_math_config branch

Hi there,

    Just to mention that I merged back my changes from the
clean_math_config branch into trunk. The main point of the branch is to
clean our math configuration. If this causes problems, please report it.
I  built and tested on mac os x, linux 32 bits and windows (both mingw32
and VS 2003). It breaks windows 64 bits ATM, but this will be fixed
soon. The numscons built is broken as well, but the missing features are
already backported from numpy.distutils to numscons; a new working
version of numscons is about to be released.

Some details for the record:
    - more code is platform independent, with platform specifics math
functions at one location
    - instead of platform-specific heuristics, every function is tested
at the configuration stage. Some distutils.command.config
functionalities were improved to make this process as fast as before for
relatively standard-compliant platforms (mac os X and linux are as fast
to build as before).
    - the distutils.command.config.check_func can now detect MS
intrinsics (functions which are not visible without optimization flags).
    - should also be more robust for non standard platforms (MS
compilers, mostly).

In the process, a few hundred lines of C code have been removed.
cheers,

David

Gmane