Numpy record array - field names for all dimensions
shangach at gmail.com
Wed Dec 3 21:15:11 CET 2008
I am seeking to represent datasets where each data element is the
calculated result from several (4 for now) other data types. A matrix-
like (in the general mathematical sense) seems logical, where the
intersection of each of the 4 values (from different data sets) holds
the value derived from those 4 values here serving as indexes.
So, each matrix/array element is associated with 4 fields.
matrix element/output value = 24.235 -->
'Formula' = 'C12H24O2N2'
'Solvent' = 'Acetonitrile'
'fragmentation_method' = 'CID'
'resolution' = 'unit'
ideally I would like to call the output value by indexing the matrix
with the input information. eg:
matrix['C12H24O2N2']['Acetonitrile']['CID']['unit'] = 24.235
Numpy's record arrays seemingly don't allow all dimensions to carry
field names. ie. each column/row carrying a label. Instead fieldname
usage appears to create a "new dimension" as denoted by square
pixel_matrix = array([[(1,2,3), (4,5,6)], [(7,8,9), (10,11,12)]],
Can anyone tell me if the sort of data structuring I seek can be done
with Numpy record arrays or, if not, can you recommend a more suitable
Great & Glowing Thanks!
More information about the Python-list