Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Stéfan van der Walt
2008/6/23 Alan McIntyre [EMAIL PROTECTED]: Some docstrings have examples of how to use the function that aren't executable code (see numpy.core.defmatrix.bmat for an example) in their current form. Should these examples have the removed from them to avoid them being picked up as doctests?

[Numpy-discussion] ndarray methods vs numpy module functions

2008-06-23 Thread Bob Dowling
[ I'm new here and this has the feel of an FAQ but I couldn't find anything at http://www.scipy.org/FAQ . If I should have looked somewhere else a URL would be gratefully received. ] What's the reasoning behind functions like sum() and cumsum() being provided both as module functions

Re: [Numpy-discussion] error importing a f2py compiled module.

2008-06-23 Thread Pearu Peterson
On Mon, June 23, 2008 10:38 am, Fabrice Silva wrote: Dear all I've tried to run f2py on a fortran file which used to be usable from python some months ago. Following command lines are applied with success (no errors raised) : f2py -m modulename -h tmpo.pyf --overwrite-signature

Re: [Numpy-discussion] Surprising performance tweak in Cython

2008-06-23 Thread Gael Varoquaux
On Mon, Jun 23, 2008 at 02:03:06AM -0400, Anne Archibald wrote: One way to track down this kind of problem is to look at the C code that's generated. Easier, I admit, with a little familiarity with C, but in any case code working with python variables will be obtrusively strewn with functions

[Numpy-discussion] Py_NotImplementedType leak

2008-06-23 Thread Charles R Harris
Leaks of Py_NotImplementedType to the user are regarded as errors by the Python developers and google turns up several patches fixing such issues. In numpy we have this problem because we issue the same call for, say, right_shift as we do for . This leads to things like: In [1]: int64(1)

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Fernando Perez
On Mon, Jun 23, 2008 at 1:03 AM, Stéfan van der Walt [EMAIL PROTECTED] wrote: 2008/6/23 Alan McIntyre [EMAIL PROTECTED]: Some docstrings have examples of how to use the function that aren't executable code (see numpy.core.defmatrix.bmat for an example) in their current form. Should these

[Numpy-discussion] set_printoptions - floating point format option?

2008-06-23 Thread Robert Cimrman
Hi, I need to display some numpy arrays in mantissa+exponent format (e.g. '%.2e' using C syntax). In numpy.set_printoptions(), there is currently only 'precision' option, which does not allow this. What about having an option related to 'precision', named possibly 'float_format', with the

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Alan McIntyre
On Mon, Jun 23, 2008 at 2:02 PM, Fernando Perez [EMAIL PROTECTED] wrote: There's also the option of marking them so doctest skips them via #doctest: +SKIP http://docs.python.org/lib/doctest-options.html For short examples, that seems like a good option, but it seems like you have to have

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Alan McIntyre
On Mon, Jun 23, 2008 at 2:37 PM, Pauli Virtanen [EMAIL PROTECTED] wrote: Can you make the convention chosen for the examples (currently only in the doc wiki, not yet in SVN) to work: assuming import numpy as np in examples? This would remove the need for those from numpy import * lines in the

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Stéfan van der Walt
2008/6/23 Fernando Perez [EMAIL PROTECTED]: On Mon, Jun 23, 2008 at 11:17 AM, Alan McIntyre [EMAIL PROTECTED] wrote: On Mon, Jun 23, 2008 at 2:02 PM, Fernando Perez [EMAIL PROTECTED] wrote: There's also the option of marking them so doctest skips them via #doctest: +SKIP

Re: [Numpy-discussion] Py_NotImplementedType leak

2008-06-23 Thread Charles R Harris
On Mon, Jun 23, 2008 at 11:23 AM, Charles R Harris [EMAIL PROTECTED] wrote: Leaks of Py_NotImplementedType to the user are regarded as errors by the Python developers and google turns up several patches fixing such issues. In numpy we have this problem because we issue the same call for, say,

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Alan McIntyre
On Mon, Jun 23, 2008 at 3:21 PM, Stéfan van der Walt [EMAIL PROTECTED] wrote: Another alternative is to replace +SKIP with something like +IGNORE. That way, the statement is still executed, we just don't care about its outcome. If we skip the line entirely, it often affects the rest of the

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Anne Archibald
2008/6/23 Alan McIntyre [EMAIL PROTECTED]: On Mon, Jun 23, 2008 at 3:21 PM, Stéfan van der Walt [EMAIL PROTECTED] wrote: Another alternative is to replace +SKIP with something like +IGNORE. That way, the statement is still executed, we just don't care about its outcome. If we skip the line

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Pauli Virtanen
Mon, 23 Jun 2008 10:03:28 +0200, Stéfan van der Walt wrote: 2008/6/23 Alan McIntyre [EMAIL PROTECTED]: Some docstrings have examples of how to use the function that aren't executable code (see numpy.core.defmatrix.bmat for an example) in their current form. Should these examples have the

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Michael McNeil Forbes
On 23 Jun 2008, at 12:37 PM, Alan McIntyre wrote: Ugh. That just seems like a lot of unreadable ugliness to me. If this comment magic is the only way to make that stuff execute properly under doctest, I think I'd rather just skip it in favor of clean, uncluttered, non-doctestable code

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Pauli Virtanen
Mon, 23 Jun 2008 15:53:55 -0400, Anne Archibald wrote: 2008/6/23 Alan McIntyre [EMAIL PROTECTED]: On Mon, Jun 23, 2008 at 3:21 PM, Stéfan van der Walt [EMAIL PROTECTED] wrote: Another alternative is to replace +SKIP with something like +IGNORE. That way, the statement is still executed, we

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Alan McIntyre
On Mon, Jun 23, 2008 at 3:57 PM, Pauli Virtanen [EMAIL PROTECTED] wrote: Schematic code (such as that currently in numpy.bmat) that doesn't run probably shouldn't be written with , and for it the ReST block quote syntax is also looks OK. But I'm personally not in favor of a distinction

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Alan McIntyre
On Mon, Jun 23, 2008 at 4:07 PM, Pauli Virtanen [EMAIL PROTECTED] wrote: Another idea (in addition to whitelisting): how easy would it be to subclass doctest.DocTestParser so that it would eg. automatically +IGNORE any doctest lines containing plt.? I'll play around with that and see how hard

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Anne Archibald
2008/6/23 Michael McNeil Forbes [EMAIL PROTECTED]: On 23 Jun 2008, at 12:37 PM, Alan McIntyre wrote: Ugh. That just seems like a lot of unreadable ugliness to me. If this comment magic is the only way to make that stuff execute properly under doctest, I think I'd rather just skip it in

[Numpy-discussion] Sparse Matrices in Numpy -- (with eigenvalue algorithms if possible)

2008-06-23 Thread Dan Yamins
I'm wondering if there is a currently-available Sparse-Matrix package for numpy? If so, how do I get it?And, if there is a good sparse-matrix package, does it include an eigenvalue-computation algorithm? How would a sparse-matrix package interact with something like numpy.linalg.eig, or for

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Michael McNeil Forbes
On 23 Jun 2008, at 1:28 PM, Anne Archibald wrote: 2008/6/23 Michael McNeil Forbes [EMAIL PROTECTED]: Thus, one can argue that all examples should also be doctests. This generally makes things a little more ugly, but much less ambiguous. This is a bit awkward. How do you give an example for

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Robert Kern
On Mon, Jun 23, 2008 at 15:44, Michael McNeil Forbes [EMAIL PROTECTED] wrote: On 23 Jun 2008, at 1:28 PM, Anne Archibald wrote: 2008/6/23 Michael McNeil Forbes [EMAIL PROTECTED]: Thus, one can argue that all examples should also be doctests. This generally makes things a little more ugly,

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Alan McIntyre
On Mon, Jun 23, 2008 at 4:51 PM, Robert Kern [EMAIL PROTECTED] wrote: I agree that this can be awkward sometimes, and should certainly not be policy, but one can usually get around this. Instead of printing the result, you can use it, or demonstrate porperties: random_array =

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Robert Kern
On Mon, Jun 23, 2008 at 16:51, Michael McNeil Forbes [EMAIL PROTECTED] wrote: On Mon, Jun 23, 2008 at 4:51 PM, Robert Kern [EMAIL PROTECTED] wrote: random_array = np.random.rand(3,4) random_array.shape (3,4) random_array.max() 1 True random_array.min() 0 True Yes, this makes it

Re: [Numpy-discussion] ndarray methods vs numpy module functions

2008-06-23 Thread Sebastian Haase
On Mon, Jun 23, 2008 at 10:31 AM, Bob Dowling [EMAIL PROTECTED] wrote: [ I'm new here and this has the feel of an FAQ but I couldn't find anything at http://www.scipy.org/FAQ . If I should have looked somewhere else a URL would be gratefully received. ] What's the reasoning behind functions

Re: [Numpy-discussion] ndarray methods vs numpy module functions

2008-06-23 Thread Robert Kern
On Mon, Jun 23, 2008 at 18:10, Sebastian Haase [EMAIL PROTECTED] wrote: On Mon, Jun 23, 2008 at 10:31 AM, Bob Dowling [EMAIL PROTECTED] wrote: [ I'm new here and this has the feel of an FAQ but I couldn't find anything at http://www.scipy.org/FAQ . If I should have looked somewhere else a URL

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Stéfan van der Walt
2008/6/23 Michael McNeil Forbes [EMAIL PROTECTED]: One can usually do #3 - #1 or #2 by just leave bare assignments without printing a result (the user can always execute them and look at the result if they want). r = np.random.rand(3,2,4) which is cleaner than adding any flags...

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Stéfan van der Walt
2008/6/24 Stéfan van der Walt [EMAIL PROTECTED]: It should be fairly easy to execute the example code, just to make sure it runs. We can always work out a scheme to test its validity later. Mike Hansen just explained to me that the Sage doctest system sets the random seed before executing

Re: [Numpy-discussion] Sparse Matrices in Numpy -- (with eigenvalue algorithms if possible)

2008-06-23 Thread Stéfan van der Walt
Hi Dan 2008/6/23 Dan Yamins [EMAIL PROTECTED]: I'm wondering if there is a currently-available Sparse-Matrix package for numpy? If so, how do I get it?And, if there is a good sparse-matrix package, does it include an eigenvalue-computation algorithm? How would a sparse-matrix package

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Michael Abshoff
Stéfan van der Walt wrote: 2008/6/24 Stéfan van der Walt [EMAIL PROTECTED]: It should be fairly easy to execute the example code, just to make sure it runs. We can always work out a scheme to test its validity later. Hi, Mike Hansen just explained to me that the Sage doctest system sets

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Michael Abshoff
Fernando Perez wrote: On Mon, Jun 23, 2008 at 4:58 PM, Michael Abshoff [EMAIL PROTECTED] wrote: Hi Fernando, a) Random variables we have some small extensions to the doctesting framework that allow us to mark doctests as #random so that the result it not checked. Carl Witty wrote some code

Re: [Numpy-discussion] ndarray methods vs numpy module functions

2008-06-23 Thread Ryan May
Robert Kern wrote: On Mon, Jun 23, 2008 at 18:10, Sebastian Haase [EMAIL PROTECTED] wrote: On Mon, Jun 23, 2008 at 10:31 AM, Bob Dowling [EMAIL PROTECTED] wrote: [ I'm new here and this has the feel of an FAQ but I couldn't find anything at http://www.scipy.org/FAQ . If I should have looked

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Fernando Perez
On Mon, Jun 23, 2008 at 5:26 PM, Michael Abshoff [EMAIL PROTECTED] wrote: I am not the author, so I need to find out who wrote the code, but I am sure it can be made BSD. We are also working on doctest+timeit to hunt for performance regressions, but that one is not ready for prime time yet.

Re: [Numpy-discussion] ndarray methods vs numpy module functions

2008-06-23 Thread Robert Kern
On Mon, Jun 23, 2008 at 19:35, Ryan May [EMAIL PROTECTED] wrote: Robert Kern wrote: On Mon, Jun 23, 2008 at 18:10, Sebastian Haase [EMAIL PROTECTED] wrote: On Mon, Jun 23, 2008 at 10:31 AM, Bob Dowling [EMAIL PROTECTED] wrote: [ I'm new here and this has the feel of an FAQ but I couldn't find

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Charles R Harris
On Mon, Jun 23, 2008 at 5:58 PM, Michael Abshoff [EMAIL PROTECTED] wrote: Stéfan van der Walt wrote: 2008/6/24 Stéfan van der Walt [EMAIL PROTECTED]: It should be fairly easy to execute the example code, just to make sure it runs. We can always work out a scheme to test its validity

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Michael Abshoff
Charles R Harris wrote: On Mon, Jun 23, 2008 at 5:58 PM, Michael Abshoff [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Stéfan van der Walt wrote: 2008/6/24 Stéfan van der Walt [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: It should be fairly easy to execute the

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Anne Archibald
2008/6/23 Stéfan van der Walt [EMAIL PROTECTED]: 2008/6/24 Stéfan van der Walt [EMAIL PROTECTED]: It should be fairly easy to execute the example code, just to make sure it runs. We can always work out a scheme to test its validity later. Mike Hansen just explained to me that the Sage

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Anne Archibald
2008/6/23 Michael Abshoff [EMAIL PROTECTED]: Charles R Harris wrote: On Mon, Jun 23, 2008 at 5:58 PM, Michael Abshoff [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Stéfan van der Walt wrote: 2008/6/24 Stéfan van der Walt [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

Re: [Numpy-discussion] Code samples in docstrings mistaken as doctests

2008-06-23 Thread Robert Kern
On Mon, Jun 23, 2008 at 22:53, Anne Archibald [EMAIL PROTECTED] wrote: 2008/6/23 Michael Abshoff [EMAIL PROTECTED]: Correct, but so far Carl has hooked into six out of the many random number generators in the various components of Sage. This way we can set a global seed and also more easily

Re: [Numpy-discussion] Sparse Matrices in Numpy -- (with eigenvalue algorithms if possible)

2008-06-23 Thread Robin
On Tue, Jun 24, 2008 at 4:23 AM, Dan Yamins [EMAIL PROTECTED] wrote: 3) Finally: (and this is slightly off topic) -- I've just installed SciPy for the first time. In the readme.txt for the download it mentioned something about having LAPACK and ATLAS installed. However, on the scipy install