From: <phi...@ho...> - 2005-06-16 12:17:55
|
Hi list, I want to select data from an hdf5 file using pytables. for retrieving all the data from an Array (or a Table) object, i read the data and save it into a numarray.array using the read() function: my_numarray_array = my_object.read(). for example: readout = h.root.detector.readout b=readout.read() print b That's really nice to use and i can easilly treat data after that. My question is about selecting only a part of data: Can i create directly a numarray.array object using a python list comprehension on an Array or a Table? For the moment using list comprehension, i only get a list. for example: >>> pressure = h.root.columns.pressure >>> a=[p for p in pressure] >>> print a [25.0, 36.0, 49.0] >>> a=[p for p in pressure if p <36] >>> print a [25.0] >>> type(a) <type 'list'> I want to get a numarray.array. 1. Can i cast the list into a numarray.array? 2. Can i copy all the data from the list to a numarray.array once? 3. Must i instrospect the list using the for elt in list: and add each data in a numarray? Thanks a lot for your help, Philippe |