From: Francesc A. <fa...@ca...> - 2005-04-25 07:37:34
|
Hello Dragan, On Sunday 24 April 2005 17:59, dragan savic wrote: > A table is typically the result of a simulation run. > When more runs are done, each run has normally > different values for one of parameters. In my case I > have for example three parameters: switch size, buffer > size and load. I would like to have tables as elements > of an N dimensional array, where each parameter > represents a different dimension, and the number of > possible values of that parameter is the size of the > array along that dimension. Each dimension should > have a scalar or a string type. > Is this possible to achieve with Pytables? Well, if I have not misunderstood you, yes, I think you can achieve this goal using PyTables. Just declare the next description dictionary: tsim={'switch_size': UInt16Col(shape=max_size_switch), 'buffer_size': UInt32Col(shape=max_buffer_switch), 'load': UInt8Col(shape=max_size_load), } Then, create the table with compression enabled: table = fileh.createTable(group, 'table', tsim, "A table", Filters(1)) Please, take in account that, as you use compression (see the Filters(1) parameter), you don't waste too much space by booking columns with maximum possible sizes. If you want true variable length records, even with compression support (but not able to deal with heterogeneous data), you can use a combination of three VLArray objects (one per each parameter). See http://pytables.sourceforge.net/html/tut/vlarray2.html for an example of use. HTH, Francesc Altet |