|
From: dHering <vel...@gm...> - 2005-12-29 00:41:35
|
[Sorry for the mis-post]
Hi Travis,
I really hope that the future brings Scipy and Pytables together.
Thank you very much for your contributions and motivation Travis.
Dieter Hering
On 12/28/05, dHering <vel...@gm...> wrote:
> On 12/26/05, Travis Oliphant <oli...@ie...> wrote:
> >
> >
> > I'd like more people to know about the new power that is in scipy core
> > due to the general data-type descriptors that can now be used to define
> > numeric arrays. Towards that effort here is a simple example (be sure
> > to use latest SVN -- there were a coupld of minor changes that improve
> > usability made recently). Notice this example does not use a special
> > "record" array subclass. This is just a regular array. I'm kind of
> > intrigued (though not motivated to pursue) the possibility of accessing
> > (or defining) databases directly into scipy_core arrays using the recor=
d
> > functionality.
> >
> > # Define a new data-type descriptor
> > >>> import scipy
> >
> > >>> dtype =3D scipy.dtypedescr({'names': ['name', 'age', 'weight'],
> > 'formats': ['S30', 'i2', 'f4']})
> > >>> a =3D scipy.array([('Bill',31,260),('Fred',15,135)], dtype=3Ddtype=
)
> > # the argument to dtypedescr could have also been placed here as the
> > argument to dtype
> >
> > >>> print a['name']
> > [Bill Fred]
> >
> > >>> print a['age']
> > [31 15]
> >
> > >>> print a['weight']
> > [ 260. 135.]
> >
> > >>> print a[0]
> > ('Bill', 31, 260.0)
> >
> > >>> print a[1]
> > ('Fred', 15, 135.0)
> >
> > It seems to me there are some very interesting possibilities with this
> > new ability. The record array subclass adds an improved scalar type
> > (the record) and attribute access to get at the fields: (e.g. a.name,
> > a.age, and a.weight). But, if you don't need attribute access you ca=
n
> > use regular arrays to do a lot of what you might need a record array to
> > accomplish for you. I'd love to see what people come up with using thi=
s
> > new facility.
> >
> > The new array PEP for Python basically proposes adding a very simple
> > array object (just the basic PyArrayObject * of Numeric with a
> > bare-bones type-object table) plus this new data-type descriptor object
> > to Python and a very few builtin data-type descriptors (perhaps just
> > object initially). This would basically add the array interface to
> > Python directly and allow people to start using it generally. The PEP
> > is slow going because it is not on my priority list right now because i=
t
> > is not essential to making scipy_core work well. But, I would love to
> > have more people ruminating on the basic ideas which I think are
> > crystallizing.
> >
> > Best wishes for a new year,
> >
> > -Travis Oliphant
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log =
files
> > for problems? Stop! Download the new AJAX search engine that makes
> > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
> > _______________________________________________
> > Numpy-discussion mailing list
> > Num...@li...
> > https://lists.sourceforge.net/lists/listinfo/numpy-discussion
> >
>
|