I have a numpy array of
dtype=[('offset', '<i8'), ('data', '<f8', (2000,))]
the offset terms can be in any order and terms can be repeated.
I would like to regularlise the data for visualisation so that each vector is visualised at its relative spatial location. This should involve:
- summing vectors with the same offset term and normalising
- interpolation of missing vectors from existing vectors
for the first part I've been doing
size = np.amax(gathers['offset'] - np.amin(gathers['offset']))
panel = np.zeros(size, dtype=np.float)
fold = np.zeros(size, dtype=np.float)
for trace in gathers:
panel[trace['offset']-np.amin(gathers['offset'])] += trace
fold[trace['offset']-np.amin(gathers['offset'])] += 1
for index, trace in enumerate(panel):
panel[index] /= fold[index]
plt.imshow(panel, aspect='auto')
plt.show()
which is slow.
for the second part i've been attempting to use scipy.griddata without success, as i cant figure out how to create the data coordinates for interpolation.