Re: [Numpy-discussion] how is y += x computed when y.strides = (0, 8) and x.strides=(16, 8) ?

2012-09-05 Thread Friedrich Romstedt
Poor Sebastian, you make the mistake of asking difficult questions. I noticed that it should be [6, 10] not [6, 12], and in fact is with numpy-1.4.1; while I observe the [4, 6] result with numpy-1.6.1. Logs follow: numpy-1.4.1 in Python-2.6.5 on Mac (intel 64bit) with Python + numpy built from

Re: [Numpy-discussion] Lazy imports again

2012-07-18 Thread Friedrich Romstedt
A.S.: Some forewords, below the first paragraphs are annotated after I got to the conclusion at the end of the email; read these annotation in square brackets as if it were footnotes. The main point to grasp and keep in mind for me was, when it comes to package hierarchies, that "import package.

Re: [Numpy-discussion] bug in reshape ?

2011-11-22 Thread Friedrich Romstedt
2011/11/23 : > might be an old story >>> np.__version__  -> '1.5.1' I have only a numpy 1.4.1 for testing atm, but I believe this corner case never occured and hence never got fixed since then. Confirming your issue on that. > It thought for once it's easier to use reshape to add a new axis > i

Re: [Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

2011-07-31 Thread Friedrich Romstedt
2011/7/29 Benjamin Root : > I am starting to get very interested in this quaternion concept (and maybe > how I could use it for mplot3d), but I have never come across it before > (beyond the typical vector math that I am familiar with). Can anybody > recommend a good introductory resource to get m

Re: [Numpy-discussion] Strange behavior of operator *=

2011-04-05 Thread Friedrich Romstedt
2011/4/5 Alan G Isaac : > On 4/5/2011 5:49 AM, François Steinmetz wrote: >>  >>> a = eye(2, dtype='int') >>  >>> a *= 1.0 >>  >>> a ; a.dtype >> array([[1, 0], >>         [0, 1]]) >> dtype('int64') > > This in-place (!) multiplication should not change > the dtype of a.  I suspect you did not exact

Re: [Numpy-discussion] 2d*3d matrix dot product

2011-02-09 Thread Friedrich Romstedt
2011/2/9 Davide Lasagna : > Hi, > > I want to compute the following dot product: > > P = np.array( [[ p11, p12 ], [p21, p22]] ) > C = np.array( [c1, c2] ) > > a1 = p11*c1 + p12*c2 > a2 = p21*c1 + p22*c2 > > P.shape = (n, n) > C.shape = (n, m, l) > > and with a result as: > > A.shape = (n, m, l) In

Re: [Numpy-discussion] question on use of newaxis

2011-02-09 Thread Friedrich Romstedt
2011/2/9 Mark Bakker : > a = array([1,2,3]) > > I want to take the last two terms and make it a column vector: > > a[[1,2],newaxis] > a[[1,2]][:,newaxis] The former is advanced indexing, while the latter is basic slicing (after advanced indexing). See http://docs.scipy.org/doc/numpy/reference/arr

Re: [Numpy-discussion] Indexing a 2-d array with a 1-d mask

2011-02-09 Thread Friedrich Romstedt
Hi, 2011/2/8 Alok Singhal : > Hi, > > I have an NxM array, which I am indexing with a 1-d, length N boolean > array.  For example, with a 3x5 array: > > In [1]: import numpy > In [2]: data = numpy.arange(15) > In [3]: data.shape = 3, 5 > > Now, I want to select rows 0 and 2, so I can do: > > In [4

Re: [Numpy-discussion] create a numpy array of images

2011-02-01 Thread Friedrich Romstedt
2011/2/1 Asmi Shah : > Thanks a lot Friedrich and Chris.. It came in handy to use PIL and numpy.. > :) :-) > I have one more question: how to avoid the limitation of memoryerror in > numpy. as I have like 200 images to stack in the numpy array of say > 1024x1344 resolution.. have any idea apart f

Re: [Numpy-discussion] Strange behaviour of numpy.asarray() in corner case

2011-01-31 Thread Friedrich Romstedt
2011/2/1 Warren Weckesser : >>  Shall I file a ticket? > > Yes. Ok, #1730: http://projects.scipy.org/numpy/ticket/1730. Thanks, Friedrich ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussio

Re: [Numpy-discussion] Strange behaviour of numpy.asarray() in corner case

2011-01-31 Thread Friedrich Romstedt
2011/1/28 Friedrich Romstedt : >>>> numpy.asarray([X(), numpy.asarray([1, 1])]).shape > (2,) >>>> numpy.asarray([numpy.asarray([1, 1]), X()]).shape > () Does noone have an opinion about this? Shall I file a ticket? Friedrich __

Re: [Numpy-discussion] create a numpy array of images

2011-01-30 Thread Friedrich Romstedt
2011/1/28 Christopher Barker : > On 1/28/11 7:01 AM, Asmi Shah wrote: >> I am using python for a while now and I have a requirement of creating a >> numpy array of microscopic tiff images ( this data is 3d, meaning there are >> 100 z slices of 512 X 512 pixels.) How can I create an array of images?

