Re: [Numpy-discussion] sum of array for masked area
On 28 November 2013 09:06, questions anon questions.a...@gmail.com wrote: I have a separate text file for daily rainfall data that covers the whole country. I would like to calculate the monthly mean, min, max and the mean of the sum for one state. I can get the max, min and mean for the state, but the mean of the sum keeps giving me a result for the whole country rather than just the state, even def accumulate_month(year, month): files = glob.glob(GLOBTEMPLATE.format(year=year, month=month)) monthlyrain=[] for ifile in files: try: f=np.genfromtxt(ifile,skip_header=6) except: print ERROR with file:, ifile errors.append(ifile) f=np.flipud(f) stateonly_f=np.ma.masked_array(f, mask=newmask.mask) # this masks data to state print stateonly_f:, stateonly_f.max(), stateonly_f.mean(), stateonly_f.sum() monthlyrain.append(stateonly_f) ^^ At this point monthlyrain is a list of masked arrays r_sum=np.sum(monthlyrain, axis=0) ^^^ Passing a list of masked arrays to np.sum returns an np.ndarray object (*not* a masked array) r_mean_of_sum=MA.mean(r_sum) Therefore this call to MA.mean returns the mean of all values in the ndarray r_sum. To fix: convert your monthlyrain list to a 3D maksed array before calling np.sum(monthlyrain, axis=0). In this case np.sum will call the masked array's .sum() method which knows about the mask. monthlyrain = np.ma.asarray(monthlyrain) r_sum=np.sum(monthlyrain, axis=0) Consider the following simplified example: alist = [] for k in range(2): a = np.arange(4).reshape((2,2)) alist.append(np.ma.masked_array(a, mask=[[0,1],[0,0]])) print(alist) print(type(alist)) alist = np.ma.asarray(alist) print(alist) print(type(alist)) asum = np.sum(alist, axis=0) print(asum) print(type(asum)) print(asum.mean()) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] f2py and setup.py how can I specify where the .so file goes?
On 10 July 2013 17:50, Jose Gomez-Dans jgomezd...@gmail.com wrote: Hi, I am building a package that exposes some Fortran libraries through f2py. The packages directory looks like this: setup.py my_pack/ | |--__init__.py |-- some.pyf |--- code.f90 I thoughat that once installed, I'd get the .so and __init__.py in the same directory (namely ~/.local/lib/python2.7/site-packages/my_pack/). However, I get ~/.local/lib/python2.7/site-packages/mypack_fortran.so ~/.local/lib/python2.7/site-packages/my_pack__fortran-1.0.2-py2.7.egg-info ~/.local/lib/python2.7/site-packages/my_pack/__init__.py Thet setup file is this at the end, I am clearly missing some option here to move the *.so into the my_pack directory Anybody know which one? Cheers Jose [setup.py] #!/usr/bin/env python def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration(parent_package,top_path) config.add_extension('mypack_fortran', ['the_pack/code.f90'] ) return config if __name__ == __main__: from numpy.distutils.core import setup # Global variables for this extension: name = mypack_fortran # name of the generated python extension (.so) description = blah author = author_email = setup( name=name,\ description=description, \ author=author, \ author_email = author_email, \ configuration = configuration, version=1.0.2,\ packages=[my_pack]) Something like the following should work... from numpy.distutils.core import setup, Extension my_ext = Extension(name = 'my_pack._fortran', sources = ['my_pack/code.f90']) if __name__ == __main__: setup(name = 'my_pack', description = ..., author =..., author_email = ..., version = ..., packages = ['my_pack'], ext_modules = [my_ext], ) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Integer type casting and OverflowError
On 9 May 2013 12:21, Robert Kern robert.k...@gmail.com wrote: With master numpy (and back to 1.6.1, at least): [~] |1 np.int32(3054212286) -1240755010 It seems like at one time, this used to raise an OverflowError. We can see this in at least one place in scipy: https://github.com/scipy/scipy/blob/master/scipy/interpolate/fitpack.py#L912 No doubt I'm missing something, but isn't the OverflowError raised here https://github.com/scipy/scipy/blob/master/scipy/interpolate/fitpack.py#L40 and not in Numpy? Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Integer type casting and OverflowError
On 9 May 2013 12:45, Robert Kern robert.k...@gmail.com wrote: On Thu, May 9, 2013 at 11:38 AM, Scott Sinclair scott.sinclair...@gmail.com wrote: On 9 May 2013 12:21, Robert Kern robert.k...@gmail.com wrote: With master numpy (and back to 1.6.1, at least): [~] |1 np.int32(3054212286) -1240755010 It seems like at one time, this used to raise an OverflowError. We can see this in at least one place in scipy: https://github.com/scipy/scipy/blob/master/scipy/interpolate/fitpack.py#L912 No doubt I'm missing something, but isn't the OverflowError raised here https://github.com/scipy/scipy/blob/master/scipy/interpolate/fitpack.py#L40 and not in Numpy? Heh. I wrote this email before I submitted the PR with that fix. :-) Hah. I should have checked recent commits as well... Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] savez documentation flaw
On 5 February 2013 10:38, Andreas Hilboll li...@hilboll.de wrote: I noticed that on http://docs.scipy.org/doc/numpy/reference/generated/numpy.savez.html there's a see also to a function numpy.savez_compressed, which doesn't seem to exist (neither on my system nor in the online documentation). Seems like a problem with the online documentation, savez_compressed does exist on my numpy 1.6.2 and on master... The docstrings for these functions are in numpy/lib/npyio.py. It's sometimes easiest to locate the docstrings by following the source link in the Doceditor (in this case from http://docs.scipy.org/numpy/docs/numpy.lib.npyio.savez/). Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Fwd: numpy test fails with Illegal instruction'
On 17 January 2013 12:01, Gerhard Burger burger...@gmail.com wrote: When I run `numpy.test(verbose=10)` it crashes with test_polyfit (test_polynomial.TestDocs) ... Illegal instruction In the FAQ it states that I should provide the following information (running Ubuntu 12.04 64bit): os.name = 'posix' uname -r = 3.2.0-35-generic sys.platform = 'linux2' sys.version = '2.7.3 (default, Aug 1 2012, 05:14:39) \n[GCC 4.6.3]' Atlas is not installed (not required for numpy, only for scipy right?) It fails both when I install numpy 1.6.2 with `pip install numpy` and if I install the latest dev version from git. Very strange. I tried to reproduce this on 64-bit Ubuntu 12.04 (by removing my ATLAS, BLAS, LAPACK etc..) but couldn't: $ python -c import numpy; numpy.test() Running unit tests for numpy NumPy version 1.6.2 NumPy is installed in /home/scott/.virtualenvs/numpy-tmp/local/lib/python2.7/site-packages/numpy Python version 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] nose version 1.2.1 . -- Ran 3568 tests in 14.170s OK (KNOWNFAIL=5, SKIP=5) $ python -c import numpy; numpy.show_config() blas_info: NOT AVAILABLE lapack_info: NOT AVAILABLE atlas_threads_info: NOT AVAILABLE blas_src_info: NOT AVAILABLE lapack_src_info: NOT AVAILABLE atlas_blas_threads_info: NOT AVAILABLE lapack_opt_info: NOT AVAILABLE blas_opt_info: NOT AVAILABLE atlas_info: NOT AVAILABLE lapack_mkl_info: NOT AVAILABLE blas_mkl_info: NOT AVAILABLE atlas_blas_info: NOT AVAILABLE mkl_info: NOT AVAILABLE Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Fwd: numpy test fails with Illegal instruction'
On 17 January 2013 16:59, Gerhard Burger burger...@gmail.com wrote: Solved it, did a backtrace with gdb and the error came somewhere from an old lapack version that was installed on my machine (I thought I wouldn't have these issues in a virtualenv). but anyway after I removed it, and installed numpy again, it ran without problems! Virtualenv only creates an isolated Python install, it doesn't trick the Numpy build process into ignoring system libraries like LAPACK, ATLAS etc. Glad it's fixed. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy.arrange not returning expected results (bug?)
On 18 October 2012 03:34, Simon Lieschke simon.liesc...@orionhealth.com wrote: I've discovered calling numpy.arange(1.1, 17.1) and numpy(1.1, 16.1) both return the same results. Could this be a numpy bug, or is there some behaviour I'm possibly not aware of here? Not a bug, it's because you're using floating point arguments. The docstring (http://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html) tells you that For floating point arguments, the length of the result is ceil((stop - start)/step). If you try In [1]: (17.1-1.1)/1.0 Out[1]: 16.0 In [2]: (16.1-1.1)/1.0 Out[2]: 15.002 In [3]: np.ceil((17.1-1.1)/1.0) Out[3]: 16.0 In [4]: np.ceil((16.1-1.1)/1.0) Out[4]: 16.0 you see that the length of the output array ends up being the same due to floating point round-off effects. You can achieve what you want using np.linspace(1.1, 17.1, num=17) etc.. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Mysterious test_pareto failure on Travis
On 4 September 2012 12:23, Matthew Brett matthew.br...@gmail.com wrote: On Tue, Sep 4, 2012 at 11:15 AM, Nathaniel Smith n...@pobox.com wrote: The last two Travis builds of master have failed consistently with the same error: http://travis-ci.org/#!/numpy/numpy/builds It looks like a real failure -- we're getting the same error on every build variant, some sort of problem in test_pareto. Example: http://travis-ci.org/#!/numpy/numpy/jobs/2328823 The obvious culprit would be the previous commit, which regenerated mtrand.c with Cython 0.17: http://github.com/numpy/numpy/commit/cd9092aa71d23359b33e89d938c55fb14b9bf606 What's weird, though, is that that commit passed just fine on Travis: http://travis-ci.org/#!/numpy/numpy/builds/2313124 It's just the two commits since then that failed. But these commits have been 1-line docstring changes, so I don't see how they could have possibly created the problem. Also, the test passes fine with python 2.7 on my laptop with current master. Can anyone reproduce this failure? Any ideas what might be going on? I believe Travis just (a couple of days ago?) switched to Ubuntu 12.04 images - could that be the problem? For whatever it's worth, tox reports: py24: commands succeeded py25: commands succeeded py26: commands succeeded py27: commands succeeded ERROR: py31: InterpreterNotFound: python3.1 py32: commands succeeded py27-separate: commands succeeded py32-separate: commands succeeded with git revision a72ce7e on my Ubuntu 12.04 machine (64-bit). Cheers, S ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] unsubscribe
On 23 August 2012 05:58, Amit Nagal amit.na...@gvkbio.com wrote: Please unsubscribe me You can unsubscribe at the bottom of this page http://mail.scipy.org/mailman/listinfo/numpy-discussion Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] how to uninstall numpy
On 6 August 2012 20:07, Alex Clark acl...@aclark.net wrote: On 8/6/12 5:48 AM, Scott Sinclair wrote: On 6 August 2012 11:04, Petro x.pi...@gmail.com wrote: This is a general python question but I will ask it here. To install a new numpy on Debian testing I remove installed version with aptitude purge python-numpy download numpy source code and install numpy with sudo python setup.py install. If I want to remove the installed numpy how do I proceed? Assuming your system Python is 2.7, your numpy should have been installed in /usr/local/lib/python2.7/site-packages/ (or /usr/local/lib/python2.7/dist-packages/ as on Ubuntu?) So something along these lines: $ sudo rm -rf /usr/local/lib/python2.7/site-packages/numpy/ $ sudo rm -rf /usr/local/lib/python2.7/site-packages/numpy-*.egg* $ sudo rm -rf /usr/local/bin/f2py Or if you have pip installed (easy_install pip) you can: $ pip uninstall numpy (it will uninstall things it hasn't installed, which I think should include the console_script f2py?) Unfortunately that won't work in this case. If pip wasn't used to install the package it has no way know what's been installed. That information is stored in site-packages/package-ver-pyver.egg-info/installed-files.txt which doesn't exist if pip isn't used for the install. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] how to uninstall numpy
On 6 August 2012 11:04, Petro x.pi...@gmail.com wrote: This is a general python question but I will ask it here. To install a new numpy on Debian testing I remove installed version with aptitude purge python-numpy download numpy source code and install numpy with sudo python setup.py install. If I want to remove the installed numpy how do I proceed? Assuming your system Python is 2.7, your numpy should have been installed in /usr/local/lib/python2.7/site-packages/ (or /usr/local/lib/python2.7/dist-packages/ as on Ubuntu?) So something along these lines: $ sudo rm -rf /usr/local/lib/python2.7/site-packages/numpy/ $ sudo rm -rf /usr/local/lib/python2.7/site-packages/numpy-*.egg* $ sudo rm -rf /usr/local/bin/f2py Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy.complex
On 18 July 2012 15:14, Molinaro Céline celine.molin...@telecom-bretagne.eu wrote: Hello, In [2]: numpy.real(arange(3)) Out[2]: array([0, 1, 2]) In [3]: numpy.complex(arange(3)) TypeError: only length-1 arrays can be converted to Python scalars I think you're looking for the dtype keyword to the ndarray constructor: import numpy as np np.arange(3, dtype=np.complex) Out[2]: array([ 0.+0.j, 1.+0.j, 2.+0.j]) or if you have an existing array to cast: np.asarray(np.arange(3), dtype=np.complex) Out[3]: array([ 0.+0.j, 1.+0.j, 2.+0.j]) You can get the real and imaginary components of your complex array like so: a = np.arange(3, dtype=np.complex) a Out[9]: array([ 0.+0.j, 1.+0.j, 2.+0.j]) a.real Out[10]: array([ 0., 1., 2.]) a.imag Out[11]: array([ 0., 0., 0.]) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] import numpy performance
On 10 July 2012 09:05, Andrew Dalke da...@dalkescientific.com wrote: On Jul 8, 2012, at 9:22 AM, Scott Sinclair wrote: On 6 July 2012 15:48, Andrew Dalke da...@dalkescientific.com wrote: I followed the instructions at http://docs.scipy.org/doc/numpy/dev/gitwash/patching.html and added Ticket #2181 (with patch) ... Those instructions need to be updated to reflect the current preferred practice. You'll make code review easier and increase the chances of getting your patch accepted by submitting the patch as a Github pull request instead (see http://docs.scipy.org/doc/numpy/dev/gitwash/development_workflow.html for a how-to). It's not very much extra work. Both of those URLs point to related documentation under the same root, so I assumed that both are equally valid. That's a valid assumption. I did look at the development_workflow documentation, and am already bewildered by the terms 'rebase','fast-foward' etc. It seems to that last week I made a mistake because I did a git pull on my local copy (which is what I do with Mercurial to get the current trunk code) instead of: git fetch followed by gitrebase, git merge --ff-only or git merge --no-ff, depending on what you intend. I don't know if I made a common mistake, and I don't know what [I] intend. Fair enough, new terminology is seldom fun. Using git pull wasn't necessary in your case, neither was git rebase. I realize that for someone who plans to be a long term contributor, understanding git, github, and the NumPy development model is not very much extra work, but in terms of extra work for me, or at least minimizing my level of confusion, I would rather do what the documentation suggests and continue with the submitted patch. By not very much extra work I assumed that you'd already done most of the legwork towards submitting a pull request (Github account, forking numpy repo, etc..) My mistake, I now retract that statement :) and submitted your patch in https://github.com/numpy/numpy/pull/334 as a peace offering. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] import numpy performance
On 6 July 2012 15:48, Andrew Dalke da...@dalkescientific.com wrote: I followed the instructions at http://docs.scipy.org/doc/numpy/dev/gitwash/patching.html and added Ticket #2181 (with patch) at http://projects.scipy.org/numpy/ticket/2181 Those instructions need to be updated to reflect the current preferred practice. You'll make code review easier and increase the chances of getting your patch accepted by submitting the patch as a Github pull request instead (see http://docs.scipy.org/doc/numpy/dev/gitwash/development_workflow.html for a how-to). It's not very much extra work. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy regression in 1.6.2 in deducing the dtype for record array
On 5 July 2012 08:10, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Wed, Jul 4, 2012 at 10:56 PM, Sandro Tosi matrixh...@gmail.com wrote: Hello, On Mon, Jul 2, 2012 at 7:58 PM, Sandro Tosi matrixh...@gmail.com wrote: Hello, I'd like to point you to this bug report just reported to Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679948 It would be really awesome if you could give a look and comment if the proposed fix would be appropriate. Did you have a chance to look at this email? The commit identified by Yaroslav looks like the right one. It just needs to be backported to 1.6.x. Except that cherry picking the commit to the 1.6.x branch doesn't apply cleanly. It'll take some work by someone familiar with that part of the code.. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Missing data wrap-up and request for comments
On 11 May 2012 06:57, Travis Oliphant tra...@continuum.io wrote: On May 10, 2012, at 3:40 AM, Scott Sinclair wrote: On 9 May 2012 18:46, Travis Oliphant tra...@continuum.io wrote: The document is available here: https://github.com/numpy/numpy.scipy.org/blob/master/NA-overview.rst This is orthogonal to the discussion, but I'm curious as to why this discussion document has landed in the website repo? I suppose it's not a really big deal, but future uploads of the website will now include a page at http://numpy.scipy.org/NA-overview.html with the content of this document. If that's desirable, I'll add a note at the top of the overview referencing this discussion thread. If not it can be relocated somewhere more desirable after this thread's discussion deadline expires.. Yes, it can be relocated. Can you suggest where it should go? It was added there so that nathaniel and mark could both edit it together with Nathaniel added to the web-team. It may not be a bad place for it, though. At least for a while. Having thought about it, a page on the website isn't a bad idea. I've added a note pointing to this discussion. The document now appears at http://numpy.scipy.org/NA-overview.html Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Missing data wrap-up and request for comments
On 11 May 2012 08:12, Fernando Perez fperez@gmail.com wrote: On Thu, May 10, 2012 at 11:03 PM, Scott Sinclair scott.sinclair...@gmail.com wrote: Having thought about it, a page on the website isn't a bad idea. I've added a note pointing to this discussion. The document now appears at http://numpy.scipy.org/NA-overview.html Why not have a separate repo for neps/discussion docs? That way, people can be added to the team as they need to edit them and removed when done, and it's separate from the main site itself. The site can simply have a link to this set of documents, which can be built, tracked, separately and cleanly. We have more or less that setup with ipython for the site and docs: - main site page that points to the doc builds: http://ipython.org/documentation.html - doc builds on a secondary site: http://ipython.org/ipython-doc/stable/index.html That's pretty much how things already work. The documentation is in the main source tree and built docs end up at http://docs.scipy.org. NEPs live at https://github.com/numpy/numpy/tree/master/doc/neps, but don't get published outside of the source tree and there's no preferred place for discussion documents. (assuming we'll have a nice website for numpy one day) Ha ha ha ;-) Thanks for the thoughts and prodding. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Missing data wrap-up and request for comments
On 9 May 2012 18:46, Travis Oliphant tra...@continuum.io wrote: The document is available here: https://github.com/numpy/numpy.scipy.org/blob/master/NA-overview.rst This is orthogonal to the discussion, but I'm curious as to why this discussion document has landed in the website repo? I suppose it's not a really big deal, but future uploads of the website will now include a page at http://numpy.scipy.org/NA-overview.html with the content of this document. If that's desirable, I'll add a note at the top of the overview referencing this discussion thread. If not it can be relocated somewhere more desirable after this thread's discussion deadline expires.. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy governance update
On 16 February 2012 15:08, Thomas Kluyver tak...@gmail.com wrote: It strikes me that the effort everyone's put into this thread could have by now designed some way to resolve disputes. ;-) This is not intended to downplay the concerns raised in this thread, but I can't help myself. I propose the following (tongue-in-cheek) patch against the current numpy master branch. https://github.com/scottza/numpy/compare/constitution If this gets enough interest, I'll consider submitting a real pull request ;-) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy governance update
On 16 February 2012 17:31, Bruce Southey bsout...@gmail.com wrote: On 02/16/2012 08:06 AM, Scott Sinclair wrote: This is not intended to downplay the concerns raised in this thread, but I can't help myself. I propose the following (tongue-in-cheek) patch against the current numpy master branch. https://github.com/scottza/numpy/compare/constitution If this gets enough interest, I'll consider submitting a real pull request ;-) Now that is totally disrespectful and just plain ignorant! Not to mention the inability to count people correctly. I'm sorry that you feel that way and apologize if I've offended you. I didn't expect to and assure you that was not my intention. That said, I do hope that we can continue to make allowance for (very occasional) levity in the community. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Download page still points to SVN
On 19 January 2012 00:44, Fernando Perez fperez@gmail.com wrote: On Wed, Jan 18, 2012 at 2:18 AM, Scott Sinclair scott.sinclair...@gmail.com wrote: It's rather confusing having two websites. The official page at http://www.scipy.org/Download points to github. The problem is that this page, which looks pretty official to just about anyone: http://numpy.scipy.org/ takes you to the one at new.scipy... So as far as traps for the unwary go, this one was pretty cleverly laid out ;) The version of the numpy website now at http://numpy.github.com no longer points to the misleading and outdated new.scipy.org (an updated version of that site is at http://scipy.github.com). I think that numpy.scipy.org should be redirected to numpy.github.com as outlined at pages.github.com (see section on Custom Domains), and that it should happen sooner rather than later. Unfortunately I have no idea who has access to the DNS records (Ognen Duzlevski @ Enthought?). This change would remove one of the ways that people are currently directed to new.scipy.org. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Download page still points to SVN
On 8 February 2012 00:03, Travis Oliphant tra...@continuum.io wrote: On Feb 7, 2012, at 4:02 AM, Pauli Virtanen wrote: Hi, 06.02.2012 20:41, Ralf Gommers kirjoitti: [clip] I've created https://github.com/scipy/scipy.github.com and gave you permissions on that. So with that for the built html and https://github.com/scipy/scipy.org-new for the sources, that should do it. On the numpy org I don't have the right permissions to do the same. Ditto for numpy.github.com, now. This is really nice. It will really help us make changes to the web-site quickly and synchronously with code changes. John Turner at ORNL has the numpy.org domain and perhaps we could get him to point it to numpy.github.com It looks like numpy.org already redirects to numpy.scipy.org. So I think redirecting numpy.scipy.org to github should do the right thing Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Download page still points to SVN
On 15 February 2012 15:30, Fernando Perez fperez@gmail.com wrote: On Wed, Feb 15, 2012 at 5:18 AM, Ognen Duzlevski og...@enthought.com wrote: It looks like numpy.org already redirects to numpy.scipy.org. So I think redirecting numpy.scipy.org to github should do the right thing I can do this - can I assume there is consensus that majority wants this done? +1, and thanks to Scott for pushing on this front! Thanks Ognen. I think you can assume that there's consensus after a few +1's from core developers... Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] [ANN] new solver for multiobjective optimization problems
On 10 February 2012 17:59, Neal Becker ndbeck...@gmail.com wrote: And where do we find this gem? Presumably by following the hyper-links in the e-mail (non-obvious if you're using a plain-text mail client..) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Download page still points to SVN
2012/2/8 Stéfan van der Walt ste...@sun.ac.za: On Tue, Feb 7, 2012 at 2:03 PM, Travis Oliphant tra...@continuum.io wrote: John Turner at ORNL has the numpy.org domain and perhaps we could get him to point it to numpy.github.com Remember to also put a CNAME file in the root of the repository: http://pages.github.com/ Hi Pauli, I see that you've added the CNAME file. Now numpy.github.com is being redirected to numpy.scipy.org (the old site). As I understand it, whoever controls the scipy.org DNS settings needs point numpy.scipy.org at numpy.github.com so that people get the updated site when they browse to numpy.scipy.org.. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Download page still points to SVN
On 6 February 2012 21:41, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Mon, Feb 6, 2012 at 8:17 AM, Scott Sinclair scott.sinclair...@gmail.com wrote: On 5 February 2012 13:07, Ralf Gommers ralf.gomm...@googlemail.com wrote: Does it need to be a new repo, or would permissions on https://github.com/numpy/numpy.scipy.org work as well? Yes a new repo is required. Github will render html checked into a repo called https://github.com/numpy/numpy.github.com at http://numpy.github.com. Since the html is built from reST sources using Sphinx, we'd need a repo for the website source (https://github.com/numpy/numpy.github.com) and a repo to check the built html into (https://github.com/numpy/numpy.github.com). To update the website will require push permissions to both repos. I've created https://github.com/scipy/scipy.github.com and gave you permissions on that. So with that for the built html and https://github.com/scipy/scipy.org-new for the sources, that should do it. On the numpy org I don't have the right permissions to do the same. The updated version of the 'old' new.scipy.org is now at http://scipy.github.com/. There are still a few things that I think need to get cleaned up. I'll ping the scipy mailing list in the next week or two to start the discussion on redirecting scipy.org and www.scipy.org, as well as solicit comments on the website content. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Download page still points to SVN
On 5 February 2012 13:07, Ralf Gommers ralf.gomm...@googlemail.com wrote: On 20/01/12 08:49, Scott Sinclair wrote: On 19 January 2012 21:48, Fernando Perezfperez@gmail.com wrote: We've moved to the following setup with ipython, which works very well for us so far: 1. ipython.org: Main website with only static content, manged as a repo in github (https://github.com/ipython/ipython-website) and updated with a gh-pages build (https://github.com/ipython/ipython.github.com). I like this idea, and to get the ball rolling I've stripped out the www directory of the scipy.org-new repo into it's own repository using git filter-branch (posted here: https://github.com/scottza/scipy_website) and created https://github.com/scottza/scottza.github.com. This puts a copy of the new scipy website at http://scottza.github.com as a proof of concept. Nice! Since there seems to be some agreement on rehosting numpy's website on github, I'd be happy to do as much of the legwork as I can in getting the numpy.scipy.org content hosted at numpy.github.com. I don't have permission to create new repos for the Numpy organization, so someone would have to create an empty https://github.com/numpy/numpy.github.com and give me push permission on that repo. Does it need to be a new repo, or would permissions on https://github.com/numpy/numpy.scipy.org work as well? Yes a new repo is required. Github will render html checked into a repo called https://github.com/numpy/numpy.github.com at http://numpy.github.com. Since the html is built from reST sources using Sphinx, we'd need a repo for the website source (https://github.com/numpy/numpy.github.com) and a repo to check the built html into (https://github.com/numpy/numpy.github.com). To update the website will require push permissions to both repos. The IPython team have scripts to automate the update, build and commit process for their website, which we could borrow from. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Download page still points to SVN
On 18 January 2012 11:22, Fernando Perez fperez@gmail.com wrote: I was just pointing a colleague to the 'official download page' for numpy so he could find how to grab current sources: http://new.scipy.org/download.html but I was quite surprised to find that it still points to SVN for both numpy and scipy. It would probably not be a bad idea to update those and point them to github... It's rather confusing having two websites. The official page at http://www.scipy.org/Download points to github. There hasn't been much maintenance effort for new.scipy.org, and there was some recent discussion about taking it offline. I'm not sure if a firm conclusion was reached. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Download page still points to SVN
On 19 January 2012 00:44, Fernando Perez fperez@gmail.com wrote: On Wed, Jan 18, 2012 at 2:18 AM, Scott Sinclair scott.sinclair...@gmail.com wrote: It's rather confusing having two websites. The official page at http://www.scipy.org/Download points to github. The problem is that this page, which looks pretty official to just about anyone: http://numpy.scipy.org/ takes you to the one at new.scipy... So as far as traps for the unwary go, this one was pretty cleverly laid out ;) It certainly is. I think (as usual), the problem is that fixing the situation lies on the shoulders of people who are already heavily overburdened.. There is a pull request updating the offending page at https://github.com/scipy/scipy.org-new/pull/1 if any overburdened types feel like merging, building and uploading the revised html. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] index the last several members of a ndarray
On 18 October 2011 13:56, Chao YUE chaoyue...@gmail.com wrote: but it's strange that if you use b[...,-1], you get: In [402]: b[...,-1] Out[402]: array([ 9, 19]) if use b[...,-4:-1], you get: Out[403]: array([[ 6, 7, 8], [16, 17, 18]]) That's because you're mixing two different indexing constructs. In the first case, you're using direct indexing, so you get the values in b at the index you specify. In the second example you're using slicing syntax, where you get the values in b at the range of indices starting with -4 and ending *one before* -1 i.e. the values at b[..., -2]. Here's a simpler example: In [1]: a = range(5) In [2]: a Out[2]: [0, 1, 2, 3, 4] In [3]: a[0] Out[3]: 0 In [4]: a[2] Out[4]: 2 In [5]: a[0:2] Out[5]: [0, 1] In [6]: a[-3] Out[6]: 2 In [7]: a[-1] Out[7]: 4 In [8]: a[-3:-1] Out[8]: [2, 3] Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] ANN: Numpy 1.6.1 release candidate 1
On 13 June 2011 17:11, Derek Homeier de...@astro.physik.uni-goettingen.de wrote: you're right - I've tried to download the tarball, but am getting connection errors or incomplete downloads from all available SF mirrors, and apparently I was still too thick to figure out how to checkout a specific tag... I find the cleanest way is to checkout the tag in a new branch: $ git checkout -b release/v1.6.1rc1 v1.6.1rc1 Switched to a new branch 'release/v1.6.1rc1' Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Install error for numpy 1.6
On 12 June 2011 21:08, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Sun, Jun 12, 2011 at 9:00 PM, Laurent Gautier lgaut...@gmail.com wrote: I did not find the following problem reported. When trying to install Numpy 1.6 with Python 2.7.1+ (r271:86832), gcc 4.5.2, and pip 1.0.1 (through a virtualenv 1.4.2 Python) it fails fails with: File /usr/lib/python2.7/distutils/command/config.py, line 103, in _check_compiler customize_compiler(self.compiler) File /usr/lib/python2.7/distutils/ccompiler.py, line 44, in customize_compiler cpp = cc + -E # not always TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' Complete output from command python setup.py egg_info: Running from numpy source directory.non-existing path in 'numpy/distutils': 'site.cfg' Looks like a new one. Does a normal python setup.py in your activated virtualenv work? If not, something is wrong in your environment. If it does work, you have your workaround. See http://mail.scipy.org/pipermail/numpy-discussion/2011-June/056544.html for a workaround (at least to get python setup.py install working, I haven't tried with pip/easy_install etc..) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] git source datetime build error
On 8 June 2011 17:27, Mark Wiebe mwwi...@gmail.com wrote: I've committed a fix for x86_64 as well now. Sorry for the breakage! Works for me. (numpy-master-2.7)scott@godzilla:~$ python -c import numpy; numpy.test() Running unit tests for numpy NumPy version 2.0.0.dev-76ca55f NumPy is installed in /home/scott/.virtualenvs/numpy-master-2.7/local/lib/python2.7/site-packages/numpy Python version 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) [GCC 4.5.2] nose version 0.11.4 .snip.. -- Ran 3212 tests in 14.816s OK (KNOWNFAIL=3, SKIP=6) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] Problem installing Numpy in virtualenv
Hi, This is a response to http://mail.scipy.org/pipermail/numpy-discussion/2011-April/055908.html A cleaner workaround that doesn't mess with your system Python (see https://github.com/pypa/virtualenv/issues/118) Activate the virtualenv mkdir $VIRTUAL_ENV/local ln -s $VIRTUAL_ENV/lib $VIRTUAL_ENV/local/lib Install Numpy Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy question
On 26 May 2011 10:37, Talla jta...@gmail.com wrote: C:\Python27 In addition when I run import command I got ('import' is not recognized as an internal or external command, operable program or batch file.) import is not a command you can run at your command line, it's part of Python. Do something like this instead: C:\Python27 cd C:\ C:\python # Should start the Python interpreter, print python version etc. import numpy print(numpy.arange(3)) It will be worth taking some time to read a basic Python tutorial. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Willing to contribute to SciPy NumPy ...
On 31 March 2011 07:27, Sylvain Bellemare sbel...@gmail.com wrote: I would like to seriously start contributing to NumPy and/or SciPy, as much as I possibly can. I'm sure that your help will be welcomed! A good place to get started is helping out with documentation (see http://docs.scipy.org/numpy/Front%20Page/). SciPy has plenty of work required - you'll probably learn your way into the code that way. Another place to look is http://www.scipy.org/Developer_Zone. It's worthwhile learning how to work with Git and Github if you want to get patches accepted more easily. Cheers, Scott ___ 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 31 March 2011 11:37, Pearu Peterson pearu.peter...@gmail.com wrote: On Thu, Mar 31, 2011 at 12:19 PM, David Cournapeau courn...@gmail.com wrote: On Wed, Mar 30, 2011 at 7:22 AM, Russell E. Owen ro...@uw.edu wrote: In article AANLkTi=eeg8kl7639imrtl-ihg1ncqyolddsid5tf...@mail.gmail.com, Ralf Gommers ralf.gomm...@googlemail.com wrote: Hi, 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. Sources and binaries can be found at: http://sourceforge.net/projects/numpy/files/NumPy/1.6.0b1/ For (preliminary) release notes see below. I see a segfault on Ubuntu 64 bits for the test TestAssumedShapeSumExample in numpy/f2py/tests/test_assumed_shape.py. Am I the only one seeing it ? The test work here ok on Ubuntu 64 with numpy master. Could you try the maintenance/1.6.x branch where the related bugs are fixed. For what it's worth, the maintenance/1.6.x branch works for me on 64-bit Ubuntu: (numpy-1.6.x)scott@godzilla:~$ python -c import numpy; numpy.test() Running unit tests for numpy NumPy version 1.6.0b2.dev-a172fd6 NumPy is installed in /home/scott/.virtualenvs/numpy-1.6.x/lib/python2.6/site-packages/numpy Python version 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] nose version 1.0.0 snip... -- Ran 3406 tests in 16.889s OK (KNOWNFAIL=3, SKIP=4) Cheers, Scott ___ 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 31 March 2011 12:18, Pearu Peterson pearu.peter...@gmail.com wrote: On Thu, Mar 31, 2011 at 1:00 PM, Scott Sinclair scott.sinclair...@gmail.com wrote: For what it's worth, the maintenance/1.6.x branch works for me on 64-bit Ubuntu: (numpy-1.6.x)scott@godzilla:~$ python -c import numpy; numpy.test() You might want to run python -c import numpy; numpy.test('full') as the corresponding test is decorated as slow. python -c import numpy; numpy.test('full') Running unit tests for numpy NumPy version 1.6.0b2.dev-a172fd6 NumPy is installed in /home/scott/.virtualenvs/numpy-1.6.x/lib/python2.6/site-packages/numpy Python version 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] nose version 1.0.0 snip... Ran 3423 tests in 28.713s OK (KNOWNFAIL=3, SKIP=4) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Appending a numpy array to binary file
On 22 March 2011 17:22, Robert Kern robert.k...@gmail.com wrote: On Tue, Mar 22, 2011 at 05:37, Alessandro alessandro.sangina...@polito.it wrote: Hi everybody, I'm trying to append, inside a loop, into a binary file some arrays using numpy.save(file, arr) but wvhen I open it there is only the last array I saved. If I use savetxt it works perfectly. Do you know how can I append data to a binary file inside a loop? Example: x = arange(10) fp = open(TempFile,ab) for i in range(3): save(fp,x) fp.close() Data saved into the file is: [0,1,2,3,4,5,6,7,8,9] but I would like: [0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9 0,1,2,3,4,5,6,7,8,9] The data is actually saved three times... You can read all three arrays by doing repeated np.load() calls on the same file object: fp = open('TempFile', 'rb') for i in range(3): print np.load(fp) You can also use numpy.savez if you want to save several arrays and read them back with a single call to numpy.load. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] When was the ddof kwarg added to std()?
On 16 March 2011 14:52, Darren Dale dsdal...@gmail.com wrote: Does anyone know when the ddof kwarg was added to std()? Has it always been there? Does 'git log --grep=ddof' help? Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Porting numpy to Python3
On 25 February 2011 06:22, Algis Kabaila akaba...@pcug.org.au wrote: On Friday 25 February 2011 14:44:07 Algis Kabaila wrote: PS: a little investigation shows that my version of numpy is 1.3.0 and scipy is 0.7.2 - so ubuntu binaries are way behind the bleeding edge... ... and built for the system Python (2.6), so even if the Ubuntu binaries were more up to date you'd need to build your own Numpy for Python 3. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Regrading Numpy Documentation ...
On 15 November 2010 12:02, srinivas zinka zink...@gmail.com wrote: I downloaded the Numpy reference guide in HTML format from the following link: http://docs.scipy.org/doc/ My intension is to use this documentation in offline mode. But, in offline mode, I am unable to search the document using quick search option. (However, I can search the same document on the documentation website). I would like to know, if there is any other way to search the entire HTML reference guide in offline mode. That's strange. I've just downloaded the zip file of HTML pages and the quick search works fine in offline mode. Can you specify which zip file you downloaded e.g. http://docs.scipy.org/doc/numpy/numpy-html.zip, http://docs.scipy.org/doc/numpy-1.5.x/numpy-html.zip etc. Exactly what goes wrong when you try to use the quick search? Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Regrading Numpy Documentation ...
On 15 November 2010 14:15, srinivas zinka zink...@gmail.com wrote: Thank you for the reply. I just downloaded the following zip file: http://docs.scipy.org/doc/numpy-1.5.x/numpy-html.zip When I try to search for some thing (e.g., array), it keeps on searching (see the attached file). At the same time, I am able to search the HTML files downloaded from the python website: http://docs.python.org/ This is only happening on my Ubuntu system. But, on Windows, I have no problem with searching. I am not sure what the problem is. But, I think it has some thing to do with the operating system or JAVA!. by the way, these are my system specifications: OS: Ubuntu 10.10 Browser: Chromium I do see the same problem as you using Chromium on Ubuntu, but have no trouble using Firefox. Even more strange, it only happens with the Numpy and Scipy documentation, not Sphinx documentation I've built for my own projects. I guess the workaround is to try using Firefox on Ubuntu.. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Trouble cloning numpy Github repo over HTTP
On 30 September 2010 10:15, Scott Sinclair scott.sinclair...@gmail.com wrote: I'm behind a firewall that doesn't allow me to use the git protocol so I can't use the git:// URL. I see the following problem: $ git clone http://github.com/numpy/numpy.git numpy Initialized empty Git repository in /home/scott/external_repos/numpy/.git/ error: RPC failed; result=22, HTTP code = 417 I never have trouble cloning other repos off of Github over HTTP. For what it's worth, someone posted a work-around at http://support.github.com/discussions/repos/4323-error-rpc-failed-result22-http-code-411 that works for me.. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Developmental version numbering with git
On 8 November 2010 23:17, Matthew Brett matthew.br...@gmail.com wrote: Since the change to git the numpy version in setup.py is '2.0.0.dev' regardless because the prior numbering was determined by svn. Is there a plan to add some numbering system to numpy developmental version? Regardless of the answer, the 'numpy/numpy/version.py' will need to changed because of the reference to the svn naming. In case it's useful, we (nipy) went for a scheme where the version number stays as '2.0.0.dev', but we keep a record of what git commit has we are on - described here: http://web.archiveorange.com/archive/v/AW2a1CzoOZtfBfNav9hd I can post more details of the implementation if it's of any interest, In the meantime there's a patch in that direction here: https://github.com/numpy/numpy/pull/12 Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Development workflow
On 12 October 2010 11:58, David da...@silveregg.co.jp wrote: On 10/12/2010 06:48 PM, Pierre GM wrote: Corollary: how do I branch from a branch ? You use the branch command: git branch target_branch source_branch But generally, if you want to create a new branch to start working on it, you use the -b option of checkout: git branch -b target_branch source_branch Minor typo alert (to avoid confusing people). The above command should be: git checkout -b new_branch source_branch which is equivalent to git branch target_branch source_branch git checkout target_branch Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] Trouble cloning numpy Github repo over HTTP
Hi, I'm behind a firewall that doesn't allow me to use the git protocol so I can't use the git:// URL. I see the following problem: $ git clone http://github.com/numpy/numpy.git numpy Initialized empty Git repository in /home/scott/external_repos/numpy/.git/ error: RPC failed; result=22, HTTP code = 417 I never have trouble cloning other repos off of Github over HTTP. See http://support.github.com/discussions/repos/4323-error-rpc-failed-result22-http-code-411 Does anyone else see this problem? Thanks, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Trouble cloning numpy Github repo over HTTP
On 30 September 2010 17:15, Aaron River ari...@enthought.com wrote: If you're allowed access to arbitrary https urls, try: git clone https://github.com/numpy/numpy.git numpy Thanks Aaron. I'm pretty sure I tried that and failed, but I'm at home now (no proxy) but will try again tomorrow. Looks like our proxy might be at fault. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] endian.h change
On 30 July 2010 19:08, Ralf Gommers ralf.gomm...@googlemail.com wrote: Commit r8541 broke building with numscons for me, does this fix look okay: http://github.com/rgommers/numpy/commit/1c88007ab00cf378ebe19fbe54e9e868212c73d1 I am puzzled though why my endian.h is not picked up in the build - I have a good collection of those on my system, at least in all OS X SDKs. Any idea? See also http://mail.scipy.org/pipermail/scipy-dev/2010-July/015400.html David C's recent fix for r8541 solves the numpy import problem on Linux. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Complex128
On 19 July 2010 10:23, Pauli Virtanen p...@iki.fi wrote: Sun, 18 Jul 2010 21:15:15 -0500, Ross Harder wrote: mac os x leopard 10.5.. EPD installed i just don't understand why i get one thing when i ask for another. i can get what i want, but only by not asking for it. Do you get the same behavior also from import numpy as np np.array([0,0], dtype=np.complex256) I see: Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. import numpy as np np.__version__ '1.4.1' np.array([0,0], dtype='Complex128') array([0.0+0.0j, 0.0+0.0j], dtype=complex256) np.array([0,0], dtype='Complex64') array([ 0.+0.j, 0.+0.j]) np.array([0,0], dtype='Complex64').dtype dtype('complex128') np.array([0,0], dtype='complex128') array([ 0.+0.j, 0.+0.j]) np.array([0,0], dtype='complex128').dtype dtype('complex128') np.array([0,0], dtype='complex64') array([ 0.+0.j, 0.+0.j], dtype=complex64) np.array([0,0], dtype=np.complex128) array([ 0.+0.j, 0.+0.j]) np.array([0,0], dtype=np.complex128).dtype dtype('complex128') np.array([0,0], dtype=np.complex64) array([ 0.+0.j, 0.+0.j], dtype=complex64) on Ubuntu 64 bit. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Function returns nothing!
On 12 July 2010 11:45, allan oware lumte...@gmail.com wrote: Hi All! def height_diffs(): h = [] i = 0 while True: x = raw_input(Enter height difference ) if x == 'q': break else: h.append(x) i = i + 1 m = asarray(h,dtype=float) return m why does return statement return nothing? It works for me. Can you explain what you mean by return nothing? Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Newby question: best way to create a list of indices
On 9 June 2010 12:01, Hanlie Pretorius hanlie.pretor...@gmail.com wrote: I'm reading netCDF files using pupynere and I want to extract 22 values from a 1440x400 array. I have the indices of the values, they are: 92 832 92 833 91 832 91 833 ... What is the best way to store these indices so that I can programmatically extract the values? I have tried storing them in pairs - (index1='92,832') - and then I can use: - precipitation.data[int(index1[:2]),int(index1[3:])] - Is there a better way? The values are also not regular enough to use a nested loop, as far as I can see. This is a use case where NumPy is very convenient. You can use fancy indexing import numpy as np a = np.random.random((1440, 400)) rows = [832, 833, 832, 833] # first 4 rows cols = [92, 92, 91, 91] # first 4 cols a[rows, cols] array([ 0.56539344, 0.14711586, 0.40491459, 0.29997256]) a[832, 92] # check 0.56539343852732926 Read more here http://docs.scipy.org/doc/numpy/user/basics.indexing.html#index-arrays Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] typo in docs
On 8 June 2010 09:46, Sebastian Haase seb.ha...@gmail.com wrote: Hi, http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html#specifying-and-constructing-data-types says f2 instead of f1 Numarray introduced a short-hand notation for specifying the format of a record as a comma-separated string of basic formats. ... The generated data-type fields are named 'f0', 'f2', ..., 'fN-1' Is there a way for me to directly fix this kind of bug ? - Yes. You can edit documentation using the Documentation editor. Register a user name here http://docs.scipy.org/numpy/accounts/register/ and then post your user name to the scipy-dev list for someone to give your account edit rights (see Before you start at http://docs.scipy.org/numpy/Front Page/ for more detail) The page with the typo you spotted is at http://docs.scipy.org/numpy/docs/numpy-docs/reference/arrays.dtypes.rst/. It's been corrected now. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy.savez does /not/ compress!?
2010/6/8 Hans Meine me...@informatik.uni-hamburg.de: I just wondered why numpy.load(foo.npz) was so much faster than loading (gzip-compressed) hdf5 file contents, and found that numpy.savez did not compress my files at all. But is that intended? The numpy.savez docstring says Save several arrays into a single, *compressed* file in ``.npz`` format. (emphasis mine), so I guess this might be a bug, or at least a missing feature. In fact, the implementation simply uses the zipfile.ZipFile class, without specifying the 'compression' argument to the constructor. From http://docs.python.org/library/zipfile.html : `compression` is the ZIP compression method to use when writing the archive, and should be ZIP_STORED or ZIP_DEFLATED; unrecognized values will cause RuntimeError to be raised. If ZIP_DEFLATED is specified but the zlib module is not available, RuntimeError is also raised. The default is ZIP_STORED. The savez docstring should probably be clarified to provide this information. I guess that the default (uncompressed Zip) is used because specifying the compression as ZIP_DEFLATED requires zlib to be installed on the system (see zipfile.ZipFile docstring). Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy.savez does /not/ compress!?
2010/6/8 Hans Meine me...@informatik.uni-hamburg.de: On Tuesday 08 June 2010 11:40:59 Scott Sinclair wrote: The savez docstring should probably be clarified to provide this information. I would prefer to actually offer compression to the user. In the meantime, I've edited the docstring to reflect the current behaviour (http://docs.scipy.org/numpy/docs/numpy.lib.npyio.savez/). Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Updating Packages in 2.5 (win/numpy) and Related Matters
On 18 February 2010 05:30, Wayne Watson sierra_mtnv...@sbcglobal.net wrote: On 2/16/2010 10:01 PM, Scott Sinclair wrote: Wayne - The DeprecationWarnings are being raised by SciPy, not by your code. You probably don't have a recent version of SciPy installed. The most recent release of SciPy is 0.7.1 and works with NumPy 1.3.0. I don't think you will see the warnings if you upgrade SciPy and NumPy on your system. Check your NumPy and SciPy versions at a python prompt as follows: import numpy as np print np.__version__ import scipy as sp print sp.__version__ You will need to completely remove the old versions if you choose to upgrade. You should be able to do this from Add/Remove Programs. I'm on win7's Add/Remove numpy. No scipy. I just checked the version via import and it's 0.6.0. You can download the latest NumPy and SciPy installers from: http://sourceforge.net/projects/numpy/files/ and http://sourceforge.net/projects/scipy/files/ You want the win32-superpack for your Python version. Use Add/Remove to remove your current NumPy install (if your version is not already 1.3.0). I'm not sure how SciPy was installed and why it doesn't appear in Add/Remove. You should look in C:\Python25\Lib\site-packages for directories named numpy or scipy (numpy should have been removed already). It is safe to delete C:\Python25\Lib\site-packages\scipy. Then run the superpack installers and you should be good to go. Good luck. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Updating Packages in 2.5 (win/numpy) and Related Matters
On 17 February 2010 07:25, josef.p...@gmail.com wrote: On Wed, Feb 17, 2010 at 12:10 AM, Wayne Watson sierra_mtnv...@sbcglobal.net wrote: Hi, I'm working on a 1800+ line program that uses tkinter. Here are the messages I started getting recently. (I finally figured out how to copy them.). The program goes merrily on its way despite them. s\sentusersentuser_20080716NoiseStudy7.py C:\Python25\lib\site-packages\scipy\misc\__init__.py:25: DeprecationWarning: Num pyTest will be removed in the next release; please update your code to use nose or unittest test = NumpyTest().test DeprecationWarnings mean some some functionality in numpy (or scipy) has changed and the old way of doing things will be removed and be invalid in the next version. During depreciation the old code still works, but before you upgrade you might want to check whether and how much you use these functions and switch to the new behavior. In the case of numpy.test, it means that if you have tests written that use the numpy testing module, then you need to switch them to the new nose based numpy.testing. And you need to install nose for running numpy.test() Wayne - The DeprecationWarnings are being raised by SciPy, not by your code. You probably don't have a recent version of SciPy installed. The most recent release of SciPy is 0.7.1 and works with NumPy 1.3.0. I don't think you will see the warnings if you upgrade SciPy and NumPy on your system. Check your NumPy and SciPy versions at a python prompt as follows: import numpy as np print np.__version__ import scipy as sp print sp.__version__ You will need to completely remove the old versions if you choose to upgrade. You should be able to do this from Add/Remove Programs. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Vector interpolation on a 2D grid (with realistic results)
2009/11/8 Pierre GM pgmdevl...@gmail.com: Chris, I gonna poke around and try to find some kriging algorithms. I'll report in a few. In the meantime, if anybody has anythng already implemented, please just let us know. A little late with the reply. I've used gstat (http://www.gstat.org/) in two ways 1) by running the executable from Python using os.system() and 2) using the rpy interface to the gstat R package. It's a little clunky but works and is quick and easy to set up. If you need to see some code for option 2 I can dig it up. You might also look at SGEMS http://sgems.sourceforge.net/ there is a Python interface, but I haven't used it. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] documenting optional out parameter
2009/10/26 Brent Pedersen bpede...@gmail.com: hi, i've seen this section: http://docs.scipy.org/numpy/Questions+Answers/#the-out-argument should _all_ functions with an optional out parameter have exactly that text? so if i find a docstring with reasonable, but different doc for out, should it be changed to that? The QA doesn't seem to have reached a firm conclusion, so I'd suggest that any correct and reasonable documentation of the out parameter is fine. and if a docstring of a function with an optional out that needs review does not have the out parameter documented should it be marked as 'Needs Work'? I'd say yes, since the docstring is incomplete in this case. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] defmatrix move - new docstrings disappeared
2009/9/17 Pauli Virtanen p...@iki.fi: to, 2009-09-17 kello 18:19 +0200, Scott Sinclair kirjoitti: [clip] It's probably important that the documentation patches should be committed pretty soon after being reviewed for obvious malicious code and marked OK to Apply. It's possible to edit docstrings that are marked as OK to apply, without this flag being removed. If that's possible, then it's a bug. But I don't see how that can happen -- do you have an example how to do this kind of edits that don't reset the ok_to_apply flag? No I don't, I've just tried it and the flag is correctly reset. I am certain that I edited a docstring some time ago without the flag being reset, but can't reproduce that action now. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] identity
2009/8/12 Keith Goodman kwgood...@gmail.com: On Wed, Aug 12, 2009 at 7:24 AM, Keith Goodmankwgood...@gmail.com wrote: On Wed, Aug 12, 2009 at 1:31 AM, Lars Bittrichlars.bittr...@googlemail.com wrote: a colleague made me aware of a speed issue with numpy.identity. Since he was using numpy.diag(numpy.ones(N)) before, he expected identity to be at least as fast as diag. But that is not the case. We found that there was a discussion on the list (July, 20th; My identity by Keith Goodman). The presented solution was much faster. Someone wondered if the change was already made in the svn. Things tend to get lost on the mailing list. The next step would be to file a ticket on the numpy trac. (I've never done that) That would increase the chance of someone important taking a look at it. Here's the ticket: http://projects.scipy.org/numpy/ticket/1193 A patch against recent SVN trunk is attached to the ticket. Please review... Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] memmap, write through and flush
2009/8/12 Robert Kern robert.k...@gmail.com: On Sat, Aug 8, 2009 at 21:33, Tom Kuiperkui...@jpl.nasa.gov wrote: There is something curious here. The second flush() fails. Can anyone explain this? numpy.append() does not append values in-place. It is just a convenience wrapper for numpy.concatenate(). Meaning that a copy of the data is returned in an ndarray, so when you do fp = np.append(fp, [[12,13,14,15]], 0) The name fp is no longer bound to a memmap, hence AttributeError: 'numpy.ndarray' object has no attribute 'flush' Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] strange sin/cos performance
2009/8/5 Andrew Friedley afrie...@indiana.edu: Is anyone with this problem *not* running ubuntu? Me - RHEL 5.2 opteron: Python 2.6.1 (r261:67515, Jan 5 2009, 10:19:01) [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2 Fedora 9 PS3/PPC: Python 2.5.1 (r251:54863, Jul 17 2008, 13:25:23) [GCC 4.3.1 20080708 (Red Hat 4.3.1-4)] on linux2 Actually I now have some interesting results that indicate the issue isn't in Python or NumPy at all. I just wrote a C program to try to reproduce the error, and was able to do so (actually the difference is even larger). Opteron: float (32) time in usecs: 179698 double (64) time in usecs: 13795 PS3/PPC: float (32) time in usecs: 614821 double (64) time in usecs: 37163 I've attached the code for others to review and/or try out. I guess this is worth showing to the libc people? For whatever it's worth, not much difference on my machine 32-bit Ubuntu, GCC 4.3.3. float (32) time in usecs: 13804 double (64) time in usecs: 15394 Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Doc-editor internal error
Ignore the noise. Seems to be fixed now.. 2009/8/1 Scott Sinclair scott.sinclair...@gmail.com: Hi, I'm seeing 500 Internal Error at http://docs.scipy.org/numpy/stats/ Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Getting 95%/99% margin of ndarray
2009/7/22 Pierre GM pgmdevl...@gmail.com: You could try scipy.stats.scoreatpercentile, scipy.stats.mstats.plottingposition or scipy.stats.mstats.mquantiles, which will all approximate quantiles of your distribution. It seems that mquantiles doesn't do what you'd expect when the limit keyword argument is specified. There's a patch for review here: http://codereview.appspot.com/97077 Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Getting 95%/99% margin of ndarray
2009/7/23 Pierre GM pgmdevl...@gmail.com: On Jul 23, 2009, at 6:07 AM, Scott Sinclair wrote: 2009/7/22 Pierre GM pgmdevl...@gmail.com: You could try scipy.stats.scoreatpercentile, scipy.stats.mstats.plottingposition or scipy.stats.mstats.mquantiles, which will all approximate quantiles of your distribution. It seems that mquantiles doesn't do what you'd expect when the limit keyword argument is specified. There's a patch for review here: Thx for the patch, I'll port it in the next few hours. However, I disagree with the last few lines (where the quantiles are transformed to a standard ndarray if the mask is nomask. For consistency, we should always have a MaskedArray, don't you think ? (And anyway, taking a view as a ndarray is faster than using np.asarray...) Agree it's more consistent to always return a MaskedArray. I don't remember why I chose to return an ndarray. I think that it was probably to do with the fact that an ndarray is returned when 'axis' isn't specified... import numpy as np import scipy as sp sp.__version__ '0.8.0.dev5874' from scipy.stats.mstats import mquantiles a = np.array([6., 47., 49., 15., 42., 41., 7., 39., 43., 40., 36.]) type(mquantiles(a)) type 'numpy.ndarray' type(mquantiles(np.ma.masked_array(a))) type 'numpy.ndarray' type(mquantiles(a, axis=0)) class 'numpy.ma.core.MaskedArray' This could be fixed by forcing _quantiles1D() to always return a MaskedArray. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] String to integer array of ASCII values
2009/7/23 David Goldsmith d_l_goldsm...@yahoo.com: --- On Thu, 7/23/09, Peter numpy-discuss...@maubp.freeserve.co.uk wrote: I should have guessed that one. Why isn't numpy.fromstring listed with the other entries in the From existing data section here? This looks like a simple improvement to the documentation... Yup, that it is; corrected here: http://docs.scipy.org/numpy/docs/numpy-docs/reference/routines.array-creation.rst/ But not yet showing up at your link. :-( That's because somebody needs to make a doc patch from the Wiki, apply it to SVN (or a local copy of) Numpy, rebuild the docs and post them on the web :) Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] argwhere does not accept py list
2009/7/8 Robert Kern robert.k...@gmail.com: 2009/7/4 Stéfan van der Walt ste...@sun.ac.za: Thanks, Scott. This should now be fixed in SVN. You should probably change that to asanyarray() before the masked array crowd gets upset. :-) I hadn't thought about that, but I'm don't think it matters in this case. MaskedArray.nonzero() returns a tuple of ndarrays... import numpy as np a = np.ma.array([4,0,2,1,3]) a masked_array(data = [4 0 2 1 3], mask = False, fill_value = 99) np.asarray(a) array([4, 0, 2, 1, 3]) np.asarray(a).nonzero() (array([0, 2, 3, 4]),) np.asanyarray(a) masked_array(data = [4 0 2 1 3], mask = False, fill_value = 99) np.asanyarray(a).nonzero() (array([0, 2, 3, 4]),) Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] argwhere does not accept py list
2009/7/8 Pierre GM pgmdevl...@gmail.com: On Jul 8, 2009, at 3:18 AM, Scott Sinclair wrote: 2009/7/8 Robert Kern robert.k...@gmail.com: 2009/7/4 Stéfan van der Walt ste...@sun.ac.za: Thanks, Scott. This should now be fixed in SVN. You should probably change that to asanyarray() before the masked array crowd gets upset. :-) I hadn't thought about that, but I'm don't think it matters in this case. MaskedArray.nonzero() returns a tuple of ndarrays... Taking np.asarray instead of np.asanyarray loses the mask, and you end up with the wrong result. Ouch. Obviously. Note to self - conduct extensive tests for unseasonal temperatures in hell before raising a KernError. Thanks for fixing Stéfan. Cheers, Scott ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] assigning ma.masked. Strange behavior
2009/7/4 Ben Park benpar...@gmail.com: import numpy as np import numpy.ma as ma # There is no effect on the following assignment of ma.masked. a1 = ma.arange(10).reshape((2,5)) a1.ravel()[np.array([0,2,2])] = ma.masked In some situations ravel has to return a copy of the data instead of a view. You're assigning ma.masked to elements of the copy, not tot elements of a1. a1 = ma.arange(10).reshape((2,5)) b = a1.ravel() b[np.array([0,2,2])] = ma.masked b masked_array(data = [-- 1 -- 3 4 5 6 7 8 9], mask = [ True False True False False False False False False False], fill_value = 99) a1 masked_array(data = [[0 1 2 3 4] [5 6 7 8 9]], mask = False, fill_value = 99) a1.ravel()[np.array([0,2,2])] = ma.masked a1 masked_array(data = [[0 1 2 3 4] [5 6 7 8 9]], mask = False, fill_value = 99) Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] argwhere does not accept py list
2009/7/3 Sebastian Haase seb.ha...@gmail.com: Hi, should this not be accepted: N.argwhere([4,0,2,1,3]) ? instead I get Traceback (most recent call last): File input, line 1, in module File ./numpy/core/numeric.py, line 510, in argwhere AttributeError: 'list' object has no attribute 'nonzero' N.argwhere(N.array([4,0,2,1,3])) [[0] [2] [3] [4]] N.__version__ '1.3.0' A fix could be a simple as applying the following diff (or similar + tests) Index: numpy/core/numeric.py === --- numpy/core/numeric.py (revision 7095) +++ numpy/core/numeric.py (working copy) @@ -535,7 +535,7 @@ [1, 2]]) -return asarray(a.nonzero()).T +return transpose(asarray(a).nonzero()) import numpy as np a = [4,0,2,1,3] np.argwhere(a) Traceback (most recent call last): File stdin, line 1, in module File /home/scott/.virtualenvs/numpy-dev/lib/python2.6/site-packages/numpy/core/numeric.py, line 538, in argwhere return asarray(a.nonzero()).T AttributeError: 'list' object has no attribute 'nonzero' np.argwhere(np.asarray(a)) array([[0], [2], [3], [4]]) np.transpose(np.asarray(a).nonzero()) array([[0], [2], [3], [4]]) Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Array resize question
2009/6/16 Cristi Constantin darkg...@yahoo.com Good day. I have this array: a = array([[u'0', u'0', u'0', u'0', u'0', u' '], [u'1', u'1', u'1', u'1', u'1', u' '], [u'2', u'2', u'2', u'2', u'2', u' '], [u'3', u'3', u'3', u'3', u'3', u' '], [u'4', u'4', u'4', u'4', u'4', u'']], dtype='U1') I want to resize it, but i don't want to alter the order of elements. a.resize((5,10)) # Will result in array([[u'0', u'0', u'0', u'0', u'0', u' ', u'1', u'1', u'1', u'1'], [u'1', u' ', u'2', u'2', u'2', u'2', u'2', u' ', u'3', u'3'], [u'3', u'3', u'3', u' ', u'4', u'4', u'4', u'4', u'4', u''], [u'', u'', u'', u'', u'', u'', u'', u'', u'', u''], [u'', u'', u'', u'', u'', u'', u'', u'', u'', u'']], dtype='U1') That means all my values are mutilated. What i want is the order to be kept and only the last elements to become empty. Like this: array([[u'0', u'0', u'0', u'0', u'0', u' ', u'', u'', u'', u''], [u'1', u'1', u'1', u'1', u'1', u' ', u'', u'', u'', u''], [u'2', u'2', u'2', u'2', u'2', u' ', u'', u'', u'', u''], [u'3', u'3', u'3', u'3', u'3', u' ', u'', u'', u'', u''], [u'4', u'4', u'4', u'4', u'4', u' ', u'', u'', u'', u'']], dtype='U1') I tried to play with resize like this: a.resize((5,10), refcheck=True, order=False) # SystemError: NULL result without error in PyObject_Call vCont1.resize((5,10),True,False) # TypeError: an integer is required Can anyone tell me how this resize function works ? I already checked the help file : http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.resize.html The resize method of ndarray is currently broken when the 'order' keyword is specified, which is why you get the SystemError http://projects.scipy.org/numpy/ticket/840 It's also worth knowing that the resize function and the ndarray resize method both behave a little differently. Compare: http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.resize.html and http://docs.scipy.org/doc/numpy/reference/generated/numpy.resize.html Basically, the data in your original array is inserted into the new array in the one dimensional order that it's stored in memory and any remaining space is filled with repeats of the data (resize function) or packed with zero's (resize array method). # resize function import numpy as np a = np.array([[1, 2],[3, 4]]) print a [[1 2] [3 4]] print np.resize(a, (3,3)) [[1, 2, 3], [4, 1, 2], [3, 4, 1]]) #resize array method b = np.array([[1, 2],[3, 4]]) print b [[1 2] [3 4]] b.resize((3,3)) print b [[1 2 3] [4 0 0] [0 0 0]] Neil's response gives you what you want in this case. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Question about memmap
2009/6/10 David Goldsmith d_l_goldsm...@yahoo.com: My present job - and the Summer Numpy Doc Marathon - is premised on making changes/additions through the Wiki; if anyone other than registered developers is to be messing w/ the rst, it's news to me. At this point, someone who knows should please step in and clearly explain the relationship between the Wiki and the rst (or point to the place on the Wiki where this is explained). Thanks! DG To add to Robert's eplanation. The front page of the Doc-Wiki says: You do not need to be a SciPy developer to contribute, as any documentation changes committed directly to the Subversion repository by developers are automatically propogated here on a daily basis. This means that you can be sure the documentation reflected here is in sync with the most recent Scipy development efforts. All of the documentation in the Wiki is actually stored as plain text in rst format (this is what you see when you click on the edit link). The files are stored in a separate subversion repository to the official NumPy and SciPy repositories. The Doc-Wiki simply renders the rst formatted text and provides nice functionality for editing and navigating the documentation. For documentation to get from the Wiki's repo to the main NumPy and SciPy repo's someone (with commit privileges) must make a patch and apply it. Visit http://docs.scipy.org/numpy/patch/ and generate a patch to see what I mean. Any changes a developer checks into the main repo's will automatically be propogated to the Doc-Wiki repo once a day, to avoid things getting to confused. The upshot is, if you're a developer you can commit doc changes directly to the main repos. If you are not you can edit the rst docs in the Doc-Wiki and this will be committed to the main repos at some convenient time (usually just before a release). Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Question about memmap
2009/6/10 David Goldsmith d_l_goldsm...@yahoo.com: --- On Wed, 6/10/09, Scott Sinclair scott.sinclair...@gmail.com wrote: The front page of the Doc-Wiki says: You do not need to be a SciPy developer to contribute, as any documentation changes committed directly to the Subversion repository by developers are automatically propogated here on a daily basis. This means that you can be sure the documentation reflected here is in sync with the most recent Scipy development efforts. Which is why I though the sync was one way. Unfortunately, I didn't now read on (but, as is often the case, what follows makes much more sense now that I know what it means ;-) ). DG I've modified the Introduction on the front page http://docs.scipy.org/numpy/Front Page Should be clear as mud now :) Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] f2py-problem fcompiler for f90-files missing
2009/4/7 Tobias Lindberg tobias.lindb...@byggvetenskaper.lth.se: Background: I have installed the Python(xy) package (full) (numpy 1.2.1.2) both on my XP and Vista machine. On both these machines I have VS2008 installed as well. Then I read that one could write like this; f2py -m test -c test.f90 --compiler=mingw32 Then I got this error; error: f90 not supported by GnuFCompiler needed for fort_mod.f90 so then I check which fcompilers there were and got this; Fortran compilers found: --fcompiler=gnu GNU Fortran 77 compiler (3.4.5) Compilers available for this platform, but not found: --fcompiler=absoft Absoft Corp Fortran Compiler --fcompiler=compaqv DIGITAL or Compaq Visual Fortran Compiler --fcompiler=g95 G95 Fortran Compiler --fcompiler=gnu95 GNU Fortran 95 compiler --fcompiler=intelev Intel Visual Fortran Compiler for Itanium apps --fcompiler=intelv Intel Visual Fortran Compiler for 32-bit apps and the thing is that I have this g95.py under c:\Python25\Lib\site-packages\numpy\distutils\fcompiler\ so why does not this thing wotk? And more important, how can I make it work? g95.py isn't a FORTRAN compiler, it's some code to help NumPy find out what compilers are available on your system. Since you seem to have g77 installed, I assume this is part of either a mingw or cygwin installation on your machine. I suggest using the relevant package manager (cygwin or mingw setup.exe or whatever) to find and install g95 or gfortran. You should then be able to compile FORTRAN90 source code. If you make sure that you can compile a simple FORTRAN90 program at the command line before trying f2py, you'll probably have better luck.. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Ticket mailing down?
2009/3/6 Charles R Harris charlesr.har...@gmail.com: I'm not receiving notifications of new/modified tickets. Anyone else having this problem? ... Chuck I haven't seen anything since 3rd March. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Ticket mailing down?
2009/3/6 Charles R Harris charlesr.har...@gmail.com: On Thu, Mar 5, 2009 at 10:47 PM, Scott Sinclair scott.sinclair...@gmail.com wrote: 2009/3/6 Charles R Harris charlesr.har...@gmail.com: I'm not receiving notifications of new/modified tickets. Anyone else having this problem? ... Chuck I haven't seen anything since 3rd March. That was my original problem but it looks like it has been fixed. I just found the most recent mailings, the subject line has changed and my filter wasn't putting them where they belonged. I also had to re-update my address to receive the svn mailings. Hmm. I'm still subscribed to the lists. I'll just wait and see. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Update webpage for python requirements for Numpy/SciPy
2009/2/20 Pauli Virtanen p...@iki.fi: Fri, 20 Feb 2009 08:34:06 +0200, Scott Sinclair wrote: [clip] If someone can add a stub to the docs in SVN (patch attached for Numpy), I'm prepared to work on this. I can't see how to add pages in the doc-wiki... You can do also this in the doc-wiki, just use the New item form: http://docs.scipy.org/numpy/docs/numpy-docs/user/ No need to add stubs to SVN. That's useful! It's a bit hard to navigate to unless you're already aware of the feature. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Update webpage for python requirements for Numpy/SciPy
2009/2/19 Jarrod Millman mill...@berkeley.edu: On Thu, Feb 19, 2009 at 1:24 PM, Bruce Southey bsout...@gmail.com wrote: Hi, Could someone please update the website to clearly state that numpy 1.2 requires Python 2.4 or later? I know it is in the release notes but that assumes people read them :-) It is extremely difficult to keep track of the numerous pages that explain what the requirements are and how to build and install everything. I would love it if someone would volunteer to add this information to the user documentation for numpy: http://docs.scipy.org/doc/numpy/user/ and scipy: http://docs.scipy.org/doc/scipy/reference/(maybe in the tutorial)? If someone can add a stub to the docs in SVN (patch attached for Numpy), I'm prepared to work on this. I can't see how to add pages in the doc-wiki... Cheers, Scott Index: doc/source/user/install.rst === --- doc/source/user/install.rst (revision 0) +++ doc/source/user/install.rst (revision 0) @@ -0,0 +1,7 @@ + +Installing Numpy + + +.. note:: This installation guide is currently in progress. + +This page describes how to install Numpy on your system. Index: doc/source/user/index.rst === --- doc/source/user/index.rst (revision 6423) +++ doc/source/user/index.rst (working copy) @@ -19,6 +19,7 @@ .. toctree:: :maxdepth: 2 + install howtofind basics performance ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] views and object lifetime
2009/2/18 Neal Becker ndbeck...@gmail.com: Matthieu Brucher matthieu.brucher at gmail.com writes: B has a reference to A. Could you be more specific? Where is this reference stored? What C api functions are used? I'm probably not qualified to be much more specific, these links should provide the necessary detail: http://docs.scipy.org/doc/numpy/reference/c-api.html#numpy-c-api http://docs.python.org/c-api/intro.html#objects-types-and-reference-counts http://docs.python.org/extending/newtypes.html The Python interpreter takes care of when to free the memory associated with an object once it's reference count reaches zero. The object reference counts are increased and decreased directly in C code using the Py_INCREF and Py_DECREF macros whenever a new object is created or a new pointer assigned to an existing object. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] loadtxt issues
2009/2/12 A B python6...@gmail.com: Actually, I was using two different machines and it appears that the version of numpy available on Ubuntu is seriously out of date (1.0.4). Wonder why ... See the recent post here http://projects.scipy.org/pipermail/numpy-discussion/2009-February/040252.html Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] porting NumPy to Python 3
2009/2/10 James Watson watson@gmail.com: I want to make sure diffs are against latest code, but keep getting this svn error: svn update svn: OPTIONS of 'http://scipy.org/svn/numpy/trunk': Could not read status line: Connection reset by peer (http://scipy.org) There is some problem at the moment. This seems to be quite common recently, during the very early morning (USA time zones). I guess this is because Murphy's law states that all server problems occur when the admin is trying to get some sleep ;-) Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Error building numpy documentation
2009/2/4 Nadav Horesh nad...@visionsense.com: I just dowloads the latest numpy's svn version and tried to build its documentation with $ make latex on the doc subdirectory, and got the following error message: writing... Sphinx error: too many nesting section levels for LaTeX, at heading: numpy.ma.MaskedArray.__lt__ make: *** [latex] Error 1 Machine: 64 bit gentoo linux running texlive2007 Any ideas? No ideas, but this has been reported before: http://projects.scipy.org/pipermail/numpy-discussion/2009-January/039917.html I've filed a ticket: http://scipy.org/scipy/numpy/ticket/998 Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Numpy 1.3 release date ?
2009/2/4 David Cournapeau da...@ar.media.kyoto-u.ac.jp: Scott Sinclair wrote: There are a bunch of documentation patches that should to be reviewed and applied to SVN before the release (especially those marked 'Needs review' or better). http://docs.scipy.org/numpy/patch/ In my mind, documentations fixes are much less important than code, not because documentation matters less, but because it can be handled at the last moment much more easily - there is little chance that a doc change breaks on windows only, for example. Sure. Just trying to encourage a few more reviews and documentation contributions. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] minor improvment to ones
2009/1/30 David Cournapeau da...@ar.media.kyoto-u.ac.jp: Neal Becker wrote: A nit, but it would be nice if 'ones' could fill with a value other than 1. Maybe an optional val= keyword? What would be the advantage compared to fill ? I would guess ones and zeros are special because those two values are special (they can be defined for many types, as neutral elements for + and *), I couldn't find the numpy fill function, until my tiny brain realized you meant the ndarray method: http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.fill.html Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Documentation: objects.inv ?
2009/1/29 Pierre GM pgmdevl...@gmail.com: Pauli, how often is the documentation on docs.scipy.org updated from SVN ? My understanding is the following: SVN - doc-wiki - updated once daily at around 10:00 (UTC?). doc-wiki - SVN - infrequently, when someone applies one or more doc patches produced from the doc-wiki to SVN. Documentation on docs.scipy.org - infrequently, when someone builds the docs and posts them. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] make latex in numpy/doc failed
2009/1/27 Nils Wagner nwag...@iam.uni-stuttgart.de: a make latex in numpy/doc failed with ... Intersphinx hit: PyObject http://docs.python.org/dev/c-api/structures.html writing... Sphinx error: too many nesting section levels for LaTeX, at heading: numpy.ma.MaskedArray.__lt__ make: *** [latex] Fehler 1 I am using sphinxv0.5.1 BTW, make html works fine here. I see this problem too. It used to work, and I don't think I've changed anything on my system. Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information. import numpy numpy.__version__ '1.3.0.dev6335' import sphinx sphinx.__version__ '0.5.1' Should I file a ticket, or just let whoever has to build the docs for the next release sort it out when the time comes? Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy.array and subok kwarg
2009/1/22 Pierre GM pgmdevl...@gmail.com: Darren, The type returned by np.array is ndarray, unless I specifically set subok=True, in which case I get a MyArray. The default value of subok is True, so I dont understand why I have to specify subok unless I want it to be False. Is my subclass missing something important? Blame the doc: the default for subok in array is False, as explicit in the _array_fromobject Cfunction (in multiarray). So no, you're not doing anything wrong. Note that by default subok=True for numpy.ma.array. Corrected in the doc-editor. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Help with interpolating missing values from a 3D scanner
2009/1/16 Robert Kern robert.k...@gmail.com: On Thu, Jan 15, 2009 at 16:55, David Bolme bolme1...@comcast.net wrote: I am working on a face recognition using 3D data from a special 3D imaging system. For those interested the data comes from the FRGC 2004 dataset. The problem I am having is that for some pixels the scanner fails to capture depth information. The result is that the image has missing values. There are small regions on the face such as eyebrows and eyes that are missing the depth information. I would like to fill in these region by interpolating from nearby pixels but I am not sure of the best way to do that. Another approach (that you would have to code yourself) is to take a Gaussian smoothing kernel of an appropriate size, center it over each missing pixel, then average the known pixels under the kernel using the kernel as a weighting factor. Place that average value into the missing pixel. This is actually fairly similar to the Rbf method above, but will probably be more efficient since you know that the points are all gridded. You might try using Rbf with a window of known pixels centred on your missing pixels. You'll automatically get a smoothing kernel that weights nearer known pixel values more heavily, the behaviour of the kernel depends on the basis function you choose (so it's similar to the Gaussian smoothing idea). The reason for using a window is efficiency, Rbf will be grossly inefficient if you feed it all of the known pixels in your image as known values. Using a window will gain efficiency without significantly changing your result because very distant known pixel values contribute little to the result anyway. The iteration of image inpainting also sounds like a useful extension. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] ndarray.resize method and reference counting
Hi, I'm confused by the following: import numpy as np np.__version__ '1.3.0.dev6116' # I expect this x = np.eye(3) x.resize((5,5)) x = np.eye(3) y = x x.resize((5,5)) Traceback (most recent call last): File stdin, line 1, in module ValueError: cannot resize an array that has been referenced or is referencing another array in this way. Use the resize function # I don't expect this x = np.eye(3) x array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) x.resize((5,5), refcheck=True) Traceback (most recent call last): File stdin, line 1, in module ValueError: cannot resize an array that has been referenced or is referencing another array in this way. Use the resize function x.resize((5,5), refcheck=False) x array([[ 1., 0., 0., 0., 1.], [ 0., 0., 0., 1., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.]]) Is there a reference counting bug, or am I misunderstanding something about how Python works when I type a variable's name at the prompt? Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] ndarray.resize method and reference counting
I thought it was a self contained snippet ;-) Here's another attempt that shows _ is the cause of my confusion. import numpy as np x = np.eye(3) x array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) x.resize((5,5)) Traceback (most recent call last): File stdin, line 1, in module ValueError: cannot resize an array that has been referenced or is referencing another array in this way. Use the resize function _ array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) Thanks for the help, Scott 2009/1/13 Stéfan van der Walt ste...@sun.ac.za: Hi Scott I can't reproduce the problem below. Would you please send a self-contained snippet? Note that, in Python, _ is a special variable that always points to the last result. In IPython there are several others. Cheers Stéfan 2009/1/13 Scott Sinclair scott.sinclair...@gmail.com: # I don't expect this x = np.eye(3) x array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) x.resize((5,5), refcheck=True) Traceback (most recent call last): File stdin, line 1, in module ValueError: cannot resize an array that has been referenced or is referencing another array in this way. Use the resize function x.resize((5,5), refcheck=False) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Plot directive in numpy docs
2008/12/12 Pauli Virtanen p...@iki.fi: Fri, 12 Dec 2008 14:20:50 +0100, Gael Varoquaux wrote: What is the guideline on using the plot directive in the numpy docs? No guideline yet, I'd suggest not to use it in docstrings yet, before we are sure it works as we want it to work. ** What to think about - Should docstrings be assumed by default to lie inside plot:: directive, unless a plot:: directive is explicitly used? This way the plot could use stuff defined in earlier examples. - Or, maybe only the examples section should assumed to be in a plot:: by default, if it contains doctests. I'd prefer this approach, with the examples section assumed to be wrapped in a plot directive, rather than having the markup in the docstring itself. I'm not clear on what you mean by earlier examples. Do you mean earlier examples in the same docstring, or earlier examples in other docstrings? It makes most sense to me if each docstring has self contained examples and doesn't rely on anything defined elsewhere (except the obvious 'import numpy as np'). Also: There was the unresolved question about should the example codes be run when numpy.test() is run, and what to do with matplotlib code in this case. The main problem was that if the plot codes are picked up as doctests, then the matplotlib objects returned by pyplot functions cause unnecessary line noise. Definitely, any doctest markup should be avoided in the examples. So the options were either to implement some magic to skip offending doctest lines, or to not use doctest markup for plots. However this is resolved, I wouldn't like to see any doctest markup in the finished documentation, whether this is viewed in the terminal, as html or as a pdf. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] how do I delete unused matrix to save the memory?
2008/12/10 Robert Kern [EMAIL PROTECTED]: On Mon, Dec 8, 2008 at 19:15, frank wang [EMAIL PROTECTED] wrote: Hi, I have a program with some variables consume a lot of memory. The first time I run it, it is fine. The second time I run it, I will get MemoryError. If I close the ipython and reopen it again, then I can run the program once. I am looking for a command to delete the intermediate variable once it is not used to save memory like in matlab clear command. How are you running this program? Be aware that IPython may be holding on to objects and preventing them from being deallocated. For example: In [7]: !cat memtest.py class A(object): def __del__(self): print 'Deleting %r' % self a = A() In [8]: %run memtest.py In [9]: %run memtest.py In [10]: %run memtest.py In [11]: del a In [12]: Do you really want to exit ([y]/n)? $ python memtest.py Deleting __main__.A object at 0x915ab0 You can remove some of these references with %reset and maybe a gc.collect() for good measure. Of course, if you don't need to have access to the variables created in your program from the IPython session, you can run the program in a separate python process: In [1]: !python memtest.py Deleting __main__.A object at 0xb7da5ccc In [2]: !python memtest.py Deleting __main__.A object at 0xb7e5fccc Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Line of best fit!
2008/12/8 James [EMAIL PROTECTED]: I am trying to plot a line of best fit for some data i have, is there a simple way of doing it? Hi James, Take a look at: http://www.scipy.org/Cookbook/FittingData http://www.scipy.org/Cookbook/LinearRegression and the section on least square fitting towards the end of this page in the Scipy docs: http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html Post again if if these references don't get you going. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Line of best fit!
2008/12/9 Angus McMorland [EMAIL PROTECTED]: Hi James, 2008/12/8 James [EMAIL PROTECTED]: I have a very simple plot, and the lines join point to point, however i would like to add a line of best fit now onto the chart, i am really new to python etc, and didnt really understand those links! Can anyone help me :) It sounds like the second link, about linear regression, is a good place to start, and I've made a very simple example based on that: --- import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 10, 11) #1 data_y = np.random.normal(size=x.shape, loc=x, scale=2.5) #2 plt.plot(x, data_y, 'bo') #3 coefs = np.lib.polyfit(x, data_y, 1) #4 fit_y = np.lib.polyval(coefs, x) #5 plt.plot(x, fit_y, 'b--') #6 James, you'll want to add an extra line to the above code snippet so that Matplotlib displays the plot: plt.show() Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] What happened to numpy-docs ?
2008/11/27 Pauli Virtanen [EMAIL PROTECTED]: Thu, 27 Nov 2008 08:39:32 +0200, Scott Sinclair wrote: [clip] I have been under the impression that the documentation on the doc wiki http://docs.scipy.org/numpy/Front%20Page/ immediately (or at least very quickly) reflected changes in SVN and that changes to the docs in the wiki need to be manually checked in to SVN. Admittedly I have no good reason to make this assumption. It's manual, somebody with admin privileges must go and click a button to update it. But there's no reason why it couldn't be automatic. It should be trivial to rig up a cron job that runs whenever there are new revisions in SVN, so let's put this in the todo list. I think this is a sensible goal, people editing in the wiki may not be aware of what's happening in SVN. Nice to see that the Scipy docs are now available as well! Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] What happened to numpy-docs ?
2008/11/27 Pierre GM [EMAIL PROTECTED]: I'd like to update routines.ma.rst on the numpy/numpy-docs/trunk SVN, but the whole trunk seems to be MIA... Where has it gone ? How can I (where should I) commit changes ? Hi Pierre, I've done a little bit of that at http://docs.scipy.org/numpy/docs/numpy-docs/reference/routines.ma.rst Which brings up the question of duplicating effort.. I have been under the impression that the documentation on the doc wiki http://docs.scipy.org/numpy/Front%20Page/ immediately (or at least very quickly) reflected changes in SVN and that changes to the docs in the wiki need to be manually checked in to SVN. Admittedly I have no good reason to make this assumption. Looking at some recent changes made to docstrings in SVN by Pierre (r6110 r6111), these are not yet reflected in the doc wiki. I guess my question is aimed at Pauli - How frequently does the doc wiki's version of SVN get updated and is this automatic or does it require manual intervention? Thanks, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Getting indices from numpy array with condition
2008/11/19 Robert Kern [EMAIL PROTECTED]: On Wed, Nov 19, 2008 at 01:31, David Warde-Farley [EMAIL PROTECTED] wrote: On 18-Nov-08, at 3:06 PM, Robert Kern wrote: I like to discourage this use of where(). For some reason, back in Numeric's days, where() got stuck with two functionalities. nonzero() is the preferred function for this functionality. IMO, where(cond, if_true, if_false) should be the only use of where(). Hmm. nonzero() seems semantically awkward to be calling on a boolean array, n'est pas? Why? In Python and numpy, False==0 and True==1. Well, using nonzero() isn't actually all that obvious until you understand that 1) a conditional expression like (a 3) returns a boolean array *and* 2) that False==0 and True==1. These two things are not necessarily known to users who are scientists/engineers etc. I've added an example of this use case at http://docs.scipy.org/numpy/docs/numpy.core.fromnumeric.nonzero/ and added an FAQ http://www.scipy.org/FAQ , so that there's something to point to in future. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] question about the documentation of linalg.solve
2008/11/20 Charles R Harris [EMAIL PROTECTED]: On Wed, Nov 19, 2008 at 3:20 PM, Fabrice Silva [EMAIL PROTECTED] wrote: Le mercredi 19 novembre 2008 à 14:27 -0500, Alan G Isaac a écrit : So my question is not just what is the algorithm but also, what is the documentation goal? Concerning the algorithm (only): in Joshua answer, you have might have seen that solve is a wrapper to lapack routines *gesv (z* or d* depending on the input type). Which, IIRC, calls *getrf to get the LU factorization of the lhs matrix A. Here: * DGESV computes the solution to a real system of linear equations * A * X = B, * where A is an N-by-N matrix and X and B are N-by-NRHS matrices. * * The LU decomposition with partial pivoting and row interchanges is * used to factor A as * A = P * L * U, * where P is a permutation matrix, L is unit lower triangular, and U is * upper triangular. The factored form of A is then used to solve the * system of equations A * X = B. * It's not always fun to read the code in order to find out what a function does. So I guess the documentation goal is to eventually add sufficient detail, for those who want to know what's happening without diving into the source code. A Notes section giving an overview of the algorithm has been added to the docstring http://docs.scipy.org/numpy/docs/numpy.linalg.linalg.solve/. I didn't feel comfortable quoting directly from the LAPACK comments, so maybe someone else can look into adding more detail. Cheers, Scott ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion