A Monday 01 June 2009 19:25:17 Robert Ferrell escrigué:
> I'm trying to write a table of numpy records, but failing.
>
> I have a numpy dtype
>
> dtp = np.dtype([('x',np.float64), ('y', np.float64)])
>
> I was hoping I could make columns with this:
>
> class DoesNotWork(tables.IsDescription):
>       XY = tables.Col.from_atom(tables.Atom.from_dtype(dtype=dtp))
>
> but PyTables doesn't like that.  The complaint is "compound data types
> are not supported: dtype([('x', '<f8'), ('y', '<f8')])".
>
> I can make a compound data type manually just fine:
>
> class ThisWorks(tables.IsDescription):
>       x = tables.Float64Col()
>       y = tables.Float64Col()
>
> Is it possible to make a table description directly from my dtype?  If
> not, is there some other way to create the description directly from
> the dtype?

Mmh, the `createTable()` constructor does accept a record array as input.  
Would that be enough for you?

HTH,

-- 
Francesc Alted

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to