[Numpy-discussion] Strange behaviour of numpy.asarray() in corner case

2011-01-28 Thread Friedrich Romstedt
Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> numpy.__version__ '1.5.1' >>> class X: ... pass ... >>> numpy.asarray([X(), numpy.asarray([1, 1])]).shape (2

Re: [Numpy-discussion] bincount question

2011-01-08 Thread Friedrich Romstedt
2010/12/21 Alan G Isaac : > :: > >     >>> np.bincount([]) >     Traceback (most recent call last): >       File "", line 1, in >     ValueError: The first argument cannot be empty. > > Why not? > (I.e., why isn't an empty array the right answer?) >From the (i.e. "a", or, even more precise, "my")

Re: [Numpy-discussion] Why arange has no stop-point opt-in?

2010-12-30 Thread Friedrich Romstedt
2010/12/30 Friedrich Romstedt : > 2010/12/30 K.-Michael Aye : >> I'm a bit puzzled that there seems just no way to cleanly code an >> interval with evenly spaced numbers that includes the stop point given? >> linspace offers to include the stop point, but arange does not?

Re: [Numpy-discussion] Why arange has no stop-point opt-in?

2010-12-30 Thread Friedrich Romstedt
2010/12/30 K.-Michael Aye : > I'm a bit puzzled that there seems just no way to cleanly code an > interval with evenly spaced numbers that includes the stop point given? > linspace offers to include the stop point, but arange does not? > Am I missing something? (I am aware, that I could do > arange

Re: [Numpy-discussion] fromrecords yields "ValueError: invalid itemsize in generic type tuple"

2010-12-29 Thread Friedrich Romstedt
2010/12/7 Rajat Banerjee : > Hi All, > I have been using Numpy for a while with great success. I left my > little project for a little while > (http://web.mit.edu/stardev/cluster/) and now some of my code is > broken. > > I have some Numpy code to create graphs of activity on a cluster with > matpl

Re: [Numpy-discussion] ANN: NumPy 1.5.1

2010-12-05 Thread Friedrich Romstedt
Hi Ralf, 2010/12/5 Ralf Gommers : > It does look like a complete set. And it was named correctly and in sync > with python.org for a single week. From pythonmac list: > > "With Python 2.7, there are two Mac OS X installer variants available for > download: the "traditional" 32-bit-only (Intel and

Re: [Numpy-discussion] broadcasting with numpy.interp

2010-12-02 Thread Friedrich Romstedt
2010/12/1 greg whittier : > On Wed, Nov 24, 2010 at 3:16 PM, Friedrich Romstedt > wrote: >> I assume you just need *some* interpolation, not that specific one? >> In that case, I'd suggest the following: >> >> 1)  Use a 2d interpolation, taking into account all

Re: [Numpy-discussion] broadcasting with numpy.interp

2010-11-24 Thread Friedrich Romstedt
2010/11/16 greg whittier : > I'd like to be able to speed up the following code. > > def replace_dead(cube, dead): >   # cube.shape == (320, 640, 1200) >   # dead.shape == (320, 640) >   # cube[i,j,:] are bad points to be replaced via interpolation if > dead[i,j] == True > >    bands = np.arange(0,

Re: [Numpy-discussion] Where did the github numpy repository go?

2010-11-21 Thread Friedrich Romstedt
2010/11/14 Charles R Harris : > I keep getting page does not exist. The comments on the event, https://github.com/blog/744-today-s-outage, are simply great and stunning. Friedrich ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.

[Numpy-discussion] Knownfails due to platform and numpy.c99

2010-11-02 Thread Friedrich Romstedt
Hello, This is a NEPP (proposal for a numpy enhancement proposal). It's quite near to Depp, which means idiot in german, but I hope that's not the case. Some tests fail currently because of platform issues. I.e., the platform clib or similar supplies some partly broken implementation which we u

Re: [Numpy-discussion] ANN: NumPy 1.5.1 release candidate 1

2010-11-02 Thread Friedrich Romstedt
Hi Ralf, 2010/11/1 Ralf Gommers : > On Wed, Oct 27, 2010 at 10:30 PM, Ralf Gommers > wrote: >> On Wed, Oct 27, 2010 at 1:23 AM, Friedrich Romstedt >> wrote: >>> I found some issues on Mac OS X 10.5 ppc in py2.5.4: > > Can you please check if this takes care of

Re: [Numpy-discussion] whitespace in git repo

2010-10-27 Thread Friedrich Romstedt
attribute: 'true', 'false', '', '' attributes: text, eol, core.autocrlf filters: left alone. core.safecrlf: left alone. results. normalise: True, False workingdir_fmt: 'lf', 'crlf' # Apply text. # Can be skipped on check-out. if text == 'true': normalise = True elif text == 'false': nor

Re: [Numpy-discussion] whitespace in git repo

2010-10-27 Thread Friedrich Romstedt
2010/10/27 Darren Dale : > I'm losing interest myself. I don't think the issue is so complicated, > there just seems to be a lot of confusing misinformation being posted > here. I apologise for all misinformation I posted. I always double-check before sending. Believe me or not. I think the sub

Re: [Numpy-discussion] whitespace in git repo

2010-10-27 Thread Friedrich Romstedt
2010/10/27 Charles R Harris : > I'd like to do something here, but I'm waiting for a consensus and for > someone to test things out, maybe with a test repo, to make sure things > operate correctly. The documentation isn't that clear... Okay, I'll do that tomorrow (in ~13 hr). I feel responsible.

Re: [Numpy-discussion] whitespace in git repo

2010-10-27 Thread Friedrich Romstedt
Hi Darren, 2010/10/19 Darren Dale : > I have the following set in my ~/.gitconfig file: > >    [apply] >        whitespace = fix > >    [core] >        autocrlf = input > > which is attempting to correct some changes in: > > branding/icons/numpylogo.svg > branding/icons/numpylogoicon.svg > tools/w

Re: [Numpy-discussion] ANN: NumPy 1.5.1 release candidate 1

2010-10-26 Thread Friedrich Romstedt
I found some issues on Mac OS X 10.5 ppc in py2.5.4: See here: http://github.com/friedrichromstedt/numpy/tree/release%2F1.5.1rc1%2Fpy2.5-python.org-macosx10.3/release/logs/osx105rh/ I tested also on 10.6 intel and 10.5 intel, there are no Fs. The Python was freshly installed, only nose & the nu

[Numpy-discussion] clearing after build; Some directories missing in .gitignore?

2010-10-25 Thread Friedrich Romstedt
I was tearing my hear out yesterday evening with trying to find out and to understand how this directories occur in the build process and what role they play: build_doc/ doc/source/reference/generated/ The build process of the docs is rather opaque to me, so I don't know what to do with them. Th

[Numpy-discussion] Build Process and Version Control

2010-10-25 Thread Friedrich Romstedt
Hi, here is a summary of what we got so far with the Mac OS X build process: - We found it useful to put /Library/Frameworks/Python.framework/Versions/2.x under version control with git. This lets us get rid of the paver bootstrap thingy, since we just switch to a branch via ``git checkout nump

Re: [Numpy-discussion] tests fails when run $nosetests numpy, but not from python prompt

2010-10-25 Thread Friedrich Romstedt
2010/10/25 Vincent Davis : > On Sun, Oct 24, 2010 at 6:29 PM,   wrote: >> On Sun, Oct 24, 2010 at 8:17 PM, Ralf Gommers >> wrote: >>> On Sun, Oct 24, 2010 at 2:44 AM, Vincent Davis >>> wrote: python2.7 10.5, osx 10.6, numpy 1.5.1rc1 Test pass when run from python prompt (see bottom) bu

Re: [Numpy-discussion] whitespace in git repo

2010-10-21 Thread Friedrich Romstedt
2010/10/21 Darren Dale : > I filed a new pull request, http://github.com/numpy/numpy/pull/7 . > This should enforce LF on all text files, with the current exception > of the nsi.in file, which is CRLF. The svgs have been converted to LF. > Additional, confusing reading can be found at > http://help

Re: [Numpy-discussion] whitespace in git repo

2010-10-21 Thread Friedrich Romstedt
2010/10/21 David Cournapeau : > On Thu, Oct 21, 2010 at 12:56 AM, Friedrich Romstedt > wrote: >> 2010/10/20 Darren Dale : >>> On Wed, Oct 20, 2010 at 6:12 AM, Friedrich Romstedt >>> wrote: >>>> Due to Darren's config file the .nsi.in file made i

Re: [Numpy-discussion] whitespace in git repo

2010-10-20 Thread Friedrich Romstedt
ust an eol conversion. Opinions, Comments? I know, this topic is unattractive. http://www.astro.gla.ac.uk/users/labrosse/PORTFOLIO/images/cosmicsexinessladder.png (from http://www.astro.gla.ac.uk/users/labrosse/PORTFOLIO/philo.html) This is somewhere at the other end of the world :-) Friedrich

Re: [Numpy-discussion] whitespace in git repo

2010-10-20 Thread Friedrich Romstedt
2010/10/20 Darren Dale : > On Wed, Oct 20, 2010 at 6:12 AM, Friedrich Romstedt > wrote: >> Due to Darren's config file the .nsi.in file made it with CRLF into the repo. > > Uh, no. You mean I'm wrong? Wait, I'll check, but ...Hmm, how do I check the line endings

Re: [Numpy-discussion] whitespace in git repo

2010-10-20 Thread Friedrich Romstedt
2010/10/20 Charles R Harris : > [...] I think we do need a > .gitconfig file [...] .gitattributes > so why don't you go ahead and make one and > deal with the nsi.in file in the process. http://github.com/friedrichromstedt/numpy/tree/friedrich-gitattributes-nsis > The .svg files can have their

Re: [Numpy-discussion] whitespace in git repo

2010-10-19 Thread Friedrich Romstedt
2010/10/19 Darren Dale : > We have been discussing whitespace and line endings at the following > pull request: http://github.com/numpy/numpy/pull/4 . Chuck suggested > we discuss it here on the list. > > I have the following set in my ~/.gitconfig file: > >    [apply] >        whitespace = fix > >

[Numpy-discussion] Proposal: Numpy Build Docs

2010-10-17 Thread Friedrich Romstedt
Hello, I finally found some time today and since the installers are not feasible in one and a half hour I decided to set up a proper doc of what we're doing so far with the Mac OS X 10.5 installer issue. A few advantages: * We all (meaning Vincent, Ralf, and me) will be more careful with what w

Re: [Numpy-discussion] Sorry, probably postponing Binary Release [urgent]

2010-10-16 Thread Friedrich Romstedt
2010/10/16 Vincent Davis : > On Sat, Oct 16, 2010 at 11:25 AM, Friedrich Romstedt > wrote: >> 2010/10/16 Ralf Gommers : >>> On Sun, Oct 17, 2010 at 12:36 AM, Friedrich Romstedt >>> wrote: >>>>  I need some spare of this for my exam on Monday.  I see t

Re: [Numpy-discussion] Sorry, probably postponing Binary Release [urgent]

2010-10-16 Thread Friedrich Romstedt
2010/10/16 Ralf Gommers : > Hi Friedrich, > > On Sun, Oct 17, 2010 at 12:36 AM, Friedrich Romstedt > wrote: >> Hi, >> >> I've been working the past few days usually to somewhen between 1 and >> 7 in the morning on the numpy build, but I feel at the end

Re: [Numpy-discussion] Sorry, probably postponing Binary Release [urgent]

2010-10-16 Thread Friedrich Romstedt
Addendum: Ralf, vpn? 2010/10/16 Friedrich Romstedt : > Hi, > > I've been working the past few days usually to somewhen between 1 and > 7 in the morning on the numpy build, but I feel at the end of my > power.  I need some spare of this for my exam on Monday.  I see two > o

[Numpy-discussion] Sorry, probably postponing Binary Release [urgent]

2010-10-16 Thread Friedrich Romstedt
Hi, I've been working the past few days usually to somewhen between 1 and 7 in the morning on the numpy build, but I feel at the end of my power. I need some spare of this for my exam on Monday. I see two options: 1) Vincent, if you feel like, can you try to finish it on your own. Don't know .

Re: [Numpy-discussion] help from OS X 10.5 users wanted

2010-10-16 Thread Friedrich Romstedt
2010/10/16 Ralf Gommers : > On Sat, Oct 16, 2010 at 3:53 AM, Friedrich Romstedt > wrote: >> Here come now the interesting facts: >> >> 1)  Some tests of numpy failed in 2.0.0.dev.  When the machine is >> running again I can send the logs.  All some strange-looking

Re: [Numpy-discussion] OS X installers - naming scheme and 2.7 annoyance

2010-10-16 Thread Friedrich Romstedt
2010/10/16 Ralf Gommers : > With there being two different installers for Python 2.7 on python.org > (10.3+ has ppc/i386, 10.5+ has ppc/i386/x86_64) a change to the naming > scheme is needed for the numpy binaries. That's assuming we provide > two corresponding installers with the same arches. I pr

[Numpy-discussion] Tesing of the numpy 1.5.1 dmgs

2010-10-15 Thread Friedrich Romstedt
Hi, I just poked around the newly created files, and here they are: The dmg: http://friedrichromstedt.org/numpy/Release/10-10-16/01-numpy-2.0.0.dev-py2.5-python.org.dmg (just to be sure: PRELIMINARY) The test file of the numpy 2.0.0 on the build machine: http://friedrichromstedt.org/numpy/Tests

Re: [Numpy-discussion] help from OS X 10.5 users wanted

2010-10-15 Thread Friedrich Romstedt
One more question: Do we support any external library in the official binaries? I've heard the names MKL and BLAS, LAPACK, ... all stuff I don't know really tbh, but do we have to install them? On the http://projects.scipy.org/numpy/wiki/MakingReleases page, Cython is mentioned, I've seen no call

Re: [Numpy-discussion] help from OS X 10.5 users wanted

2010-10-15 Thread Friedrich Romstedt
2010/10/15 Christopher Barker : >> [15.10.10 05:36:01] Friedrich Romstedt: In >> Users/Shared/GitHub/project-numpy/owner-numpy/numpy-deployment/tools/numpy-macosx-installer >> [15.10.10 05:36:18] Friedrich Romstedt: -rw-r--r--@ 1 Friedrich  wheel >>   8190646 Oct 14 21:

Re: [Numpy-discussion] help from OS X 10.5 users wanted

2010-10-15 Thread Friedrich Romstedt
2010/10/15 Christopher Barker : > On 10/15/10 10:54 AM, Russell E. Owen wrote: >> I have a 10.4 Intel machine I keep around >> for the sole purpose of building backward-compatible binary installers >> for PIL and matplotlib. If help is still wanted I'm happy to build numpy >> as well. > > I'll let

Re: [Numpy-discussion] help from OS X 10.5 users wanted

2010-10-14 Thread Friedrich Romstedt
Vincent and me had some success: 15.10.10 05:34:35] Vincent Davis: so you have a dmg now? [15.10.10 05:34:48] Friedrich Romstedt: I cant believe it, I want to see the file first [15.10.10 05:35:06] Friedrich Romstedt: we have an mpkg in dist [15.10.10 05:35:37] Friedrich Romstedt: yes, we have

Re: [Numpy-discussion] Awaiting confirmation before closing tickets

2010-10-14 Thread Friedrich Romstedt
2010/10/11 Pierre GM : > All, > The following tickets could be closed if somebody confirmed everything works > OK: > * 1586: fixed in r8714 > * 1593: fixed in r8715 > * 1591: fixed in r8713 > * 1493: fixed a while ago (sorry, I completely forgot to comment on it). > Let me know how it goes and I'l

Re: [Numpy-discussion] installing different tag or branches from git source

2010-10-13 Thread Friedrich Romstedt
There are good docs at kernel.org, or in your local system maybe, the URL I'm using usually is http://www.kernel.org/pub/software/scm/git/docs/ You can switch around my modifying the URL once at git-checkout (what will be your starting point) or similar. :-) Friedrich ___

Re: [Numpy-discussion] help from OS X 10.5 users wanted

2010-10-13 Thread Friedrich Romstedt
Okay I guessed that, so first, we (Vincent and me) are just going the normal route and make a working solution. So we're going to use the standard (in the best sense) python.org installers and we'll compile against them. I'll test the installers on my own 10.6 notebook and on the rather virgin 10

Re: [Numpy-discussion] help from OS X 10.5 users wanted

2010-10-13 Thread Friedrich Romstedt
2010/10/13 Christopher Barker : > On 10/12/10 2:00 PM, Vincent Davis wrote: >> I could do 10.4 also. For me doing this is maybe best described as a >> curiosity. But my understanding was that some where having trouble >> install on 10.5 with binaries made on 10.6. So if I can learn >> something and

Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Friedrich Romstedt
2010/10/12 Skipper Seabold : > On Tue, Oct 12, 2010 at 12:32 PM, Robert Kern wrote: >> On Tue, Oct 12, 2010 at 11:25, Friedrich Romstedt >> wrote: >>> 2010/10/12 Skipper Seabold : >>>> Some elaboration here? >>>> http://www.scipy.org/FAQ#head-94

Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Friedrich Romstedt
2010/10/12 Skipper Seabold : > Some elaboration here? > http://www.scipy.org/FAQ#head-9448031cbb9760d0a44db0eceda47393e56e8270 I don't know if I understand what you want, do you want me or someone else to explain the section "What is the preferred way to test if an array is empy?" in the scipy FAQ

Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Friedrich Romstedt
2010/10/12 Ian Goodfellow : > If the arrays are the same size or can be broadcasted to the same > size, it returns true or false on an elementwise basis. > If the arrays are not the same size and can't be broadcasted to the > same size, it returns False, which was a surprise to me too. > >  >>> imp

Re: [Numpy-discussion] help from OS X 10.5 users wanted

2010-10-10 Thread Friedrich Romstedt
2010/10/9 Vincent Davis : > Did you get any responses on this? I can install 10.5 and help out > with some testing. I have a macbookpro that does not turn of (Hardware > issue) but it is good for testing. I could setup remote access on this > if of interest to you. I can also help with the install

Re: [Numpy-discussion] ufunc.accumulate question

2010-10-06 Thread Friedrich Romstedt
2010/10/5 Chris Withers : > Hi All, > > I can't find any docs on this behavior. > > So, I have a python function. To keep it simple, lets just do addition: > > def add(x,y): >   print x,y >   retun x+y > > So, I can turn this into a ufunc as follows: > > uadd = np.frompyfunc(add,2,1) As a side rem

Re: [Numpy-discussion] Asking for opinions: Priops

2010-09-27 Thread Friedrich Romstedt
2010/9/23 Dag Sverre Seljebotn : > Essentially, perhaps what you have sketched up + an ability to extend > the graph with object conversion routes would be perfect for my own > uses. So you can define a function with overloads (A, B) and (A, C), but > also that objects of type D can be converted to

Re: [Numpy-discussion] Asking for opinions: Priops

2010-09-23 Thread Friedrich Romstedt
Hi Sebastian, Thanks for your reply! 2010/9/22 Sebastian Walter : > [...] I think the issue is not so much numpy but rather the > way Python implements operator overloading using methods like __add__ > and __radd__.  Hence, your suggestion seems to be a Python Enhancement > Proposal and should be

[Numpy-discussion] Re-pinging two old issues

2010-09-16 Thread Friedrich Romstedt
I'd really love to see these two things fixed: bugreport1.py When comparing objects using the numpy mechanism for == or != (only those apparently), everything is cast to an ndarray, even if this results in an dtype=numpy.object array. E.g. for addition, this doesn't happen. Installing loggers

[Numpy-discussion] Asking for opinions: Priops

2010-09-16 Thread Friedrich Romstedt
I just ran across the problem of priorities with ndarrays again and it keeps biting me. I did once ago a workaround to get my ``undarray`` class's methods be called when being the second operand of e.g. + . But since I wrote it, always Python crashes on exit with the message: Python-32(68665) m

Re: [Numpy-discussion] Two questions on indexing

2010-09-16 Thread Friedrich Romstedt
2010/9/15 Mark Fenner : > One method of using indices seems to be as follows: > > In [19]: a = N.array(range(6)).reshape(3,2) > In [20]: i = N.indices([3,2]) > In [21]: r,c = i > In [22]: a[r,c] > Out[22]: > array([[0, 1], >       [2, 3], >       [4, 5]]) > > In [23]: a[tuple(i)] > Out[23]: > array

Re: [Numpy-discussion] clip() with None as argument

2010-09-07 Thread Friedrich Romstedt
Ah, no need to answer, I do this myself: Friedrich, would you please use numpy.inf and -numpy.inf. Thanks, and sorry for the noise, Friedrich ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discu

[Numpy-discussion] clip() with None as argument

2010-09-07 Thread Friedrich Romstedt
I just came across a problem with the intention to specify unset boundaries given to numpy.clip() or array.clip(): a.clip(1e-10, None) a.clip(None, -1e-10) When doing this, the returned array is dtype=numpy.object, seemingly None gets converted to a numpy.asarray(None, dtype=numpy.object), and th

Re: [Numpy-discussion] Boolean arrays

2010-08-31 Thread Friedrich Romstedt
2010/8/27 Brett Olsen : > If there's multiple possible valid values, I've come up with a couple > possible methods, but they all seem to be inefficient or kludges: valid = N.array(("a", "c")) (ar == valid[0]) | (ar == valid[1]) > array([ True, False,  True, False, False,  True, False,  Tr

Re: [Numpy-discussion] numpy installation problems

2010-08-23 Thread Friedrich Romstedt
2010/8/23 martin djokovic : > /usr/local/lib/python2.4/site-packages/numpy/fft/fftpack_lite.so: undefined > symbol: vmldCos2 To me this looks familiar ... I ran into this problem usually when having Python compiled with another compiler than the library. In your case, it's a bit strange, because

Re: [Numpy-discussion] Problem with loadtxt

2010-08-18 Thread Friedrich Romstedt
2010/8/18 Scott MacDonald : > In [42]: c = StringIO("5399354557888517120") Well, should't it be StringIO("5399354557888517312")? Maybe I'm missing sth. Friedrich ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman

Re: [Numpy-discussion] fancy indexing question

2010-08-18 Thread Friedrich Romstedt
2010/8/17 Angus McMorland : > a = np.random.randint(10, size=(4,3,2)) > ord = np.array([[3,2,1,0],[0,2,1,3],[3,0,2,1]]).T > b = a[ord][:,np.eye(3, dtype=bool),:] b = a[ord, arange(0, 3)] Broadcasting rules! Tested. Friedrich ___ NumPy-Discussion maili

Re: [Numpy-discussion] Tensor-Like Outer Product Question

2010-08-03 Thread Friedrich Romstedt
2010/8/3 matt_in_nyc : > X is an m by n matrix, and I want to store outer products of the form Y[i] = > numpy.outer(X[i,:], X[i,:]), leading to the relation Y[i,j,k] = > X[i,j]*X[i,k] for i = 0,...,m-1; j,k = 0,...,n-1.  I am trying to think of > how to do this using tensordot, but so far I am find

Re: [Numpy-discussion] str == int puzzlement

2010-08-01 Thread Friedrich Romstedt
2010/8/1 Matthew Brett : >> Maybe it would be better to raise a ValueError, which is not caught by >> the evaluation mechanism, to prevent such stuff. > > Sorry that this is not yet clear to me, but, is it true then that: > > The only situation where array.__eq__ sensibly falls back to python > __e

Re: [Numpy-discussion] str == int puzzlement

2010-07-31 Thread Friedrich Romstedt
2010/7/29 Keith Goodman : > On Wed, Jul 28, 2010 at 6:42 PM, Matthew Brett > wrote: >> Hi, >> >> Please forgive me if this is obvious, but this surprised me: >> >> In [15]: x = np.array(['a', 'b']) >> >> In [16]: x == 'a'  # this was what I expected >> Out[16]: array([ True, False], dtype=bool) >

Re: [Numpy-discussion] Crosstabulation

2010-07-22 Thread Friedrich Romstedt
2010/7/20 Vincent Schut : > slope_bin_edges = [0, 3, 15, 35] > landuse_bin_edges = [0, 1, 2, 3] > crosstab = numpy.histogram2d(landuse, slope, bins=(landuse_bin_edges, > slope_bin_edges)) I like it! I guess the actual bins are [0, 3), [3, 15) and [15, 35)? >From the docs, that is not so clear. E

Re: [Numpy-discussion] Crosstabulation

2010-07-19 Thread Friedrich Romstedt
2010/7/19 sandric ionut : > For land-use a class would be for example forest, other would be orchard > etc. For Slope gradient I would have values which <3 and between 3 and 7 > etc. So, I will have 2 raster data with, let's say, 3 classes each: forest, > orchards and built-up area and for slope gr

Re: [Numpy-discussion] Crosstabulation

2010-07-17 Thread Friedrich Romstedt
2010/7/17 Robert Kern : > On Sat, Jul 17, 2010 at 13:11, Friedrich Romstedt > wrote: >> 2010/7/14 Ionut Sandric : >> I'm afraid also Zach does not understand what you are talking about >> ... So my first question (please bear with me) would be: What's a dem? >

Re: [Numpy-discussion] Crosstabulation

2010-07-17 Thread Friedrich Romstedt
2010/7/14 Ionut Sandric : > By raster data I mean classified slope gradient (derived from a dem), > landuse-landcover, lithology etc. A crosstabulation analysis will give me a > table with the common areas for each class from each raster and this will go > into other analysis. I can do it with o

Re: [Numpy-discussion] Crosstab

2010-07-17 Thread Friedrich Romstedt
2010/7/14 Ionut Sandric : > I have two raster data and I would like to do a crosstabulation between them > and export the results to a table in a text file. Is it possible to do it > with NumPy? Does someone have an example? Am I understanding you correctly when I suppose you mean what is explai

Re: [Numpy-discussion] Difference between shape=() and shape=(1,)

2010-07-17 Thread Friedrich Romstedt
2010/7/14 John Reid : > That sounds useful but I should have said: sometimes I need to replace > other values that aren't NaNs. Sorry, for the double dumb recommendation of nan_to_num, but when replacing other normal values mabe you can use: >>> a = numpy.asarray(1) >>> b = numpy.asarray([10, 1])

Re: [Numpy-discussion] Difference between shape=() and shape=(1,)

2010-07-17 Thread Friedrich Romstedt
2010/7/13 John Reid : > Hi, > > I have some arrays of various shapes in which I need to set any NaNs to > 0. I just ran across numpy.nan_to_num(): >>> a = numpy.log(-1) >>> b = numpy.log([-1, 1]) >>> a nan >>> b array([ NaN, 0.]) >>> numpy.nan_to_num(a) 0.0 >>> numpy.nan_to_num(b) array([ 0.,

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Friedrich Romstedt
2010/6/28 Keith Goodman : > How about using h5py? It's not part of numpy but it gives you a > dictionary-like interface to your archive: Yeaa, or PyTables (is that equivalent)? It's also a hdf (or whatever, I don't recall precisely) interface. There were [ANN]s on the list about PyTables. Fried

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Friedrich Romstedt
2010/6/28 Ruben Salvador : > Thanks for the answer Friedrich, I had already checked numpy.savez, but > unfortunately I cannot make use of it. I don't have all the data needed to > be saved at the same time...it is produced each time I run a test. Yes, I thought of something like: all_data = numpy

Re: [Numpy-discussion] printing of array and leading white space ?

2010-06-27 Thread Friedrich Romstedt
I don't know precisely how the decision is made, but in general one needs the pad spaces for printing arrays with > 1 row. Friedrich 2010/6/26 Vincent Davis : > This is a little strange and I am not sure what is going on. Look at > the number of spaced before the first number in the array. >

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-24 Thread Friedrich Romstedt
2010/6/23 Ruben Salvador : > Therefore, is this a bug? Shouldn't EOFError be raised instead of IOError? > Or am I missunderstanding something? If this is not a bug, how can I detect > the EOF to stop reading (I expect a way for this to work without tweaking > the code with saving first in the file

Re: [Numpy-discussion] Tensor contraction

2010-06-14 Thread Friedrich Romstedt
2010/6/13 Alan Bromborsky : > Friedrich Romstedt wrote: >>> I am writing symbolic tensor package for general relativity.  In making >>> symbolic tensors concrete >>> I generate numpy arrays stuffed with sympy functions and symbols. >> >> That sound'

Re: [Numpy-discussion] Tensor contraction

2010-06-13 Thread Friedrich Romstedt
2010/6/13 Alan Bromborsky : > I am writing symbolic tensor package for general relativity.  In making > symbolic tensors concrete > I generate numpy arrays stuffed with sympy functions and symbols. That sound's interesting. > The > operations are tensor product > (numpy.multiply.outer), permutati

Re: [Numpy-discussion] Tensor contraction

2010-06-13 Thread Friedrich Romstedt
2010/6/13 Pauli Virtanen : > def tensor_contraction_single(tensor, dimensions): >    """Perform a single tensor contraction over the dimensions given""" >    swap = [x for x in range(tensor.ndim) >            if x not in dimensions] + list(dimensions) >    x = tensor.transpose(swap) >    for k in r

Re: [Numpy-discussion] Tensor contraction

2010-06-12 Thread Friedrich Romstedt
2010/6/12 Alan Bromborsky : > If I have a single numpy array, for example with 3 indices T_{ijk} and I > want to sum over two them in the sense of tensor contraction - > > T_{k} = \sum_{i=0}^{n-1} T_{iik}.  Is there an easy way to do this with > numpy? Also you can give: T[I, I, :].sum(axis=0) a

Re: [Numpy-discussion] C vs. Fortran order -- misleading documentation?

2010-06-08 Thread Friedrich Romstedt
2010/6/8 Anne Archibald : > Numpy arrays can have any configuration of memory strides, including > some that are zero; C and Fortran contiguous arrays are simply those > that have special arrangements of the strides. The actual stride > values is normally almost irrelevant to python code. First, I

Re: [Numpy-discussion] Coordinate Camera Optics for Astrophotography -- sin(zenith)

2010-06-03 Thread Friedrich Romstedt
Maybe it has to do with the fact that at the zenith any difference in rectascension means essentially no change? Friedrich ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] "Dynamic convolution" in Numpy

2010-06-03 Thread Friedrich Romstedt
Have you ever considered using pygame? Afaik, it is based on SDL and therefore should support realtime mixing and writing to the sound buffer simultaneously as it is played back. I did not check the gory details but it seems that pygame has the Mixer interface from SDL, good luck! For your thing

Re: [Numpy-discussion] 2d binning on regular grid

2010-06-03 Thread Friedrich Romstedt
Hello Andreas, please see this as a side remark. A colleague of mine made me aware of a very beautiful thing about covering spheres by evenly spaced points: http://healpix.jpl.nasa.gov/ Since you want to calculate mean and stddev, to my understanding a grid in longitude/latitude is without prop

Re: [Numpy-discussion] Finding Star Images on a Photo (Video chip) Plate?

2010-06-01 Thread Friedrich Romstedt
One can also try to use photometry software like Daophot, it uses MIDAS by ESO http://www.eso.org/sci/data-processing/software/esomidas// , which everyone can download. It seems that Daophot http://www.star.bris.ac.uk/~mbt/daophot/ isn't for free :-(, I never cared, since it's installed on our ins

Re: [Numpy-discussion] curious about how people would feel about moving to github

2010-05-27 Thread Friedrich Romstedt
2010/5/27 Friedrich Romstedt : > I just want to say that I used Git on Windows without any problem > using a minGW built Git, i.e. msysgit: Hm, I read the other thread too late to recognise this to be discussed already - Sorry And hey, even Windows has Tab completion of path names, even

Re: [Numpy-discussion] curious about how people would feel about moving to github

2010-05-27 Thread Friedrich Romstedt
I just want to say that I used Git on Windows without any problem using a minGW built Git, i.e. msysgit: http://code.google.com/p/msysgit/downloads/list The only problem I see is that with CR / CRLF / LF. When one installs msysgit, one can choose what procedure to take - to commit to the repo wi

Re: [Numpy-discussion] Help Convolution with binaural filters(HRTFs)

2010-05-27 Thread Friedrich Romstedt
2010/5/27 arthur de conihout : > I try to make me clearer on my project : > [...] I think I understood now. Thank you for explanation. >  original = [s / 2.0**15 for s in original] > >     nframes=filtre.getnframes() >     nchannels=filtre.getnchannels() >     filtre = struct.unpack_from("%dh" %

Re: [Numpy-discussion] Help Convolution with binaural filters(HRTFs)

2010-05-27 Thread Friedrich Romstedt
2010/5/26 arthur de conihout : > i try to implement a real-time convolution module refreshed by head > listener location (angle from a reference point).The result of the > convolution by binaural flters(HRTFs) allows me to spatialize a monophonic > wavfile. I suspect noone not closely involved wit

Re: [Numpy-discussion] saving object array to ascii file

2010-05-07 Thread Friedrich Romstedt
2010/5/7 Maria Liukis : > Sorry if it's a trivial question. I'm trying to find out if there is a way to > save object array to ascii file. numpy.savetxt() in NumPy V1.3.0 doesn't seem > to work: Maybe according to http://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html#numpy.save

Re: [Numpy-discussion] Extracting values from one array corresponding to argmax elements in another array

2010-04-09 Thread Friedrich Romstedt
2010/4/5 Ken Basye : >  I have two arrays, A and B, with the same shape.  I want to find the > highest values in A along some axis, then extract the corresponding > values from B. Maybe: def select(A, B, axis): # Extract incomplete index tuples: argmax = a.argmax(axis = axis)

Re: [Numpy-discussion] List of indices

2010-04-08 Thread Friedrich Romstedt
2010/4/2 Shailendra : x=arange(10) indices=[(1,),(2,)] x[indices] > Traceback (most recent call last): >  File "", line 1, in > IndexError: unsupported iterator index I have more odd things to report (numpy 1.4.0): >>> b = numpy.asarray([[1, 2], [3, 4]]) >>> b[[(0, 0)]] array([[1,

Re: [Numpy-discussion] "Match" two arrays

2010-04-01 Thread Friedrich Romstedt
2010/4/1 Shailendra : > Hi All, > I want to make a function which should be like this [...] We had a thread some time ago, very long and with lots of working code, which seems to me related to this: Thread title: "Iterative Matrix Multiplication" (do a search under "Bug Reports" on numpy.scipy.or

  1   2   >