Re: [Numpy-discussion] Removing datetime support for 1.4.x series ?

2010-02-04 Thread Matthew Brett
Hi, I think Group 1 is a negligible epsilon of Group 2, and moreover, Group 1 is the most likely to be able to deal with those issues. It is time for an on list vote? I must say, although I know it is not straightforward, that I agree with David that, we should act in favor of our new and

[Numpy-discussion] dtype.isbuiltin changed by .newbyteorder

2010-01-14 Thread Matthew Brett
Hi, Over on the scipy list, someone pointed out an oddness in the output of the matlab reader, which revealed this - to me - unexpected behavior in numpy: In [20]: dt = np.dtype('f8') In [21]: dt.isbuiltin Out[21]: 1 In [22]: ndt = dt.newbyteorder('') In [23]: ndt.isbuiltin Out[23]: 0 I was

Re: [Numpy-discussion] dtype.isbuiltin changed by .newbyteorder

2010-01-14 Thread Matthew Brett
Hi, It is at least undesirable. It may not be a bug per se as I don't think that we guarantee that .isbuiltin is free from false negatives (though we do guarantee that it is free from false positives). The reason is that we would have to search the builtin dtypes for a match every time we

Re: [Numpy-discussion] Empty strings not empty?

2009-12-31 Thread Matthew Brett
Hi, On Thu, Dec 31, 2009 at 2:08 AM, Christopher Barker chris.bar...@noaa.gov wrote: Charles R Harris wrote: That is due to type promotion for the ufunc call: In [17]: a1 = np.array('a\x00\x00\x00') n [21]: np.array(['a'], dtype=a1.dtype)[0] Out[21]: 'a' In [22]: np.array(['a'],

Re: [Numpy-discussion] Empty strings not empty?

2009-12-30 Thread Matthew Brett
Hi. It isn't empty: In [3]: array(['\x00']).dtype Out[3]: dtype('|S1') In [4]: array(['\x00']).tostring() Out[4]: '\x00' In [5]: array(['\x00'])[0] Out[5]: '' No, but my problem was that an empty string is not empty either, and that you can't therefore distinguish between an empty

[Numpy-discussion] Empty strings not empty?

2009-12-29 Thread Matthew Brett
Hi, I was surprised by this - should I have been? In [35]: e = np.array(['a']) In [36]: e.shape Out[36]: (1,) In [37]: e.size Out[37]: 1 In [38]: e.tostring() Out[38]: 'a' In [39]: f = np.array(['a']) In [40]: f.shape == e.shape Out[40]: True In [41]: f.size == e.size Out[41]: True In

Re: [Numpy-discussion] Empty strings not empty?

2009-12-29 Thread Matthew Brett
Hi, I don't see any empty string in your code ? They all have one byte. The last one is slightly confusing as far as printing is concerned (I would have expected array([¥x00]...) instead). It may be a bug in numpy because a byte with value 0 is used a string delimiter in C. Sorry - I pasted

Re: [Numpy-discussion] Empty strings not empty?

2009-12-29 Thread Matthew Brett
Hi, Ok, it looks like there are at least two issues:  - if an item in a string array is set to '¥x00', this seems to be replace with '', but '' != '¥x00'] Sorry - I'm afraid I don't understand. It looks to me as though the buffer contents of [''] is a length 1 string with a 0 byte, and an

Re: [Numpy-discussion] Empty strings not empty?

2009-12-29 Thread Matthew Brett
Hi, x = ¥00 arr = np.array([x]) lst = [x] arr[0] == x # False arr[0] == # True lst[0] == x # True lst[0] == # False Ah - thanks - got it.  It looks to me as though the buffer contents of [''] is a length 1 string with a 0 byte, and an array.size of 1 - is that also what you think?  

Re: [Numpy-discussion] Error for numpy.test() with doctest environment configs

2009-12-28 Thread Matthew Brett
Hi, An obvious idea is to allow the testing machinery to parse all the configs, including the doctest configs, then throw away the native (non-numpy) doctest plugin before we get to collecting and running the tests. I've attached a patch that does this; it's a little bit magic because of

[Numpy-discussion] Error for numpy.test() with doctest environment configs

