How to interpolate to equidistant axis in for-loop?

s_max = frequency value maximum
s_min = frequency value minimum

spec = 2D-Array: row represent propagation steps, columns represent Energie(frequency). This means for eachs step there is a spectrum.

number of steps = 100

x = np.linspace(3e8/s_max, 3e8/s_min, np.size(spec,1))
scale = 1 #x*x
n = 100
for i in range (0, n):
spec_neu= scipy.interpolate.interp1d(x, spec[i,:]*scale, 'linear')
print(spec_neu);

fig2 = plt.figure()
bx2 = fig2.add_subplot(122)

# draw the spectrum
bx2.imshow(spec_neu,aspect='auto',interpolation='bicubic',cmap='jet',vmin=spec_max-db_range,vmax=spec_max,origin='lower',extent=[3e8/s_max*1e9,3e8/s_min*1e9,0,fd.distance])

bx2.set_xlabel('frequency (THz)')
bx2.set_ylabel('distance (m)')

plt.show()


------------------------
But Error occurs:
TypeError: Image data of dtype object cannot be converted to float

Regards,

Karl

Please sign in to leave a comment.