From: Francesc A. <fa...@ca...> - 2005-07-18 12:43:27
|
El dl 18 de 07 del 2005 a les 08:07 -0400, en/na travlr va escriure: > Actually I'm aware of the "under the hood indexing", but frankly I > don't use it because it shows nice improvement for some search result > sizes, and is quite latent on others. Yes, that's perfectly possible. This kind of indexing use is mainly aimed for large tables while with small ones (< 10**6 entries) your mileage may vary. > What I'm referring to though, with slice indexing, is being able to > use an array for the index, as numarray does. > file.table.cols.blah[array] where the array can be non-sequential, as > is produced by array=numarray.where(x>y)[0]. Ooops, I see. Well, this is in fact already implemented through the use of Table.readCoordinates() method: file.table.readCoordinates(array, field="blah") However, your suggestion is quite good, and implementing it is a matter of adding a new case in the Column.__getitem__() special method. Something like: [...] elif isinstance(key, numarray): return self.table.readCoordinates(key, self.name) would be enough. > This type of behavior if possible would be less cumbersome than > iterating, and less memory intensive when brought in and bounded to an > actual numarray Type in order to facilitate this behavior. Definitely. I'll try to add such a feature for next release. Cheers, Francesc |