Re: [Numpy-discussion] apply 'getitem to each element of obj array?

2012-04-05 Thread Ken Watford
On Thu, Apr 5, 2012 at 11:57 AM, Olivier Delalleau wrote: > Le 5 avril 2012 11:45, Neal Becker a écrit : > > You can do: > > f = numpy.frompyfunc(lambda x: x.some_attribute == 0, 1, 1) > > Then > f(array_of_objects_x) This is handy too: agetattr = numpy.frompyfunc(getattr, 2, 1) array_of_value

Re: [Numpy-discussion] [OT: MATLAB] Any way to globally make Matlab struct attributes Python-property-like

2010-09-14 Thread Ken Watford
On Mon, Sep 13, 2010 at 10:24 PM, David Goldsmith wrote: > I.e., I'd, at minimum, like to globally replace > > get(Handel, 'Property') > > with > > object.Property > > and > > set(Handel, 'Property', value) > > with > > object.Property = value > > to an arbitrary level of composition. Both struct

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Ken Watford
On Fri, Aug 27, 2010 at 4:17 PM, Robert Kern wrote: > On Fri, Aug 27, 2010 at 15:10, Ken Watford wrote: >> On Fri, Aug 27, 2010 at 3:58 PM, Brett Olsen wrote: >>> Hello, >>> >>> I have an array of non-numeric data, and I want to create a boolean >>>

Re: [Numpy-discussion] Boolean arrays

2010-08-27 Thread Ken Watford
On Fri, Aug 27, 2010 at 3:58 PM, Brett Olsen wrote: > Hello, > > I have an array of non-numeric data, and I want to create a boolean > array denoting whether each element in this array is a "valid" value > or not.  This is straightforward if there's only one possible valid > value: import num

Re: [Numpy-discussion] Making MATLAB and Python "play nice"

2010-08-21 Thread Ken Watford
On Fri, Aug 20, 2010 at 3:25 PM, David Goldsmith wrote: > Hi!  Please forgive the re-post: I forgot to change the subject line > and I haven't seen a response to this yet, so I'm assuming the former > might be the cause of the latter.  My question follows the quoted > posts.  Thanks! > > *snip* >

Re: [Numpy-discussion] floating point arithmetic issue

2010-07-30 Thread Ken Watford
2010/7/30 Guillaume Chérel : >  Hello, > > I ran into a difficulty with floating point arithmetic in python. Namely > that: > >  >>> 0.001 + 1 - 1 > 0.00088987 > > And, as a consequence, in python: > >  >>> 0.001 + 1 - 1 == 0.001 > False > > In more details, my problem is that I have a

Re: [Numpy-discussion] Is there anyway to read raw binary file via pytable?

2010-07-28 Thread Ken Watford
2010/7/28 脑关生命科学仪器 : > it seems like pytable only support HDF5. I had some 500GB numerical arrays > to process. Pytable claims to have some advance feature to enhance > processing speed and largely reduce physical memory requirement. However, I > do not wanna touch the raw data I had. Simply becaus

Re: [Numpy-discussion] OT: request help building pymex win64

2010-07-02 Thread Ken Watford
That's an excellent point. I've noticed on my (Linux) workstation that pymex works fine, but PyCUDA fails to import properly, because PyCUDA is a Boost::Python project and expects a different libstdc++ than the one that MATLAB jams into its LD_LIBRARY_PATH. (I got around this using an evil LD_PRELO