[Numpy-discussion] how to loop read input over various file with same extension in a folder (newbie question)
BB, Currently I am reading a text file and storing the output as an array a1, some arithmetic operation on it and plotting it. I want to do the same over 1000 files. How to loop it and how to store the input in different arrays like a2, a3 and so on. Also advise what is the best way to TAG or assign a comment to an array to store which file it has read the data. Cheers Sachin Sachin Kumar Sharma Senior Geomodeler ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] how to delete a particular column or row from numpy array based on some rule or value
BB, In a numpy array of m x n size, I would like to delete few rows when a given element in that row is 'nan' or say any other value. For e.g. as in example given below, if I wish to delete a row when the 3rd element of row is zero, or if 3rd, 4th, 5th element are zero or either of 3rd, 4th and 5th element is zero. array([[ 1900. , nan, nan, nan, nan, nan], [ 1900.5, nan, nan, nan, nan, nan], [ 1901. , nan, nan, nan, nan, nan], ..., [ 6724. , nan, nan, nan, nan, nan], [ 6724.5, nan, nan, nan, nan, nan], [ 6725. , nan, nan, nan, nan, nan]]) Cheers Sachin Sachin Kumar Sharma Senior Geomodeler ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] how to loop read input over various file with same extension in a folder (newbie question)
One way is to use python dicts. Pseudocode: arrays = {} integer = 0 for file in allfiles: integer +=1 data = file.read() arrays['a' + '%d' % integer] = data I would consider using the filename as the key instead of a1, a2, etc. That way you have that information readily available as well. Good luck, Paul. On 24. mars 2011, at 08.27, Sachin Kumar Sharma wrote: BB, Currently I am reading a text file and storing the output as an array a1, some arithmetic operation on it and plotting it. I want to do the same over 1000 files. How to loop it and how to store the input in different arrays like a2, a3 and so on. Also advise what is the best way to TAG or assign a comment to an array to store which file it has read the data. Cheers Sachin Sachin Kumar Sharma Senior Geomodeler ___ 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] how to loop read input over various file with same extension in a folder (newbie question)
Paul, Appreciate your reply. Cheers Sachin Sachin Kumar Sharma Senior Geomodeler -Original Message- From: numpy-discussion-boun...@scipy.org [mailto:numpy-discussion-boun...@scipy.org] On Behalf Of Paul Anton Letnes Sent: Thursday, March 24, 2011 3:54 PM To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] how to loop read input over various file with same extension in a folder (newbie question) One way is to use python dicts. Pseudocode: arrays = {} integer = 0 for file in allfiles: integer +=1 data = file.read() arrays['a' + '%d' % integer] = data I would consider using the filename as the key instead of a1, a2, etc. That way you have that information readily available as well. Good luck, Paul. On 24. mars 2011, at 08.27, Sachin Kumar Sharma wrote: BB, Currently I am reading a text file and storing the output as an array a1, some arithmetic operation on it and plotting it. I want to do the same over 1000 files. How to loop it and how to store the input in different arrays like a2, a3 and so on. Also advise what is the best way to TAG or assign a comment to an array to store which file it has read the data. Cheers Sachin Sachin Kumar Sharma Senior Geomodeler ___ 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] ANN: Numpy 1.6.0 beta 1
On Thu, Mar 24, 2011 at 2:04 AM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 24 Mar 2011, at 00:34, Derek Homeier wrote: tests with the fink-installed pythons on MacOS X mostly succeeded, with one failure in python2.4 and a couple of issues seemingly related to PPC floating point accuracy, as below: Probably last update for tonight: with the 'full' test suite, there's one additional failure and error, respectively under 10.5/ppc and 10.6/x86_64 (in all Python versions): PowerPC: FAIL: test_kind.TestKind.test_all -- Traceback (most recent call last): File /sw/lib/python2.5/site-packages/nose/case.py, line 187, in runTest self.test(*self.arg) File /sw/lib/python2.5/site-packages/numpy/f2py/tests/test_kind.py, line 30, in test_all 'selectedrealkind(%s): expected %r but got %r' % (i, selected_real_kind(i), selectedrealkind(i))) File /sw/lib/python2.5/site-packages/numpy/testing/utils.py, line 34, in assert_ raise AssertionError(msg) AssertionError: selectedrealkind(16): expected 10 but got 16 Regarding this test failure, could you hack the numpy/f2py/tests/test_kind.py script by adding the following code for i in range(20): print '%s - %s, %s' % (i, selected_real_kind(i), selectedrealkind(i)) and send me the output? Also, what Fortran compiler version has been used to build the test modules? Intel-64bit: ERROR: test_assumed_shape.TestAssumedShapeSumExample.test_all -- Traceback (most recent call last): File /sw/lib/python3.2/site-packages/nose/case.py, line 372, in setUp try_run(self.inst, ('setup', 'setUp')) File /sw/lib/python3.2/site-packages/nose/util.py, line 478, in try_run return func() File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 352, in setUp module_name=self.module_name) File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 73, in wrapper memo[key] = func(*a, **kw) File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 134, in build_module % (cmd[4:], asstr(out))) RuntimeError: Running f2py failed: ['-m', '_test_ext_module_5403', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/foo_free.f90', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/foo_use.f90', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/precision.f90'] Reading .f2py_f2cmap ... Mapping real(kind=rk) to double Hmm, this should not happen as real(kind=rk) should be mapped to float. It seems that you have .f2py_f2cmap file lying around. Could you remove it and try again. Pearu ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] ANN: Numpy 1.6.0 beta 1
On Thu, Mar 24, 2011 at 10:11 AM, Pearu Peterson pearu.peter...@gmail.comwrote: Regarding this test failure, could you hack the numpy/f2py/tests/test_kind.py script by adding the following code for i in range(20): print '%s - %s, %s' % (i, selected_real_kind(i), selectedrealkind(i)) and send me the output? Also, what Fortran compiler version has been used to build the test modules? Even better, you can report the result to http://projects.scipy.org/numpy/ticket/1767 Pearu ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] how to delete a particular column or row from numpy array based on some rule or value
On Thu, Mar 24, 2011 at 1:12 PM, Sachin Kumar Sharma ssharm...@slb.comwrote: BB, In a numpy array of m x n size, I would like to delete few rows when a given element in that row is ‘nan’ or say any other value. For e.g. as in example given below, if I wish to delete a row when the 3 rd element of row is zero, or if 3rd, 4th, 5th element are zero or either of 3rd, 4th and 5th element is zero. array([[ 1900. , nan, nan, nan, nan, nan], [ 1900.5, nan, nan, nan, nan, nan], [ 1901. , nan, nan, nan, nan, nan], ..., [ 6724. , nan, nan, nan, nan, nan], [ 6724.5, nan, nan, nan, nan, nan], [ 6725. , nan, nan, nan, nan, nan]]) Cheers Sachin* * * Sachin Kumar Sharma* Senior Geomodeler ** ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion I think u can use numpy.loadtext command http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html -- DILEEPKUMAR. R J R F, IIT DELHI ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs
hi, when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs I tried to install numpy from PYPI where 1.5.1 seesm to be present, but somehow it involves 1.3.0 instead: $ sudo easy_install numpy install_dir /usr/local/lib/python2.6/dist-packages/ Searching for numpy Best match: numpy 1.3.0 Adding numpy 1.3.0 to easy-install.pth file only after aptitude remove python-numpy version 1.5.1. is involved by easy_install, but it fails: $ sudo easy_install numpy Adding numpy 1.5.1 to easy-install.pth file Installing f2py script to /usr/local/bin Installed /usr/local/lib/python2.6/dist-packages/numpy-1.5.1-py2.6-linux-x86_64.egg Processing dependencies for numpy Finished processing dependencies for numpy /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py:251: RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import Error in atexit._run_exitfuncs: Traceback (most recent call last): File /usr/lib/python2.6/atexit.py, line 24, in _run_exitfuncs func(*targs, **kargs) File /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py, line 251, in clean_up_temporary_directory ImportError: No module named numpy.distutils Error in sys.exitfunc: Traceback (most recent call last): File /usr/lib/python2.6/atexit.py, line 24, in _run_exitfuncs func(*targs, **kargs) File /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py, line 251, in clean_up_temporary_directory ImportError: No module named numpy.distutils I have Linux KUBUNTU 10.10 D. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] should get rid of the annoying numpy STDERR output
from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value encountered in multiply nan My cycled calculations yields this thousands times slowing computations and making text output completely non-readable. from numpy import __version__ __version__ '2.0.0.dev-1fe8136' D. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs
Isnt [K]Ubuntu updated each 6 month? 2011/3/24 Dmitrey tm...@ukr.net: hi, when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs There will always be bugs, but numpy 1.3 is a stable release, unless there is a bug that affects what your doing right now? If you find a bug that prevents you from from your specific work, better report that bug, if you haven't already. I tried to install numpy from PYPI where 1.5.1 seesm to be present, but somehow it involves 1.3.0 instead: $ sudo easy_install numpy install_dir /usr/local/lib/python2.6/dist-packages/ Searching for numpy Best match: numpy 1.3.0 Adding numpy 1.3.0 to easy-install.pth file only after aptitude remove python-numpy version 1.5.1. is involved by easy_install, but it fails: $ sudo easy_install numpy Adding numpy 1.5.1 to easy-install.pth file Installing f2py script to /usr/local/bin Installed /usr/local/lib/python2.6/dist-packages/numpy-1.5.1-py2.6-linux-x86_64.egg Processing dependencies for numpy Finished processing dependencies for numpy /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py:251: RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import I see an *absolute* import, maybe easy_install is different from where ubuntu expects numpy to be installed? i think the folder distutils is specific for ubuntu ? try and remove manually the egg in /usr/local/lib/python2.6/dist-packages/numpy-1.5.1-py2.6-linux-x86_64.egg then do $ sudo easy_install -U numpy -U is for update, maybe you have to run without -U first? Error in atexit._run_exitfuncs: Traceback (most recent call last): File /usr/lib/python2.6/atexit.py, line 24, in _run_exitfuncs func(*targs, **kargs) File /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py, line 251, in clean_up_temporary_directory ImportError: No module named numpy.distutils Error in sys.exitfunc: Traceback (most recent call last): File /usr/lib/python2.6/atexit.py, line 24, in _run_exitfuncs func(*targs, **kargs) File /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py, line 251, in clean_up_temporary_directory ImportError: No module named numpy.distutils I have Linux KUBUNTU 10.10 D. Good question.. ? easy_install should be distribution non-specific(as far as i know) see also this thread, even though its old. (late 2009) http://old.nabble.com/numpy-1.3.0-eggs-with-python2.6-seem-broken-on-osx,-and-linux-td26551531.html so maybe then download only the egg(with easy_install), then enter the folder and do sudo python2.6 setup.py install Dont you have python 2.7 also on ubuntu? regards mic ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output
Hi 2011/3/24 Dmitrey tm...@ukr.net from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value encountered in multiply nan My cycled calculations yields this thousands times slowing computations and making text output completely non-readable. Would old= seterr(invalid= 'ignore') be sufficient for you? Regards, eat from numpy import __version__ __version__ '2.0.0.dev-1fe8136' D. ___ 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] should get rid of the annoying numpy STDERR output
Hi 2011/3/24 Dmitrey tm...@ukr.net from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value encountered in multiply nan My cycled calculations yields this thousands times slowing computations and making text output completely non-readable. Would old= seterr(invalid= 'ignore') be sufficient for you? yes for me, but I'm not sure for all those users who use my soft. Maybe it will hide some bugs in their objective functions and nonlinear constraints in numerical optimization and nonlinear equation systems. D. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs
Isnt [K]Ubuntu updated each 6 month? 2011/3/24 Dmitrey tm...@ukr.net : hi, when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs There will always be bugs, but numpy 1.3 is a stable release, unless there is a bug that affects what your doing right now? If you find a bug that prevents you from from your specific work, better report that bug, if you haven't already. I tried to install numpy from PYPI where 1.5.1 seesm to be present, but somehow it involves 1.3.0 instead: $ sudo easy_install numpy install_dir /usr/local/lib/python2.6/dist-packages/ Searching for numpy Best match: numpy 1.3.0 Adding numpy 1.3.0 to easy-install.pth file only after aptitude remove python-numpy version 1.5.1. is involved by easy_install, but it fails: $ sudo easy_install numpy Adding numpy 1.5.1 to easy-install.pth file Installing f2py script to /usr/local/bin Installed /usr/local/lib/python2.6/dist-packages/numpy-1.5.1-py2.6-linux-x86_64.egg Processing dependencies for numpy Finished processing dependencies for numpy /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py:251: RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import I see an *absolute* import, maybe easy_install is different from where ubuntu expects numpy to be installed? i think the folder distutils is specific for ubuntu ? try and remove manually the egg in /usr/local/lib/python2.6/dist-packages/numpy-1.5.1-py2.6-linux-x86_64.egg then do $ sudo easy_install -U numpy -U is for update, maybe you have to run without -U first? Error in atexit._run_exitfuncs: Traceback (most recent call last): File /usr/lib/python2.6/atexit.py, line 24, in _run_exitfuncs func(*targs, **kargs) File /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py, line 251, in clean_up_temporary_directory ImportError: No module named numpy.distutils Error in sys.exitfunc: Traceback (most recent call last): File /usr/lib/python2.6/atexit.py, line 24, in _run_exitfuncs func(*targs, **kargs) File /tmp/easy_install-QF6uJM/numpy-1.5.1/numpy/distutils/misc_util.py, line 251, in clean_up_temporary_directory ImportError: No module named numpy.distutils I have Linux KUBUNTU 10.10 D. Good question.. ? easy_install should be distribution non-specific(as far as i know) see also this thread, even though its old. (late 2009) http://old.nabble.com/numpy-1.3.0-eggs-with-python2.6-seem-broken-on-osx,-and-linux-td26551531.html so maybe then download only the egg(with easy_install), then enter the folder and do sudo python2.6 setup.py install Dont you have python 2.7 also on ubuntu? regards mic ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion Thanks for all those instructions, however, personally I don't need them, I have sucseeded with my own manipulations and even if I wouldn't I always can build numpy/scipy from sources. I mere care for quality and easibility of numpy installation for ordinary non-skilled users. They may just try installation, see that it's buggy and move away to use another soft. D. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] [NumPy-Tickets] [NumPy] #971: numpy.memmap 'offset' parameter docs are almost entirely wrong.
Hi, I got an Internal Error message when trying to log into the Trac page. My comment: Could there at least be a note added to the current memmap doc string, stating that there is a problem with the current doc; also a link to http://projects.scipy.org/numpy/ticket/97 would be much better than nothing. My 2 cents, Sebastian Haase On Thu, Mar 24, 2011 at 1:58 AM, numpy-tick...@scipy.org wrote: #971: numpy.memmap 'offset' parameter docs are almost entirely wrong. ---+ Reporter: 0ion9 | Owner: pv Type: defect | Status: new Priority: normal | Milestone: Unscheduled Component: Documentation | Version: devel Keywords: | ---+ Changes (by mwiebe): * milestone: = Unscheduled -- Ticket URL: http://projects.scipy.org/numpy/ticket/971#comment:3 NumPy http://projects.scipy.org/numpy My example project ___ NumPy-Tickets mailing list numpy-tick...@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-tickets ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] argmin and argmax without nan
hi, is there any way to get argmin and argmax of an array w/o nans? Currently I have from numpy import * argmax([10,nan,100]) 1 argmin([10,nan,100]) 1 But it's not the values I would like to get. The walkaround I use: get all indeces of nans, replace them by -inf, get argmax, replace them by inf, get argmin. Is there any better way? (BTW, I invoke argmin/argmax along of a chosen axis) D. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] argmin and argmax without nan
2011/3/24 Dmitrey tm...@ukr.net: hi, is there any way to get argmin and argmax of an array w/o nans? Currently I have from numpy import * argmax([10,nan,100]) 1 argmin([10,nan,100]) 1 But it's not the values I would like to get. The walkaround I use: get all indeces of nans, replace them by -inf, get argmax, replace them by inf, get argmin. Is there any better way? (BTW, I invoke argmin/argmax along of a chosen axis) D. In [3]: np.nanargmax([10, np.nan, 100]) Out[3]: 2 In [4]: np.nanargmin([10, np.nan, 100]) Out[4]: 0 Ralf ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs
Thanks for all those instructions, however, personally I don't need them, I have sucseeded with my own manipulations and even if I wouldn't I always can build numpy/scipy from sources. I mere care for quality and easibility of numpy installation for ordinary non-skilled users. They may just try installation, see that it's buggy and move away to use another soft. Rest assured that non-ordinary users like me also get irritated when we have to do extra work to get something to work/install when we want to try something out, its a waste of our time and resources if we have to do it often. Those problems might always be there in some degree, i have numpy installed on debian, fedora, and archlinux. Where there was no problems with the easy_install or package system install on those system (this time) But it will always happen at some time or another (as it did for me with install of other software via easy_install, rst2pdf and sphinx comes to mind) But that is a bug with the installation system not with the numpy package(you said 1.3.1 nupy had many bugs !?). A new user might move on to something other, but the reality is that problems like that crop up at some time, unless you have relatively static install. If the user moves on then he probably doesnt have a specific need for numpy, but just for something that can do the same job for his task. (it's unfortunate that he/we can't try it out without messing about). D. mic ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] [NumPy-Tickets] [NumPy] #971: numpy.memmap 'offset' parameter docs are almost entirely wrong.
On Thu, Mar 24, 2011 at 12:38 PM, Sebastian Haase seb.ha...@gmail.com wrote: Hi, I got an Internal Error message when trying to log into the Trac page. That happens a lot, the solution is just to retry. My comment: Could there at least be a note added to the current memmap doc string, stating that there is a problem with the current doc; also a link to http://projects.scipy.org/numpy/ticket/971 would be much better than nothing. If you could review the proposed replacement text (or even put it in a git branch) that would be very helpful. If the ticket submitter is correct and there is no bug, only documentation to be fixed, it would be good to get that in for 1.6.0 Ralf On Thu, Mar 24, 2011 at 1:58 AM, numpy-tick...@scipy.org wrote: #971: numpy.memmap 'offset' parameter docs are almost entirely wrong. ---+ Reporter: 0ion9 | Owner: pv Type: defect | Status: new Priority: normal | Milestone: Unscheduled Component: Documentation | Version: devel Keywords: | ---+ Changes (by mwiebe): * milestone: = Unscheduled -- Ticket URL: http://projects.scipy.org/numpy/ticket/971#comment:3 NumPy http://projects.scipy.org/numpy My example project ___ NumPy-Tickets mailing list numpy-tick...@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-tickets ___ 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] how to delete a particular column or row from numpy array based on some rule or value
In a numpy array of m x n size, I would like to delete few rows when a given element in that row is ‘nan’ or say any other value. For e.g. as in example given below, if I wish to delete a row when the 3rd element of row is zero, or if 3rd, 4th, 5th element are zero or either of 3rd, 4th and 5th element is zero. array([[ 1900. , nan, nan, nan, nan, nan], [ 1900.5, nan, nan, nan, nan, nan], [ 1901. , nan, nan, nan, nan, nan], ..., [ 6724. , nan, nan, nan, nan, nan], [ 6724.5, nan, nan, nan, nan, nan], [ 6725. , nan, nan, nan, nan, nan]]) Cheers Sachin I think u can use numpy.loadtext command http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html -- DILEEPKUMAR. R J R F, IIT DELHI Wouldn't that require to transform the array to a text representation first? If you have an existing array, you can use the numpy test and logical functions to index it. E.g. myarr[:,2] == 0selects the rows with 3rd column zero, np.isnan(myarr[:,3]) those with 4th column NaN and to select only rows where neither is the case: clean = myarr[np.logical_not( (myarr[:,2]==0) | (np.isnan(darr[:,3])) )] - combine as required with the '' or '|' operators (there does not seem to be a shorthand for logical_not...), and check np.isnan, np.isinf, np.isfinite - those should allow you to select what you need. HTH, Derek ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output
2011/3/24 Dmitrey tm...@ukr.net: Hi 2011/3/24 Dmitrey tm...@ukr.net from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value encountered in multiply nan My cycled calculations yields this thousands times slowing computations and making text output completely non-readable. Would old= seterr(invalid= 'ignore') be sufficient for you? yes for me, but I'm not sure for all those users who use my soft. Maybe it will hide some bugs in their objective functions and nonlinear constraints in numerical optimization and nonlinear equation systems. If we do what you request in your message subject your users will have the same issue. You can wrap (parts of) your code in something like: olderr = seterr(invalid= 'ignore') do stuff seterr(**olderr) Ralf ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] argmin and argmax without nan
On Thu, Mar 24, 2011 at 6:19 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: 2011/3/24 Dmitrey tm...@ukr.net: hi, is there any way to get argmin and argmax of an array w/o nans? Currently I have from numpy import * argmax([10,nan,100]) 1 argmin([10,nan,100]) 1 But it's not the values I would like to get. The walkaround I use: get all indeces of nans, replace them by -inf, get argmax, replace them by inf, get argmin. Is there any better way? (BTW, I invoke argmin/argmax along of a chosen axis) D. In [3]: np.nanargmax([10, np.nan, 100]) Out[3]: 2 In [4]: np.nanargmin([10, np.nan, 100]) Out[4]: 0 And if speed is an issue (it usually isn't) you can use the nanargmax from Bottleneck: a = np.random.rand(1) a[a 0.5] = np.nan timeit np.nanargmax(a) 1 loops, best of 3: 127 us per loop import bottleneck as bn timeit bn.nanargmax(a) 10 loops, best of 3: 12.4 us per loop ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] argmin and argmax without nan
2011/3/24 Dmitrey tm...@ukr.net : hi, is there any way to get argmin and argmax of an array w/o nans? Currently I have from numpy import * argmax([10,nan,100]) 1 argmin([10,nan,100]) 1 But it's not the values I would like to get. The walkaround I use: get all indeces of nans, replace them by -inf, get argmax, replace them by inf, get argmin. Is there any better way? (BTW, I invoke argmin/argmax along of a chosen axis) D. In [3]: np.nanargmax([10, np.nan, 100]) Out[3]: 2 In [4]: np.nanargmin([10, np.nan, 100]) Out[4]: 0 Ralf Thanks, I thought np.argnanmin should do that but those funcs were absent. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output
On Thu, Mar 24, 2011 at 9:45 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: 2011/3/24 Dmitrey tm...@ukr.net: Hi 2011/3/24 Dmitrey tm...@ukr.net from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value encountered in multiply nan My cycled calculations yields this thousands times slowing computations and making text output completely non-readable. Would old= seterr(invalid= 'ignore') be sufficient for you? yes for me, but I'm not sure for all those users who use my soft. Maybe it will hide some bugs in their objective functions and nonlinear constraints in numerical optimization and nonlinear equation systems. If we do what you request in your message subject your users will have the same issue. You can wrap (parts of) your code in something like: olderr = seterr(invalid= 'ignore') do stuff seterr(**olderr) Also, as Robert pointed out to me before np.errstate is a context-manager for ignoring these warnings. I often wrap optimization code with it. In [3]: np.array(np.inf)*0. Warning: invalid value encountered in multiply Out[3]: nan In [4]: with np.errstate(all='ignore'): ...: np.array(np.inf)*0. ...: ...: Out[4]: nan In [5]: np.array(np.inf)*0. Warning: invalid value encountered in multiply Out[5]: nan Skipper ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output
Hi On Thu, Mar 24, 2011 at 4:17 PM, Skipper Seabold jsseab...@gmail.comwrote: On Thu, Mar 24, 2011 at 9:45 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: 2011/3/24 Dmitrey tm...@ukr.net: Hi 2011/3/24 Dmitrey tm...@ukr.net from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value encountered in multiply nan My cycled calculations yields this thousands times slowing computations and making text output completely non-readable. Would old= seterr(invalid= 'ignore') be sufficient for you? yes for me, but I'm not sure for all those users who use my soft. Maybe it will hide some bugs in their objective functions and nonlinear constraints in numerical optimization and nonlinear equation systems. If we do what you request in your message subject your users will have the same issue. You can wrap (parts of) your code in something like: olderr = seterr(invalid= 'ignore') do stuff seterr(**olderr) Also, as Robert pointed out to me before np.errstate is a context-manager for ignoring these warnings. I often wrap optimization code with it. I didn't realize that its context-manager, but that's really create! (Perhaps documents could reflect that.) Regards, eat In [3]: np.array(np.inf)*0. Warning: invalid value encountered in multiply Out[3]: nan In [4]: with np.errstate(all='ignore'): ...: np.array(np.inf)*0. ...: ...: Out[4]: nan In [5]: np.array(np.inf)*0. Warning: invalid value encountered in multiply Out[5]: nan Skipper ___ 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] should get rid of the annoying numpy STDERR output
On Thu, Mar 24, 2011 at 10:52 AM, eat e.antero.ta...@gmail.com wrote: Hi On Thu, Mar 24, 2011 at 4:17 PM, Skipper Seabold jsseab...@gmail.com snip Also, as Robert pointed out to me before np.errstate is a context-manager for ignoring these warnings. I often wrap optimization code with it. I didn't realize that its context-manager, but that's really create! (Perhaps documents could reflect that.) Regards, eat I added errstate to the see also of seterr: http://docs.scipy.org/numpy/docs/numpy.core.numeric.seterr/ Skipper ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] [SciPy-Dev] ANN: Numpy 1.6.0 beta 1
On Wed, Mar 23, 2011 at 9:29 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Wed, Mar 23, 2011 at 8:32 PM, Pauli Virtanen p...@iki.fi wrote: On Wed, 23 Mar 2011 14:17:20 -0500, Bruce Southey wrote: I can not figure out what is different between git and this version :-( All the paths appear to be the same. Further it continues onwards when I do: $python3.1 -m pdb setup.py build I added these lines to the start of numpy/compat/__init__.py import os print(os.getcwd()) /home/bsouthey/python/numpystuff/tmp6/numpy-1.6.0b1/build/py3k This is equivalent to the git version. Unless someone else finds it, I will consider it just my problem and ignore it. There's some magic in setup.py for generating numpy/version.py, which behaves differently depending whether `.git` is present or not. It might do some stuff that goes wrong --- I fixed it once already, but maybe it's broken again. I un-fixed your fix by accident, since I missed why you did that and your fix broke the paver script. Leaving the FULLVERSION line outside write_version_py() but putting the import inside should fix it, only the commit part will be missing when building packages for an unreleased version. It's a little ugly, but this seems to work for all use cases: https://github.com/rgommers/numpy/commit/a9fb1be2 Can someone please review that? Ralf ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output
2011/3/24 Dmitrey tm...@ukr.net: from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value encountered in multiply nan My cycled calculations yields this thousands times slowing computations and making text output completely non-readable. from numpy import __version__ __version__ '2.0.0.dev-1fe8136' We really should change the default to 'warn' for numpy 2.0. Maybe even for numpy 1.6. We've talked about it before, and I think most people were in favor. We just never pulled the trigger. Devs, what say you? -- 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] should get rid of the annoying numpy STDERR output
On Thu, Mar 24, 2011 at 5:11 PM, Robert Kern robert.k...@gmail.com wrote: 2011/3/24 Dmitrey tm...@ukr.net: from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value encountered in multiply nan My cycled calculations yields this thousands times slowing computations and making text output completely non-readable. from numpy import __version__ __version__ '2.0.0.dev-1fe8136' We really should change the default to 'warn' for numpy 2.0. Maybe even for numpy 1.6. We've talked about it before, and I think most people were in favor. We just never pulled the trigger. Old thread on this topic: http://thread.gmane.org/gmane.comp.python.numeric.general/35664 Devs, what say you? Works for me, also for 1.6. Cheers, Ralf -- Robert Kern ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] argmin and argmax without nan
On Thu, Mar 24, 2011 at 6:19 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: 2011/3/24 Dmitrey tm...@ukr.net : hi, is there any way to get argmin and argmax of an array w/o nans? Currently I have from numpy import * argmax([10,nan,100]) 1 argmin([10,nan,100]) 1 But it's not the values I would like to get. The walkaround I use: get all indeces of nans, replace them by -inf, get argmax, replace them by inf, get argmin. Is there any better way? (BTW, I invoke argmin/argmax along of a chosen axis) D. In [3]: np.nanargmax([10, np.nan, 100]) Out[3]: 2 In [4]: np.nanargmin([10, np.nan, 100]) Out[4]: 0 And if speed is an issue (it usually isn't) you can use the nanargmax from Bottleneck: a = np.random.rand(1) a[a 0.5] = np.nan timeit np.nanargmax(a) 1 loops, best of 3: 127 us per loop import bottleneck as bn timeit bn.nanargmax(a) 10 loops, best of 3: 12.4 us per loop For some problems some % speedup could be yielded. Are there any plans for merging bottleneck into numpy? Also, are those benchmarks valid for ordinary numpy only or numpy with MKL/ACML or it doesn't matter? If I have huge arrays and multicore CPU, will numpy with MKL/ACML or something else involve parallel computations with numpy funcs like amin, amax, argmin, nanargmin etc? D. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] argmin and argmax without nan
2011/3/24 Dmitrey tm...@ukr.net: Are there any plans for merging bottleneck into numpy? No plans, but no particular opposition. bottleneck is a good place to experiment with these optimizations. When they settle, it might be worth folding them back in. Also, are those benchmarks valid for ordinary numpy only or numpy with MKL/ACML or it doesn't matter? Doesn't matter. If I have huge arrays and multicore CPU, will numpy with MKL/ACML or something else involve parallel computations with numpy funcs like amin, amax, argmin, nanargmin etc? No. MKL/ACML focus on parallelizing expensive computation like matrix-matrix multiplication, not things like finding the minimum elements of an array. -- 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
[Numpy-discussion] Partial least squares
I am looking for a partial least sqaures code refactoring for two (X,Y) matrices. I found the following, but they not not work for me: 1. MDP: Factors only one matrix (am I wrong?) 2. pychem: Windows only code (I use Linux) 3. chemometrics from Koders: I get a singularity error. 4. pca_module (By Risvik): same problem as MDP Any suggestion? Nadav. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Partial least squares
2011/3/24 Nadav Horesh nad...@visionsense.com: I am looking for a partial least sqaures code refactoring for two (X,Y) matrices. I found the following, but they not not work for me: 1. MDP: Factors only one matrix (am I wrong?) 2. pychem: Windows only code (I use Linux) 3. chemometrics from Koders: I get a singularity error. 4. pca_module (By Risvik): same problem as MDP Any suggestion? There is one in the master of scikits.learn: https://github.com/scikit-learn/scikit-learn/blob/master/scikits/learn/pls.py https://github.com/scikit-learn/scikit-learn/blob/master/examples/plot_pls.py -- Olivier http://twitter.com/ogrisel - http://github.com/ogrisel ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] ANN: Numpy 1.6.0 beta 1
On Thu, Mar 24, 2011 at 12:34 AM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: Hi again, On 23 Mar 2011, at 17:07, Ralf Gommers wrote: I am pleased to announce the availability of the first beta of NumPy 1.6.0. Due to the extensive changes in the Numpy core for this release, the beta testing phase will last at least one month. Please test this beta and report any problems on the Numpy mailing list. tests with the fink-installed pythons on MacOS X mostly succeeded, with one failure in python2.4 and a couple of issues seemingly related to PPC floating point accuracy, as below: OSX/Python 2.4 2.5 2.6 2.7 3.1 3.2 10.5/i386 FAIL[1] pass pass pass pass pass 10.5/ppc FAIL[1,2] FAIL[2] FAIL[2] FAIL[2] FAIL[2] FAIL[2] 10.6/x86_64 n/a pass pass pass pass pass Failures: [1] Python 2.4.4 (#1, Jan 5 2011, 03:05:41) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type help, copyright, credits or license for more information. import numpy numpy.test('full') Running unit tests for numpy NumPy version 1.6.0b1 NumPy is installed in /sw/lib/python2.4/site-packages/numpy Python version 2.4.4 (#1, Jan 5 2011, 03:05:41) [GCC 4.0.1 (Apple Inc. build 5493)] nose version 1.0.0 FAIL: test_iterator.test_iter_broadcasting_errors -- Traceback (most recent call last): File /sw/lib/python2.4/site-packages/nose/case.py, line 187, in runTest self.test(*self.arg) File /sw/lib/python2.4/site-packages/numpy/core/tests/ test_iterator.py, line 639, in test_iter_broadcasting_errors 'Message %s doesn\'t contain operand shape (2,3)' % msg) File /sw/lib/python2.4/site-packages/numpy/testing/utils.py, line 34, in assert_ raise AssertionError(msg) AssertionError: Message non-broadcastable output operand with shape (%zd,%zd) doesn't match the broadcast shape (%zd,%zd,%zd) doesn't contain operand shape (2,3) Mark just committed a fix for this, could you test the current 1.6.x branch to see if that worked and report on http://projects.scipy.org/numpy/ticket/1780? Thanks, Ralf ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs
On 24/03/11 10:00, Dmitrey wrote: hi, when numpy in Linux apt will be updated? It's still 1.3.0 with many bugs I have Linux KUBUNTU 10.10 D. (k)ubuntu 11.04 (to be released in april) will have at numpy 1.5.1 (or possible newer) https://launchpad.net/ubuntu/+source/python-numpy also scipy will go from 0.7.2 - 0.8.0 and python itself from 2.6.6 - 2.7.1 sam ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Partial least squares
On Thu, Mar 24, 2011 at 12:06:56PM -0700, Nadav Horesh wrote: I am looking for a partial least sqaures code refactoring for two (X,Y) matrices. I found the following, but they not not work for me: We have had a PLS code contributed in the scikits learn very recently: http://scikit-learn.sourceforge.net/dev/modules/pls.html (note that these are the docs for the unreleased development version). You will need to check out and install the development version: http://scikit-learn.sourceforge.net/dev/developers/index.html#retrieving-the-latest-code The docs are very light (bad, bad developers :$ ), and as I am not myself a user of PLS I have a hard time judging the quality of the implementation and its usability, but hopefully it should do what you are looking for. An example can be found on http://scikit-learn.sourceforge.net/dev/auto_examples/plot_pls.html HTH, Gaël ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Partial least squares
On Thu, Mar 24, 2011 at 08:15:12PM +0100, Olivier Grisel wrote: 2011/3/24 Nadav Horesh nad...@visionsense.com: I am looking for a partial least sqaures code refactoring for two (X,Y) matrices. I found the following, but they not not work for me: 1. MDP: Factors only one matrix (am I wrong?) 2. pychem: Windows only code (I use Linux) 3. chemometrics from Koders: I get a singularity error. 4. pca_module (By Risvik): same problem as MDP Any suggestion? There is one in the master of scikits.learn: https://github.com/scikit-learn/scikit-learn/blob/master/scikits/learn/pls.py https://github.com/scikit-learn/scikit-learn/blob/master/examples/plot_pls.py Olivier shoots faster than I do :) G ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Partial least squares
Yes, he is. I'll work on it early next week, and post any comment I'll have. Documentation quality: The code doc refer to an excellent reference [Wegelin et al. 2000], so no real problem here. If the reference is critical I would suggest on of the following: 1. Put a link to the document. 2. Is it possible to copy the paper to the project site? As the paper becomes old (on the internet time scale), it becomes volatile, and may vanish while the project is still alive. Nadav. From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] On Behalf Of Gael Varoquaux [gael.varoqu...@normalesup.org] Sent: 24 March 2011 22:04 To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] Partial least squares On Thu, Mar 24, 2011 at 08:15:12PM +0100, Olivier Grisel wrote: 2011/3/24 Nadav Horesh nad...@visionsense.com: I am looking for a partial least sqaures code refactoring for two (X,Y) matrices. I found the following, but they not not work for me: 1. MDP: Factors only one matrix (am I wrong?) 2. pychem: Windows only code (I use Linux) 3. chemometrics from Koders: I get a singularity error. 4. pca_module (By Risvik): same problem as MDP Any suggestion? There is one in the master of scikits.learn: https://github.com/scikit-learn/scikit-learn/blob/master/scikits/learn/pls.py https://github.com/scikit-learn/scikit-learn/blob/master/examples/plot_pls.py Olivier shoots faster than I do :) G ___ 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] Question about repeated values in X in A[X] = Y
I have done some work on scipy.ndimage.measurements, and was adding to it recently when I noticed I had made use of the idiom A[X] = Y with repeated indices in X, relying on the behavior that the last X,Y pair at each unique X is the one that is assigned in A (last = last by position in X). I thought I had found documentation of this behavior, somewhere, but when another developer asked, I was unable to locate it (perhaps I just forgot the google keywords I used last time). So, before I rely too much on this behavior, I thought I should make sure it was: - correct, - reasonable future-proof, - and documented (if the first two are true). Thanks, Thouis Jones ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Partial least squares
On Thu, Mar 24, 2011 at 01:57:46PM -0700, Nadav Horesh wrote: The code doc refer to an excellent reference [Wegelin et al. 2000], so no real problem here. If the reference is critical I would suggest on of the following: 1. Put a link to the document. Do you have one? I'd be happy to add one. 2. Is it possible to copy the paper to the project site? As the paper becomes old (on the internet time scale), it becomes volatile, and may vanish while the project is still alive. I don't really want to do this: it is not the scikit's learn goal to maintain a library of documents. However, if you want to give us an executive summary of the document (respecting the copyright, of course, so copy and paste should be avoided). I'd be very happy to integrate it to the documentation. Once again, I am not doing this myself right now because I am not an expert of PLS, and I don't trust myself to do it right. I would have to understand the usecases a bit more, which I feasible, but takes time. Your feedback is much appreciated, Gaël ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] ANN: Numpy 1.6.0 beta 1
On 24.03.2011, at 9:11AM, Pearu Peterson wrote: Intel-64bit: ERROR: test_assumed_shape.TestAssumedShapeSumExample.test_all -- Traceback (most recent call last): File /sw/lib/python3.2/site-packages/nose/case.py, line 372, in setUp try_run(self.inst, ('setup', 'setUp')) File /sw/lib/python3.2/site-packages/nose/util.py, line 478, in try_run return func() File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 352, in setUp module_name=self.module_name) File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 73, in wrapper memo[key] = func(*a, **kw) File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 134, in build_module % (cmd[4:], asstr(out))) RuntimeError: Running f2py failed: ['-m', '_test_ext_module_5403', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/foo_free.f90', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/foo_use.f90', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/precision.f90'] Reading .f2py_f2cmap ... Mapping real(kind=rk) to double Hmm, this should not happen as real(kind=rk) should be mapped to float. It seems that you have .f2py_f2cmap file lying around. Could you remove it and try again. Yes, it's in the tarball and was installed together with the f2py tests! tar tzvf /sw/src/numpy-1.6.0b1.tar.gz | grep f2py_f2 -rw-r--r-- zouzoujing/staff 29 2011-03-15 06:22 numpy-1.6.0b1/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap cat /sw/lib/python3.2/site-packages/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap dict(real=dict(rk=double)) But still after removing all installed instances of the file and even removing it from the tarball prior to rebuilding numpy, the test apparently keeps re-creating it in its own tmpdir: building extension _test_ext_module_5403 sources f2py options: [] f2py: /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7/_test_ext_module_5403module.c creating /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum creating /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7 getctype: real(kind=rk) is mapped to C float (to override define dict(real = dict(rk=C typespec)) in /private/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpPo744G/.f2py_f2cmap file). ... gfortran:f77: /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7/_test_ext_module_5403-f2pywrappers.f /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7/_test_ext_module_5403-f2pywrappers.f:26.21: real :: res 1 Error: Symbol 'res' at (1) already has basic type of REAL /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7/_test_ext_module_5403-f2pywrappers.f:26.21: real :: res 1 Error: Symbol 'res' at (1) already has basic type of REAL ... f2py is the one installed with this numpy version, gfortran is COLLECT_GCC=/sw/bin/gfortran COLLECT_LTO_WRAPPER=/sw/lib/gcc4.5/libexec/gcc/x86_64-apple-darwin10.6.0/4.5.2/lto-wrapper Ziel: x86_64-apple-darwin10.6.0 Konfiguriert mit: ../gcc-4.5.2/configure --prefix=/sw --prefix=/sw/lib/gcc4.5 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.5/info --enable-languages=c,c++,fortran,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.5 --enable-lto Thread-Modell: posix gcc-Version 4.5.2 (GCC) Any more ideas? Thanks, Derek ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] Ticket closing policy
Hi Mark, hi all, I noticed you did a lot of cleaning in the bug trackers, thank you for helping there, this is sorely needed. However, I noticed quite a few tickets were closed as wontfix even though they are valid. I understand the concern of getting many languishing tickets, but one should not close valid tickets either. Also, in my experience, issues specific to win32 should not be closed because they work on Linux - I remember the fastputmask issue was still there not so long ago (but could not understand what was going on, unfortunately). cheers, David ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] ANN: Numpy 1.6.0 beta 1
On Fri, Mar 25, 2011 at 1:44 AM, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: On 24.03.2011, at 9:11AM, Pearu Peterson wrote: Intel-64bit: ERROR: test_assumed_shape.TestAssumedShapeSumExample.test_all -- Traceback (most recent call last): File /sw/lib/python3.2/site-packages/nose/case.py, line 372, in setUp try_run(self.inst, ('setup', 'setUp')) File /sw/lib/python3.2/site-packages/nose/util.py, line 478, in try_run return func() File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 352, in setUp module_name=self.module_name) File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 73, in wrapper memo[key] = func(*a, **kw) File /sw/lib/python3.2/site-packages/numpy/f2py/tests/util.py, line 134, in build_module % (cmd[4:], asstr(out))) RuntimeError: Running f2py failed: ['-m', '_test_ext_module_5403', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/foo_free.f90', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/foo_use.f90', '/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpfiy1jn/precision.f90'] Reading .f2py_f2cmap ... Mapping real(kind=rk) to double Hmm, this should not happen as real(kind=rk) should be mapped to float. It seems that you have .f2py_f2cmap file lying around. Could you remove it and try again. Yes, it's in the tarball and was installed together with the f2py tests! Indeed, f2py tests suite contains the .f2py_f2cmap file. Its effect should be local to the corresponding test but it seems not. I'll look into it.. building extension _test_ext_module_5403 sources f2py options: [] f2py: /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7/_test_ext_module_5403module.c creating /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum creating /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7 getctype: real(kind=rk) is mapped to C float (to override define dict(real = dict(rk=C typespec)) in /private/var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpPo744G/.f2py_f2cmap file). ... gfortran:f77: /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7/_test_ext_module_5403-f2pywrappers.f /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7/_test_ext_module_5403-f2pywrappers.f:26.21: real :: res 1 Error: Symbol 'res' at (1) already has basic type of REAL /var/folders/DC/DC7g9UNr2RWkb++8ZSn1J+++0Dk/-Tmp-/tmpS4KGum/src.macosx-10.6-x86_64-2.7/_test_ext_module_5403-f2pywrappers.f:26.21: real :: res 1 Error: Symbol 'res' at (1) already has basic type of REAL ... f2py is the one installed with this numpy version, gfortran is COLLECT_GCC=/sw/bin/gfortran COLLECT_LTO_WRAPPER=/sw/lib/gcc4.5/libexec/gcc/x86_64-apple-darwin10.6.0/4.5.2/lto-wrapper Ziel: x86_64-apple-darwin10.6.0 Konfiguriert mit: ../gcc-4.5.2/configure --prefix=/sw --prefix=/sw/lib/gcc4.5 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.5/info --enable-languages=c,c++,fortran,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.5 --enable-lto Thread-Modell: posix gcc-Version 4.5.2 (GCC) Can you send me the _test_ext_module_5403-f2pywrappers.f file. It should exist there when the compilation fails. Pearu ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion