A Dimarts 22 Agost 2006 08:10, Jan Strube va escriure:
> Oh, and yet another question:
> In my structure, I have scalar and vectorial quantities. How can I
> determine which is which on an unfilled table ?
> I am trying row.getTable().col(column_name).ndim, but that seems only to

Please, don't use row.getTable() (it is not documented and, in fact, it is 
going to disappear in forthcoming PyTables 1.4 series). Instead, bind the 
table to a name (say, 'table') and use the more effective :

table.col(column_name)

as this saves quite a few name lookups.

> work on filled tables. In my case it simply returns 1 for all columns.
>
> Is there a way to determine the dimension of the row I am currently
> filling ?

This is because attribute .ndim of NumPy returns the *number* of dimensions of 
the object, and not the shape that it is what you want. Please note that, 
despite the fact that there is a number of different definitions for 
the "number of dimensions", in pythonic numerical packages this is always 
defined as len(shape).

The best way of getting the shape for columns without doing an actual read of 
the data is accessing directly to the metadata of the Table object:

print table.description.baryon2.decayVector.shape

or

print table.colshapes['baryon2/decayVector']

Check the different attributes of Table in the manual (section 4.6.1) 
as well as the Description class (section 4.8) for more accessible metadata 
info.

HTH,

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to