--- On Tue, 7/21/09, Christopher Barker wrote:
> but now when I try to split it up:
>
> In [38]: a = a.view(dtype='S13')
>
> I get:
>
> ValueError: new type not compatible with array.
>
> Shouldn't that work?
>
> -Chris
Submit an enhancement ticket. ;-)
DG
___
David Goldsmith wrote:
> Hi, Chris. Look at this, _I'm_ answering one of _your_ questions
> (correctly, I hope):
maybe ;-)
> --- On Tue, 7/21/09, Christopher Barker
> wrote:
>> I don't see why:
>>
>> np.array('a string', dtype='S1')
>>
>> results in a length (1,) array, for instance.
> Well,
On Tue, Jul 21, 2009 at 2:41 PM, Matthew Brett wrote:
> 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 c
On Jul 21, 2009, at 2:23 PM, Darren Dale wrote:
>
>> Without access to your code, I'm likely to speak beyond myself here
>> (could you send me a link to the latest version ?), but if you need
>> to
>> rescale the units, make sure it's done in __array_finalize__ as well,
>> with something like
>>
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
>> th
Hi Matthew,
On Tue, Jul 21, 2009 at 1:37 PM, Matthew Brett wrote:
> 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, c
On Tue, Jul 21, 2009 at 1:26 PM, Pierre GM wrote:
>
> On Jul 21, 2009, at 10:58 AM, Darren Dale wrote:
>
>> http://docs.scipy.org/doc/numpy/user/basics.subclassing.html#simple-example-adding-an-extra-attribute-to-ndarray
>> includes an example where an instance attribute is set in __new__ .
>> Howe
On Tue, Jul 21, 2009 at 09:11, Darren Dale wrote:
> (off topic: it would be nice if numpy had a mechanism in place for
> merge requests and code reviews. I've been following bzr-dev for a
> while now and their development model is pretty impressive.)
You can use Rietveld. numpy is already a regist
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
> Exampl
On Jul 21, 2009, at 10:58 AM, Darren Dale wrote:
> http://docs.scipy.org/doc/numpy/user/basics.subclassing.html#simple-example-adding-an-extra-attribute-to-ndarray
> includes an example where an instance attribute is set in __new__ .
> However, there is a warning at http://www.scipy.org/Subclasse
Hi, Chris. Look at this, _I'm_ answering one of _your_ questions (correctly, I
hope):
--- On Tue, 7/21/09, Christopher Barker wrote:
> I don't see why:
>
> np.array('a string', dtype='S1')
>
> results in a length (1,) array, for instance.
>
> Actually, I think I do -- numpy is treating the
Pierre GM wrote:
> On Jul 20, 2009, at 3:44 PM, Christopher Barker wrote:
>> ...
>> Is there a cleaner way to do this?
> Yes. np.lib._iotools.LineSplitter and/or np.genfromtxt
Great, thanks -- though the underscore in _iotools implies that this
isn't supposed to be general purpose tools.
Also,
http://docs.scipy.org/doc/numpy/user/basics.subclassing.html#simple-example-adding-an-extra-attribute-to-ndarray
includes an example where an instance attribute is set in __new__ .
However, there is a warning at http://www.scipy.org/Subclasses:
-
Some words of caution
The definition in the __
On Tue, Jul 21, 2009 at 7:44 AM, Darren Dale wrote:
> 2009/7/20 Stéfan van der Walt :
>> Hi Chuck
>>
>> 2009/7/17 Charles R Harris :
>>> PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos)
>>> Return value: Borrowed reference.
>>> Return the object at position pos in the tuple pointed to by p. I
2009/7/20 Stéfan van der Walt :
> Hi Chuck
>
> 2009/7/17 Charles R Harris :
>> PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos)
>> Return value: Borrowed reference.
>> Return the object at position pos in the tuple pointed to by p. If pos is
>> out of bounds, return NULL and sets an IndexErro
On Jul 21, 2009, at 3:16 AM, Nils Wagner wrote:
>>
>> Er, there's already something like that:
>> np.lib._iotools.LineSplitter
>
> Great. I didn't know about that.
>
> Your examples are very useful.
>
> IMHO the examples should be added to
>
> http://www.scipy.org/Cookbook/InputOutput
>
> to attra
On Tue, 21 Jul 2009 02:56:28 -0400
Pierre GM wrote:
>
> On Jul 21, 2009, at 2:42 AM, Nils Wagner wrote:
>>
>> Fixed-length fields are quite common e.g. in the area of
>> Finite Element pre/postprocessing.
>> Therefore It would be nice to have a function like
>> line2array in numpy.
>> Comments
17 matches
Mail list logo