8 Apr
2011
8 Apr
'11
10:23 p.m.
Using np.loadtxt I can easily read my file that has columns of time, mode, 3 float64 for position and 3 for velocity like this. dt = dtype([('time', '|S12'), ('mode','|S3'),('rx','f8'),('ry','f8'),('rz','f8'),('vx','f8'),('vy','f8'),('vz','f8')]) data = np.loadtxt('file', dtype=dt) I can then put the two pairs of 3 components into np.arrays and start performing the vector operations I need. How can I read them directly into np.arrays? dt = dtype([('time', '|S12'), ('mode','|S3'),np.array('r'), np.array('v')]) I've seen examples for nested data that create a tuple but not an array. Any tips appreciated.