2009-12-24 Thread Matthew Brett
Hi, Because I like doctests, I have the following set in my .noserc file: with-doctest=1 This setting breaks numpy.test() like this: In [2]: numpy.test() Running unit tests for numpy NumPy version 1.5.0.dev8029 NumPy is installed in /Users/mb312/usr/local/lib/python2.6/site-packages/numpy

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-22 Thread Matthew Brett
Hi, I'm happy to write the doctests as tests.   My feeling is there is no objection to this function at the moment, so it would be reasonable, unless I hear otherwise, to commit to SVN. Committed - with tests in tests_linalg.py - in revision 8029 Cheers, Matthew

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-16 Thread Matthew Brett
Hi, Is it reasonable to summarize that, to avoid confusion, we keep 'matrix_rank' as the name? I've edited as Robert suggested, attempting to adopt a more suitable tone in the docstring... What comes next when someone offers up a useful function like this? We are using an earlier version

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-16 Thread Matthew Brett
Hi, On Wed, Dec 16, 2009 at 2:16 PM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: On Wed, Dec 16, 2009 at 02:13:08PM -0500, Matthew Brett wrote: I'm happy to write the doctests as tests.   My feeling is there is no objection to this function at the moment, so it would be reasonable

[Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-15 Thread Matthew Brett
Hi, Following on from the occasional discussion on the list, can I propose a small matrix_rank function for inclusion in numpy/linalg? I suggest it because it seems rather a basic need for linear algebra, and it's very small and simple... I've appended an implementation with some doctests in

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-15 Thread Matthew Brett
Hi, +1 for the function but we can not shorten the name because of existing numpy.rank() function. I don't feel strongly about the name, but I imagine you could do from numpy.linalg import rank as matrix_rank if you weren't using the numpy.linalg namespace already... Best, Matthew

Re: [Numpy-discussion] Proposal for matrix_rank function in numpy

2009-12-15 Thread Matthew Brett
Hi, Is it reasonable to summarize that, to avoid confusion, we keep 'matrix_rank' as the name? I've edited as Robert suggested, attempting to adopt a more suitable tone in the docstring... Thanks a lot, Matthew def matrix_rank(M, tol=None): ''' Return rank of matrix using SVD method

Re: [Numpy-discussion] Impossibility to build nipy on recent numpy?

2009-12-09 Thread Matthew Brett
Hi, On Wed, Dec 9, 2009 at 4:31 PM, Gael Varoquaux gael.varoqu...@normalesup.org wrote: In the nipy project, we have cython-generated C files checked in. With the latest numpy I get the following run-time failure: /home/varoquau/dev/nipy-trunk/nipy/neurospin/register/iconic_matcher.py, line

[Numpy-discussion] Recarray comparison and byte order

2009-10-31 Thread Matthew Brett
Hi, I was surprised by this - is it a bug or a feature or me misunderstanding something? a = np.zeros((1,), dtype=[('f1', 'u2')]) b = a.copy() b == a (array([True], dtype=bool)) # as expected c = a.byteswap().newbyteorder() c == a (False) # to me, unexpected, note bool rather than array Thanks

Re: [Numpy-discussion] Recarray comparison and byte order

2009-10-31 Thread Matthew Brett
Hi, c = a.byteswap().newbyteorder() c == a In the last two lines, a variable c is assigned to a modified a.  The next line tests (==) to see if c is the same as (==) the unmodified a. It isn't, because c is the modified a.  Hence, False. Sorry, I wasn't very clear - the stuff in brackets

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread Matthew Brett
Hi, Nicolas Devillard discusses several algorithms at http://ndevilla.free.fr/median/median/index.html Thanks for this. A loud 'yes' from the back of the internet too. I contacted Nicolas Devillard a year or so ago to ask him if we could include his code in Scipy, and he said 'yes'. I can

Re: [Numpy-discussion] Accelerating NumPy computations [Was: GPU Numpy]

2009-08-21 Thread Matthew Brett
Hi, Indeed. In the future, if OpenCL is the way to go, it may even be helpful to have Numpy using OpenCL directly, as AMD provides an SDK for OpenCL, and with Larrabee approaching, Intel will surely provide one of its own. I was just in a lecture by one of the Intel people about OpenCL:

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread Matthew Brett
On Fri, Aug 21, 2009 at 11:33 AM, Matthew Brettmatthew.br...@gmail.com wrote: Nicolas investigated algorithms that find the lower (or upper) median value.  The lower median is the median iff there are an odd number of entries in our list, or the lower of the central values in the sort, when

Re: [Numpy-discussion] Strange crash in numpy.linalg.lstsq.

2009-08-17 Thread Matthew Brett
Hi Jonathan, http://www.cs.toronto.edu/~jtaylor/crash/ I would be interested to know if this bug can be duplicated and/or if anyone has any suggestions as to why: import numpy as np A = np.load('A.npy') b = np.load('b.npy') rc = np.linalg.lstsq(A,b) produces: *** glibc detected ***

Re: [Numpy-discussion] Is this a bug in numpy.distutils ?

2009-08-04 Thread Matthew Brett
Hi, On Tue, Aug 4, 2009 at 9:31 AM, David Cournapeaucourn...@gmail.com wrote: On Tue, Aug 4, 2009 at 8:13 PM, David Cournapeauda...@ar.media.kyoto-u.ac.jp wrote: I think I understand the problem. Unfortunately, that's looks tricky to solve... I hate distutils. Ok - should be fixed in

[Numpy-discussion] Is this a bug in numpy.distutils ?

2009-08-03 Thread Matthew Brett
Hi, We are using numpy.distutils, and have run into this odd behavior in windows: I have XP, Mingw, latest numpy SVN, python.org python 2.6. All the commands below I am running from within the 'numpy' root directory (where 'numpy' is a subdirectory). If I run python setup.py build I get the

Re: [Numpy-discussion] numpy subclass

2009-07-23 Thread Matthew Brett
Hi, In short, I want to create a class Dummy, inherited from np.ndarray, which returns a plain array whenever an instance is sliced or viewed. I cannot figure out how. class Dummy(np.ndarray): def __new__(cls, array):   obj=array.view(cls)   return obj def __array_finalize__(self,

Re: [Numpy-discussion] Odd nosetest error in test_umath.py

2009-07-23 Thread Matthew Brett
Hi, It's been there ever since Travis added the test, but it is sporadic. It's probably a reference counting error somewhere but no one has tracked it down yet. There is a ticket open on it. As a demonstration that this is not fully predictable; here's me copying the test file, running it

[Numpy-discussion] Odd nosetest error in test_umath.py

2009-07-23 Thread Matthew Brett
Hi, I just got an email about a broken buildbot build. Looking at the logs, I see this: == FAIL: Test bug in reduceat with structured arrays copied for speed.

Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Matthew Brett
Hi, The words of caution were intended to remind that setting the value of  new array attributes in __new__ only could lead to problems, as it's possible to transform a ndarray into a subclass with a view (that is, calling __array_finalize__ without calling __new__). In the Simple Example of

Re: [Numpy-discussion] proper use of __new__

2009-07-21 Thread Matthew Brett
Hi, I'm the person who removed the reference to thread-safeness in the numpy version of the subclassing docs.   I remember at the time going through all the email discussions that led up to the thread-safeness question, and concluding (in discussion with Travis O and others) that there was

Re: [Numpy-discussion] Mathematica vs Matlab vs Python

2009-07-08 Thread Matthew Brett
Hi, Yup. It's not even very idiomatic Python. readlines() is probably a bad idea unless your file is trivial length, and even ignoring numpy.loadtxt(), all of this could be considerably simplified with the built-in csv module. or a 1-liner with scipy.io.loadmat ... Best, Matthew

Re: [Numpy-discussion] Question about memmap

2009-06-09 Thread Matthew Brett
Hi, I am having problem while trying to memory map a simple file (attached as test.txt) The file looks like a text file, but memmap is for binary files. Could that be the problem? Best, Matthew ___ Numpy-discussion mailing list

Re: [Numpy-discussion] matrix multiplication

2009-06-05 Thread Matthew Brett
I think something close to this would be possible: add dot as an array method.        A .dot(B) .dot(C) is not as pretty as        A * B * C but it is much better than        np.dot(np.dot(A,B),C) That is much better. Matthew ___

Re: [Numpy-discussion] Scipy 0.7.1rc1 released

2009-06-04 Thread Matthew Brett
Hi,    The RC1 for 0.7.1 scipy release has just been tagged. This is a bug-only release I feel (y)our pain, but don't you mean 'bug-fix only release'? ;-) Matthew ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] Are masked arrays slower for processing than ndarrays?

2009-05-13 Thread Matthew Brett
Hi, Whine. I was afraid of something like that... 2 options, then: * We revert to computing a mask beforehand. That looks like the part that takes the most time w/ domained operations (according to Robert K's profiler. Robert, you deserve a statue for this tool). And that doesn't solve the

Re: [Numpy-discussion] Structured array with no fields - possible?

2009-05-04 Thread Matthew Brett
Hi, I'm trying to fix a bug in the scipy matlab loading routines, and this requires me to somehow represent an empty structured array. Do you need the struct to be empty (size is 0) or to have no fields ? What would you expect np.zeros((), dtype=np.dtype([])) to return, for example ? Yes,

[Numpy-discussion] Structured array with no fields - possible?

2009-05-02 Thread Matthew Brett
Hello, I'm trying to fix a bug in the scipy matlab loading routines, and this requires me to somehow represent an empty structured array. In matlab this is: a = struct() In numpy, you can do this: In [1]: dt = np.dtype([]) but then you can't use it: In [2]: np.zeros((),dtype=dt)

Re: [Numpy-discussion] Python version dependency

2009-04-11 Thread Matthew Brett
Hi, Sturla Molden has a patch adding offset support to memmap. However... the feature requires Python 2.5 and above. The Python version is checked for in the code but I am wondering if we want to do that sort of thing. Using advanced features here and there doesn't bother me too much as long

Re: [Numpy-discussion] DVCS at PyCon

2009-04-10 Thread Matthew Brett
Hi, I enjoyed this quote from http://www.eecs.harvard.edu/~cduan/technical/git/ Summary: You can only really use Git if you understand how Git works. When I first started using Git, I read plenty of tutorials, as well as the user manual. Though I picked up the basic usage patterns and commands,

[Numpy-discussion] Blas / lapack / binary installers...

2009-04-08 Thread Matthew Brett
Hello, Summary: is it possible to distribute, optionally or not, the blas / lapack libraries that numpy is built against, with the numpy binary installers? We at the NIPY project have run into what seems like a recurring problem; we want to build our code against both numpy and lapack, on

Re: [Numpy-discussion] Blas / lapack / binary installers...

2009-04-08 Thread Matthew Brett
Hi, We at the NIPY project have run into what seems like a recurring problem; we want to build our code against both numpy and lapack, on windows, linux and OS X. No problem of course if we've done a development install - we already needed to have blas/lapack. I am not sure I understand:

Re: [Numpy-discussion] Out-of-RAM FFTs

2009-04-01 Thread Matthew Brett
Hi, 1) Numerical Recipes has an out-of-memory FFT algorithm, but looking through the numpy and scipy docs and modules, I didn't find a function that does the same thing.  Did I miss it?  Should I get to work typing it in? No please don't do that; I'm afraid the Numerical Recipes book has a

Re: [Numpy-discussion] Unhelpful errors trying to create very large arrays?

2009-03-22 Thread Matthew Brett
Hi, I found this a little confusing: In [11]: n = 25 In [12]: np.arange(n).shape Out[12]: (0,) Maybe this should raise an error instead. This was a little more obvious, but perhaps again a more explicit error would be helpful? In [13]: np.zeros((n,))

Re: [Numpy-discussion] Unhelpful errors trying to create very large arrays?

2009-03-22 Thread Matthew Brett
Hi, On Sun, Mar 22, 2009 at 1:31 AM, David Cournapeau courn...@gmail.com wrote: Hi Matthew, On Sun, Mar 22, 2009 at 3:08 PM, Matthew Brett matthew.br...@gmail.com wrote: I notice this gives much more helpful memory errors on a 64 bit machine with 4GB of memory. Can you tell me which

[Numpy-discussion] Unhelpful errors trying to create very large arrays?

2009-03-21 Thread Matthew Brett
Hello, I found this a little confusing: In [11]: n = 25 In [12]: np.arange(n).shape Out[12]: (0,) Maybe this should raise an error instead. This was a little more obvious, but perhaps again a more explicit error would be helpful? In [13]: np.zeros((n,))

[Numpy-discussion] structured array comparisons?

2009-03-07 Thread Matthew Brett
Hi, I'm having some difficulty understanding how these work and would be grateful for any help. In the simple case, I get what I expect: In [42]: a = np.zeros((), dtype=[('f1', 'f8'),('f2', 'f8')]) In [43]: a == a Out[43]: True If one of the fields is itself an array, and the other is a

Re: [Numpy-discussion] Cython numerical syntax revisited

2009-03-06 Thread Matthew Brett
Hi, The idea behind the current syntax was to keep things as close as possible to Python/NumPy, and only provide some hints to Cython for optimization. My problem with this now is that a) it's too easy to get non-optimized code without a warning by letting in untyped indices, b) I think the

[Numpy-discussion] isbuiltin - failure of understanding

2009-02-24 Thread Matthew Brett
Hi, I was just trying to write a docstring for np.dtype.isbuiltin, when I realized I didn't understand it. As far as I can see, isbuitin should return: 0 for structured array dtypes 1 for types compiled into numpy 2 for extension types using the numpy C-API type extension machinery. Here's the

[Numpy-discussion] Suggested change for NaN, Infs float-int conversion

2009-01-25 Thread Matthew Brett
Hi, When converting arrays from float to ints, I notice that NaNs, Infs, and -Infs all get the minimum integer value: flts = np.array([np.nan, np.inf, -np.inf]) flts.astype(np.int16) array([-32768, -32768, -32768], dtype=int16) However, setting NaNs into integer arrays gives a value of 0

Re: [Numpy-discussion] have to use matlab: what is the equiv. to pdb.pm()

2009-01-22 Thread Matthew Brett
Did you say matlab ? ;-) I have to debug a matlab program -- is there a way to do a post mortem debugging ? (I don't even know if this term even exists outside of python ;-) ((I want to know some local variable values and find out why our program crashes when there are no particles

Re: [Numpy-discussion] Numpy unexpected (for me) behaviour

2009-01-22 Thread Matthew Brett
Hi, #This does not work import numpy a=numpy.zeros(10) b=numpy.ones(4, numpy.int) a[b] += 1 The problem here is that you are setting a[1] to a[1]+1. I think you want: import numpy a=numpy.zeros(10) b=numpy.ones(4, numpy.bool) a[b] += 1 Best, Matthew

Re: [Numpy-discussion] Numpy unexpected (for me) behaviour

2009-01-22 Thread Matthew Brett
Judging from his for loop, he does want the integer array. He's doing something like histogramming. Yup, thanks, just goes to show that it's not good to send emails after a glass of wine late at night with slight jetlag. Matthew ___ Numpy-discussion

Re: [Numpy-discussion] Please don't use google code for hosting

2009-01-19 Thread Matthew Brett
Hi, Do you also know how the situation is with sourceforge/launchpad/trac... and other popular hosting systems ? Do they also have these restrictions ? I've not noticed any problems with sourceforge, nor launchpad - I'm using them regularly from here. You'd hope that was the case for

[Numpy-discussion] Please don't use google code for hosting

2009-01-16 Thread Matthew Brett
Hi, I am just visiting colleagues in the Cuban Neuroscience Center, and of course I'm trying to persuade them that Python and open-source are the way forward. This is made more difficult because several projects - for example pyglet - have their repositories on Google code. Google, unlike any

Re: [Numpy-discussion] Need **working** code example of 2-D arrays

2008-10-13 Thread Matthew Brett
I know, I know, last one... http://www.catb.org/~esr/faqs/smart-questions.html I had forgotten this wise quote from the smart questions FAQ: Be gentle. Problem-related stress can make people seem rude or stupid even when they're not. Best, Matthew

Re: [Numpy-discussion] Need **working** code example of 2-D arrays

2008-10-12 Thread Matthew Brett
Friends, Those statements are not demeaning; lighten up. STOP IT. JUST STOP IT. STOP IT RIGHT NOW. Let us not go to this place, honestly, there is no need. Let's go back to the technical problem again. Linda, did you have time to try Alan's example? Best, Matthew

Re: [Numpy-discussion] Array subclassing - question for Travis

2008-08-28 Thread Matthew Brett
Hi Stefan, Thanks for the kindly reply... Since both those objects have an __array_priority__ of 0.0, I guess it just takes whichever class comes first. In [15]: class A(np.ndarray): : __array_priority__ = -1.0 I think, playing more... For np.multiply, it does not seem possible

Re: [Numpy-discussion] ImportError: No module named my_module

2008-08-28 Thread Matthew Brett
Hi Nils, I don't have an example.py in a checkout from a few seconds ago - it is possible it could be a stray file? Best, Matthew On Thu, Aug 28, 2008 at 3:29 AM, Nils Wagner [EMAIL PROTECTED] wrote: == ERROR: Failure:

Re: [Numpy-discussion] ImportError: No module named my_module

2008-08-28 Thread Matthew Brett
Hi, find . -name example.py in my svn/numpy directory yields ./doc/example.py ./doc/newdtype_example/example.py Ah - how strange - I just tried deleting my doc directory and checking it out again, and don't have those files or directory... Matthew

[Numpy-discussion] Array subclassing - question for Travis

2008-08-27 Thread Matthew Brett
Hi Travis and team, I am just writing some docs for subclassing, and ran into some behavior I didn't understand: In [143]: class A(np.ndarray): pass In [144]: arr = np.arange(5) In [145]: obj = arr.copy().view(A) In [146]: type(obj) Out[146]: class '__main__.A' In [147]:

Re: [Numpy-discussion] Python ref count leak in numpy

2008-07-04 Thread Matthew Brett
Hi, First the web sites. I can find three different websites that appear to be relevant to NumPy. Let's take a look, shall we? 1. http://numpy.scipy.org This is the first link on Google and appears to be the proper home of Numpy ... Thanks for this - no really - it's funny, and you're

Re: [Numpy-discussion] set_local_path in test files

2008-07-02 Thread Matthew Brett
Hi, The idea behind set_local_path is that it allows running tests inside subpackages without the need to rebuild the entire package. Ah, thanks; I'd forgotten about that. I'll leave them alone, then. I made a note for myself to make sure it's possible to run tests locally without doing a

Re: [Numpy-discussion] On my Cython/NumPy project

2008-06-21 Thread Matthew Brett
Hi, Thanks a lot for the email - it's an exciting project. cdef int i = 4, j = 6 cdef np.ndarray[np.float64, 2] arr = np.zeros((10, 10), dtype=np.float64) arr[i, j] = 1 I'm afraid I'm going to pitch into an area I'm ignorant of, and I'm sorry for that, but do you think there is any way of

Re: [Numpy-discussion] On my Cython/NumPy project

2008-06-21 Thread Matthew Brett
Hi, The feature of compiling code for multiple types is somewhat orthogonal to ndarray support; better treat them seperately and take one at the time. Well, it's relevant to numpy because if you want to implement - for example - a numpy sort, then you've got to deal with an unspecified number

Re: [Numpy-discussion] Updating cython directory to pxd usage: objections?

2008-06-20 Thread Matthew Brett
Hi, As a matter of interest, what is the relationship, if any, between (in Cython) import numpy and cnp.import_array() Are they initializing different copies of the same thing? Best, Matthew ___ Numpy-discussion mailing list

Re: [Numpy-discussion] Updating cython directory to pxd usage: objections?

2008-06-19 Thread Matthew Brett
Hi, - There's a bug in the latest Cython annotation, preventing the example from compiling. Workaround: replace cython -a with cython. Mmh, I have 0.9.8 (their last release) and it works for me... I've got the same version, works for me too... Matthew

[Numpy-discussion] Cython headers in numpy include

2008-06-19 Thread Matthew Brett
Hi, Following on from Fernando's post about his Cython example, I would like to suggest adding his .pxd files to the standard numpy include directory, fetched with np.get_include() Why: Because anyone writing a Cython extension for numpy will need these files. At the moment, this means that

Re: [Numpy-discussion] Cython headers in numpy include

2008-06-19 Thread Matthew Brett
Following on from Fernando's post about his Cython example, I would like to suggest adding his .pxd files to the standard numpy include directory, fetched with np.get_include() I am a bit hesitant to add them to a standard public path until they are close to complete. As usual, fair

Re: [Numpy-discussion] Cython headers in numpy include

2008-06-19 Thread Matthew Brett
Hi, Cython looks in the include_dirs for .pxd files, right? Then yes, I would support putting them alongside arrayobject.h. Yes, right - Fernando just pointed me to the reference - quoting him: As indicated here:

Re: [Numpy-discussion] Updating cython directory to pxd usage: objections?

2008-06-19 Thread Matthew Brett
Hi, As long as it doesn't cause problems, then I'd vote for doing it. This only happens at module import time, so even if several modules using cython call it, it's only when they get imported. I think the API simplification is worth it (minor, but still nice). I just tested the changes

Re: [Numpy-discussion] Switching to nose test framework (was: NumpyTest problem)

2008-06-09 Thread Matthew Brett
Hi, I am sure you know this already, but you can just replace the tests using ParametricTestCase with a nose test generator. See: http://www.scipy.org/scipy/scipy/wiki/TestingGuidelines under Parametric tests. Best, Matthew On Mon, Jun 9, 2008 at 3:37 PM, Alan McIntyre [EMAIL PROTECTED]

Re: [Numpy-discussion] New documentation web application

2008-05-31 Thread Matthew Brett
Hi, By being consistent in importing modules using the 'import numpy.fft as fft', it can make it more clear that we are importing a module. I already recommend this usage in the matplotlib coding guide, and numpy may want to adopt it as well. That's an excellent suggestion, seconded.

Re: [Numpy-discussion] [SciPy-dev] [IT] Weekend outage complete

2008-05-16 Thread Matthew Brett
Hi, I hope you're the right person to ask about this - sorry if not. I have just noticed that our (neuroimaging.scipy.org) wiki link no longer works: http://projects.scipy.org/neuroimaging/ni/wiki gives a 502 proxy error: Proxy Error The proxy server received an invalid response from an

Re: [Numpy-discussion] ticket 788: possible blocker

2008-05-13 Thread Matthew Brett
Hi, Stefan, sometimes the fix really is clear and a test is like closing the barn door after the horse has bolted. Sometimes it isn't even clear *how* to test. I committed one fix and omitted a test because I couldn't think of anything really reasonable. I think concentrating on unit tests is

Re: [Numpy-discussion] Truth value of an array

2008-04-18 Thread Matthew Brett
Hi, I must say, I agree with the other posters here, that it is not completely obvious to me that: a = np.array([True, False]) bool(a) should return False. Especially given: L = [True, False] bool(L) returns True. Given that it's not completely obvious, and a.all() is completely

Re: [Numpy-discussion] Numpy-discussion Digest, Vol 19, Issue 44

2008-04-10 Thread Matthew Brett
Hi Joe, I do see your point - and agree that typing and cruft make code harder to write and read, to some extent. But I think the point is - and I'm increasingly finding this - that a judicious use of namespaces and 'from' statements makes the code much easier to read, as in import numpy as np

Re: [Numpy-discussion] Interaction between Numpy and the nose framework (was : packaging scipy)

2008-04-07 Thread Matthew Brett
Hi, On Mon, Apr 7, 2008 at 4:25 PM, Stéfan van der Walt [EMAIL PROTECTED] wrote: On 07/04/2008, Matthieu Brucher [EMAIL PROTECTED] wrote: BTW, I stumbled on something strange with the nose framework. If you from numpy.testing import * in a test file, the nose framework will try to test

Re: [Numpy-discussion] packaging scipy (was Re: Simple financial functions for NumPy)

2008-04-05 Thread Matthew Brett
+1 (and s/students/colleagues). Surely you mean: s.replace('students', colleagues') ! Matthew ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Openmp support (was numpy's future (1.1 and beyond): which direction(s) ?)

2008-03-24 Thread Matthew Brett
Hi, Note that the plug-in idea is just my own idea, it is not something agreed by anyone else. So maybe it won't be done for numpy 1.1, or at all. It depends on the main maintainers of numpy. I'm +3 for the plugin idea - it would have huge benefits for installation and automatic

[Numpy-discussion] numpy.distutils bug, fix, comments?

2008-03-08 Thread Matthew Brett
Hi, I think I found a bug in numpy/distutils/ccompiler.py - and wanted to check that no-one has any objections before I fix it. These lines (390ff distutils.ccompiler.py) for _cc in ['msvc', 'bcpp', 'cygwinc', 'emxc', 'unixc']: _m = sys.modules.get('distutils.'+_cc+'compiler') if _m

Re: [Numpy-discussion] Closing tickets

2008-02-24 Thread Matthew Brett
Hi, #558: 'axis' support for numpy.median() This one should be fixed, and can be closed. I don't think I have wiki login rights though. Thanks, Matthew ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-13 Thread Matthew Brett
Ah, To answer my own question: Suggestion 1: Wrap the .sort method call in a tiny python wrapper of the form: def sort(self, axis=-1, kind='quicksort', order=None): if axis=None: _c_sort(self.ravel(), axis, kind, order) else: _c_sort(self, axis, kind, order) I guess

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-13 Thread Matthew Brett
Hi, Is it possible, in fact, to do an inplace sort on an array with axis=None (ie flat sort)? Should the sort method have its docstring changed to reflect the fact that axis=None is not valid? Sorry to press on, but it would be good to resolve this somehow. Is there some reason not to:

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Matthew Brett
Hi, To rephrase: Is it possible, in fact, to do an inplace sort on an array with axis=None (ie flat sort)? Should the sort method have its docstring changed to reflect the fact that axis=None is not valid? Matthew On Feb 10, 2008 7:50 PM, Matthew Brett [EMAIL PROTECTED] wrote: Hi, I just

Re: [Numpy-discussion] Median advice

2008-02-12 Thread Matthew Brett
Hi, On Feb 12, 2008 8:48 PM, Anne Archibald [EMAIL PROTECTED] wrote: On 12/02/2008, Matthew Brett [EMAIL PROTECTED] wrote: Suggestion 1: def median(a, axis=0, out=None) [...] Suggestion 2: def median(a, axis=0, scratch_input=False) No reason not to combine the two. It's a pretty

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-11 Thread Matthew Brett
Hi, I can also see that this could possibly be improved by using a for loop to iterate over the output elements, so that there was no need to duplicate the large input array, or perhaps a blocked iteration that duplicated arrays of modest size would be better. But how can a single float per

[Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Matthew Brett
Hi, I am sorry if I have missed something obvious, but is there any way in python of doing this: import numpy as np a = np.arange(10) b = np.arange(10)+1 a.data = b.data # raises error, but I hope you see what I mean ? Thanks a lot for any pointers. Matthew

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Matthew Brett
import numpy as np a = np.arange(10) b = np.arange(10)+1 a.data = b.data # raises error, but I hope you see what I mean ? Not really, no. Can you describe your use case in more detail? Yes - I am just writing the new median implementation. To allow future optimization, I would

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Matthew Brett
Ah, I see. You definitely do not want to reassign the .data buffer in this case. An out= parameter does not reassign the memory location that the array object points to. It should use the allocated memory that was already there. It shouldn't copy anything at all; otherwise, median(x, out=out)

[Numpy-discussion] Median again

2008-01-29 Thread Matthew Brett
Hi, I was wondering whether there was any plan to change the anomalous interface of median, for example compared to 'mean', 'min', 'max' np.mean(a, axis=None, dtype=None, out=None) whereas: np.median(m) 'median(m) returns a median of m along the first dimension of m.' I think it would be a

Re: [Numpy-discussion] preparing for 1.0.5 release

2008-01-29 Thread Matthew Brett
Hi, http://projects.scipy.org/scipy/numpy/browser/branches/build_with_scons/ Excellent idea - and congratulations to David for all his hard work - but this is a large change, and I wonder if we need more time with the scons build system in the svn trunk? Not to say it should not be in 1.0.5,

Re: [Numpy-discussion] Median again

2008-01-29 Thread Matthew Brett
Hi, median moved mediandim0 implementation of medianwithaxis or similar, with same call signature as mean. Deprecation warning for use of median, and return of mediandim0 for now. Eventual move of median to return medianwithaxis. This would confuse people even more, I'm afraid.

Re: [Numpy-discussion] preparing for 1.0.5 release

2008-01-29 Thread Matthew Brett
Hi, All that is going to be merged are the hooks necessary to allow his numscons package to work. This is not a big change, as far as I know. Yes, sorry, I misunderstood - and had thought the plan was to move to the numscons build system as the default. Now I've understood it, it sounds

Re: [Numpy-discussion] Median again

2008-01-29 Thread Matthew Brett
Hi, median moved mediandim0 implementation of medianwithaxis or similar, with same call signature as mean. But - for the median function change - do we agree that this should be changed? I think it is a significant wart in the numpy API, and has caught quite a few people... Matthew

Re: [Numpy-discussion] [ANN] numscons 0.3.0 release

2008-01-25 Thread Matthew Brett
Hi, I've attached the build logs. I noticed that, for atlas, you check for atlas_enum.c - but do you in fact need this for the build? Now. I just wanted one header specific to atlas. It looks like not all version of ATLAS install this one, unfortunately (3.8, for example).

Re: [Numpy-discussion] Docstring standard: how to specify variable types

2008-01-24 Thread Matthew Brett
Hi, When would the function signature be missing? In C functions we copy the signature into the docstring. I am concerned about duplicating information that may change. I guess that would be def my_func(*args, **kwargs): although, if you're going to document the parameters in detail for

Re: [Numpy-discussion] Docstring standard: how to specify variable types

2008-01-24 Thread Matthew Brett
Also, Perhaps we could have that discussion on the IRC channel on Friday at some specified time? I suppose it's possible to hack up some processor of the form: doc_me('my_file.py') that can introspect things like argument lists, add boilerplate and process the resulting text according to the

[Numpy-discussion] Docstring page, out of date?

2008-01-21 Thread Matthew Brett
Hi, Search for the docstring standard, I hit this: http://www.scipy.org/DocstringStandard but I think the current thinking is this: http://projects.scipy.org/scipy/numpy/wiki/CodingStyleGuidelines Is that correct? Does the first page apply to matplotlib in some way? Should we change the first

[Numpy-discussion] Nose testing for numpy

2008-01-14 Thread Matthew Brett
Hi, I've just finished moving the scipy tests over to nose. Thinking about it, it seems to me to be a good idea to do the same for numpy. The advantages of doing this now are that numpy and scipy would be in parallel, that we can continue to have one testing system for both, and that it would

<    5   6   7   8   9   10   11   >