mercredi 6 juillet 2016

python data structure with multidimensional numpy arrays


So I have some irregular, multi-dimensional data that I'd like to be able to index by the 'age' and 'Z' value.

For each 'age', and 'Z' I have an array of 100 wavelengths and assoc'd fluxes (ex data):

age    = np.array([10,20,30,40,50])
Z      = np.array([7,8])
waveln = np.array([np.array([a for a in arange(100)]) for b in arange(2*5)])
flux   = np.array([np.array([a*10 for a in arange(100)]) for b in arange(2*5)])

SO in this example, waveln[0] (an array of 100 entries) and flux[0] would get assoc'd with

myData['age' = 10, 'Z' = 7]['waveln'] # which I want to return the waveln array

and something like

myData['age' = 10, 'Z' = 7]['flux'] # which I want to return the flux array

how should I set this up?? The problem is, age and Z are both floats...

Thx,


Aucun commentaire:

Enregistrer un commentaire