Open sf-issues opened 12 years ago
Submitted by ceball Date: 2011-10-06 21:15 GMT
topographica-core-developers email re: Numpy-discussion Digest, Vol 20, Issue 20 (2008-05-06 from jbednar)
Submitted by ceball Date: 2011-10-07 15:07 GMT
See Jim's message somewhere near the end...
From: numpy\-discussion\-request@scipy\.org Date: Tue, May 6, 2008 at 22:10 To: numpy-discussion@scipy.org
Send Numpy-discussion mailing list submissions to numpy-discussion@scipy.org
To subscribe or unsubscribe via the World Wide Web, visit http://projects.scipy.org/mailman/listinfo/numpy-discussion or, via email, send a message with subject or body 'help' to numpy-discussion-request@scipy.org
You can reach the person managing the list at numpy-discussion-owner@scipy.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Numpy-discussion digest..."
Today's Topics:
1. Re: Tests for empty arrays (Timothy Hochberg) 2. Re: Tests for empty arrays (Keith Goodman) 3. Re: labeled array (Christoph T. Weidemann) 4. float is not called when instance can not evaluated. (Sebastian Kr?mer) 5. What is .T? (Keith Goodman) 6. Re: What is .T? (Robert Kern) 7. Re: What is .T? (Keith Goodman) 8. Re: numpy in RHEL4 (Robert Kern) 9. Re: cannot edit page on scipy-dev wiki (Robert Kern) 10. Re: Status Report for NumPy 1.1.0 (Charles R Harris)
Message: 1 Date: Tue, 6 May 2008 10:03:38 -0700 From: "Timothy Hochberg" tim\.hochberg@ieee\.org Subject: Re: [Numpy-discussion] Tests for empty arrays To: "Discussion of Numerical Python" numpy\-discussion@scipy\.org Message-ID: e4412d6b0805061003g516777cfxc7fa7f1ee99912cf@mail\.gmail\.com Content-Type: text/plain; charset="iso-8859-1"
On Tue, May 6, 2008 at 9:53 AM, Keith Goodman kwgoodman@gmail\.com wrote:
On Tue, May 6, 2008 at 9:45 AM, Anne Archibald peridot\.faceted@gmail\.com wrote:
In fact, if you want to use empty() down the road, it may make sense to initialize your array to zeros()/0., so that if you ever use the values, the NaNs will propagate and become obvious.
Numpy has ones and zeros. Could we add a nans?
I often initialize using x = nan * ones((n ,m)). But if it's in a loop, I'll avoid one copy by doing
x = np.ones((n, m)) x *= np.nan
To many on the list using nans for missing values is like chewing gum you found on the sidewalk. But I use it all the time so I'd use a nans.
Why don't you just roll your own?
def nans(shape, dtype=float): ... a = np.empty(shape, dtype) ... a.fill(np.nan) ... return a ... nans([3,4]) array([[ NaN, NaN, NaN, NaN], [ NaN, NaN, NaN, NaN], [ NaN, NaN, NaN, NaN]])
-- . __ . |-\ . . tim.hochberg@ieee.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080506/19b6138d/attachment-0001.html
Message: 2 Date: Tue, 6 May 2008 10:14:41 -0700 From: "Keith Goodman" kwgoodman@gmail\.com Subject: Re: [Numpy-discussion] Tests for empty arrays To: "Discussion of Numerical Python" numpy\-discussion@scipy\.org Message-ID: f4f93d420805061014n63af2404ued16f47c86e2b92e@mail\.gmail\.com Content-Type: text/plain; charset=ISO-8859-1
On Tue, May 6, 2008 at 10:03 AM, Timothy Hochberg tim\.hochberg@ieee\.org wrote:
Why don't you just roll your own?
def nans(shape, dtype=float): ... a = np.empty(shape, dtype) ... a.fill(np.nan) ... return a ... nans([3,4]) array([[ NaN, NaN, NaN, NaN], [ NaN, NaN, NaN, NaN], [ NaN, NaN, NaN, NaN]])
I learn a lot from this list. I didn't know about fill. Looks like it is much faster than adding nan.
timeit nans0((500,500)) 10 loops, best of 3: 30.5 ms per loop timeit nans1((500,500)) 1000 loops, best of 3: 956 ?s per loop
def nans0(shape, dtype=float): a = np.ones(shape, dtype) a += np.nan return a
def nans1(shape, dtype=float): a = np.empty(shape, dtype) a.fill(np.nan)
No need to roll my own. I'll smoke yours. return a
Message: 3 Date: Tue, 6 May 2008 13:15:16 -0400 From: "Christoph T. Weidemann" ctw@cogsci\.info Subject: Re: [Numpy-discussion] labeled array To: numpy-discussion@scipy.org Message-ID: c78dc03d0805061015g7f4f773clc0f415b2b6162475@mail\.gmail\.com Content-Type: text/plain; charset=ISO-8859-1
On Tue, May 6, 2008 at 1:00 PM, "Keith Goodman" kwgoodman@gmail\.com wrote:
I'm trying to design a labeled array class. A labeled array contains a 2d array and two lists. One list labels the rows of the array (e.g. variable names) and another list labels the columns of the array (e.g. dates).
I'm working on a dimensioned data class that seems to be a more general case of what you are looking for. It's a subclass of ndarray, and contains an attribute which specifies each dimension (this works for any number of dimensions, not just 2D). This data structure is not currently in a state where it's useful yet, but this will hopefully change soon.
Message: 4 Date: Tue, 06 May 2008 21:03:14 +0200 From: Sebastian Kr?mer basti\.kr@gmail\.com Subject: [Numpy-discussion] float is not called when instance can not evaluated. To: numpy discussion numpy\-discussion@scipy\.org Message-ID: 1210100594\.6081\.32\.camel@basti\-desktop Content-Type: text/plain; charset=UTF-8
Hi all,
I'm currently working on a function that converts a sympy ?(http://code.google.com/p/sympy) expression to a lambda-function. In this lambda-function all sympy builtin functions are replaced by numpy functions, since they are faster. Now it may happen that users pass sympy-symbols like pi to these lambda functions and so it is possible that numpy-functions get these symbols. The same functionality is implemented using python's math module, and it works because the math functions call the float method and therefor get a number they can work with. However, numpy doesn't do this, it only looks if there is a method with the same name as the called function. e.g:
numpy.cos(sympy.pi) <type 'exceptions.AttributeError'>: cos
whereas:
math.cos(sympy.pi) -1.0
Would it be possible to change numpys behaviour so that x.float() is tried after x.cos() has failed? Or are there any other possible solutions?
Thanks in advance, Sebastian
Message: 5 Date: Tue, 6 May 2008 12:22:05 -0700 From: "Keith Goodman" kwgoodman@gmail\.com Subject: [Numpy-discussion] What is .T? To: "Discussion of Numerical Python" numpy\-discussion@scipy\.org Message-ID: f4f93d420805061222k63862a4dw3fe722a969ccf124@mail\.gmail\.com Content-Type: text/plain; charset=ISO-8859-1
What is .T? It looks like an attribute, behaves like a method, and smells like magic. I'd like to add it to my class but don't no where to begin.
Message: 6 Date: Tue, 6 May 2008 14:28:24 -0500 From: "Robert Kern" robert\.kern@gmail\.com Subject: Re: [Numpy-discussion] What is .T? To: "Discussion of Numerical Python" numpy\-discussion@scipy\.org Message-ID: 3d375d730805061228l3f996769t8ed3b86a7893bded@mail\.gmail\.com Content-Type: text/plain; charset=UTF-8
On Tue, May 6, 2008 at 2:22 PM, Keith Goodman kwgoodman@gmail\.com wrote:
What is .T? It looks like an attribute, behaves like a method, and smells like magic. I'd like to add it to my class but don't no where to begin.
It is a property. It returns the transpose of the array. If you had a .transpose() method on your class already, you could do (in Python 2.4+)
@property def T(self): return self.transpose()
-- Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Message: 7 Date: Tue, 6 May 2008 12:37:57 -0700 From: "Keith Goodman" kwgoodman@gmail\.com Subject: Re: [Numpy-discussion] What is .T? To: "Discussion of Numerical Python" numpy\-discussion@scipy\.org Message-ID: f4f93d420805061237x677a6024p627358c932835a0a@mail\.gmail\.com Content-Type: text/plain; charset=ISO-8859-1
On Tue, May 6, 2008 at 12:28 PM, Robert Kern robert\.kern@gmail\.com wrote:
On Tue, May 6, 2008 at 2:22 PM, Keith Goodman kwgoodman@gmail\.com wrote: > What is .T? It looks like an attribute, behaves like a method, and > smells like magic. I'd like to add it to my class but don't no where > to begin.
It is a property. It returns the transpose of the array. If you had a .transpose() method on your class already, you could do (in Python 2.4+)
@property def T(self): return self.transpose()
That works very nicely. Thank you.
Message: 8 Date: Tue, 6 May 2008 14:40:14 -0500 From: "Robert Kern" robert\.kern@gmail\.com Subject: Re: [Numpy-discussion] numpy in RHEL4 To: "Discussion of Numerical Python" numpy\-discussion@scipy\.org Message-ID: 3d375d730805061240u764e201bq61cb9e49440490e7@mail\.gmail\.com Content-Type: text/plain; charset=UTF-8
On Tue, May 6, 2008 at 4:21 AM, Bala subramanian bala\.biophysics@gmail\.com wrote:
Dear Robert, Thank you. But i am trying to install it in a 32-bit machine only. In that case, why dose it require 64 bit libraries.
Well, judging from the paths on the command line, Python thinks it is on a 64-bit machine: build/temp.linux-x86_64-2.3/
How did you build Python? If you didn't build it, where did you get it from? You can check what kind of platform it thinks it is on with the following:
import platform platform.architecture() ('64bit', 'ELF') platform.processor() 'x86_64'
-- Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Message: 9 Date: Tue, 6 May 2008 15:13:02 -0500 From: "Robert Kern" robert\.kern@gmail\.com Subject: Re: [Numpy-discussion] cannot edit page on scipy-dev wiki To: "Discussion of Numerical Python" numpy\-discussion@scipy\.org Message-ID: 3d375d730805061313y135141afw9db450155dd7ad8b@mail\.gmail\.com Content-Type: text/plain; charset=UTF-8
On Tue, May 6, 2008 at 4:33 AM, Vincent Noel vincent\.noel@gmail\.com wrote:
Hello all,
I wanted to fix the formatting problems on the wiki page http://scipy.org/scipy/numpy/wiki/MaskedArrayApiChanges, so I followed the instructions on http://scipy.org/scipy/numpy/wiki (which state "In order to edit wiki pages or create and edit tickets, you need to register first.") But even after getting a registered login, I still can't edit the wiki pages. Do you need to request some extra authorization?
I have added the WIKI_CREATE and WIKI_MODIFY permissions to all authenticated users.
-- Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Message: 10 Date: Tue, 6 May 2008 15:09:57 -0600 From: "Charles R Harris" charlesr\.harris@gmail\.com Subject: Re: [Numpy-discussion] Status Report for NumPy 1.1.0 To: "Discussion of Numerical Python" numpy\-discussion@scipy\.org Message-ID: e06186140805061409o354dd983gdf35cab93b4a3a27@mail\.gmail\.com Content-Type: text/plain; charset="iso-8859-1"
On Tue, May 6, 2008 at 6:40 AM, Alan G Isaac aisaac@american\.edu wrote:
On Tue, 6 May 2008, Jarrod Millman apparently wrote:
open tickets that I would like everyone to take a brief look at: http://projects.scipy.org/scipy/numpy/ticket/760
My understanding is that my patch, which would give a deprecation warning, was rejected in favor of the patch specified at the end of Travis's message here: <URL: http://projects.scipy.org/pipermail/numpy-discussion/2008-April/033315.html
At least that's how I thought things were resolved. I expected Travis's patch would be part of the 1.1 release.
I think someone needs to step up and make the change, but first it needs to be blessed by Travis and some of the folks on the Matrix indexing thread. The change might also entail removing some workarounds in the spots indicated by Travis.
Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080506/3767b298/attachment.html
Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
End of Numpy-discussion Digest, Vol 20, Issue 20
From: James A. Bednar jbednar@inf\.ed\.ac\.uk Date: Tue, May 6, 2008 at 22:50 To: ceball@gmail.com Cc: topographica-core-developers@lists.sourceforge.net
| f4f93d420805061014n63af2404ued16f47c86e2b92e@mail\.gmail\.com | def nans1(shape, dtype=float): So, does this mean we should be re-thinking our idiom of using numpy to do in-place arithmetic by doing x*=0.0, and instead do x.fill(0.0)? We use this idiom a lot (see below), and .fill() is arguably clearer because it expresses our actual intention.
In some cases we could fill with values other than 0.0. E.g. for Sigmoid we could replace
def call(self,x): x_orig = copy.copy(x) x = 0.0 x += 1.0 / (1.0 + exp(-(self.rx_orig+self.k)))
with
def call(self,x): denom = 1.0 + exp(-(self.r*x+self.k)) x.fill(1.0) x /= denom
Seems clearer to me, and definitely useful if it's a bit faster...
Jim
$ grep -n -e '=[ ]0' topo//.py topo/base/cf.py:731: self.activity =0.0 topo/base/projection.py:443: self.activity = 0.0 topo/commands/basic.py:431: s.activity=0.0 topo/commands/basic.py:434: c.activity=0.0 topo/outputfns/basic.py:85: x = 0.0 topo/outputfns/basic.py:119: x = 0 topo/outputfns/basic.py:156: x = 0.0 topo/outputfns/basic.py:284: x = 0.0 topo/outputfns/basic.py:351: x = 0.0 topo/outputfns/basic.py:414: x = 0.0 topo/outputfns/basic.py:454: x = 0.0 topo/outputfns/basic.py:726: x = 0.0 topo/outputfns/basic.py:795: x = 0.0 topo/outputfns/basic.py:857: self.sf = 0.0 topo/projections/basic.py:237: self.sf =0.0 topo/projections/basic.py:238: self.lr_sf =0.0 topo/projections/basic.py:259: self.activity =0.0 topo/responsefns/projfns.py:40: activity = 0.0 topo/sheets/lissom.py:187: self.activity = 0.0 topo/sheets/lissom.py:189: proj.activity = 0.0 topo/sheets/lissom.py:332: self.sf =0.0 topo/sheets/lissom.py:333: self.lr_sf =0.0 topo/sheets/lissom.py:378: self.activity = 0.0 topo/sheets/saccade.py:343: radius = 0.5 topo/sheets/saccade.py:348: radius = 0.5 topo/sheets/slissom.py:91: self.activity = 0.0 topo/sheets/slissom.py:141: self.activity = 0.0 topo/sheets/slissom.py:143: proj.activity = 0.0
-- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
Converted from SourceForge issue 3003995, submitted by ceball Submit Date: 2010-05-19 10:26 GMT
https://mail.google.com/mail/#search/jbednar+numpy-discussion/119c0268d04d7504