%pylab inline from scipy.special import eval_chebyt res = 1024 x_space = linspace(-1,1,res) plot(x_space, eval_chebyt(2, x_space)) t2 = eval_chebyt(2, x_space) source = cos(2* pi * ((x_space + 1)/2)) plot(source) index = floor((res - 1) * (source + 1)/ 2).astype(int) index.dtype plot(index) waveshaped = t2[index] plot(waveshaped) stem(abs(rfft(waveshaped))) xlim(0, 10) depth = 0.5 index = floor(depth * (res - 1) * (source + 1)/ 2).astype(int) waveshaped = t2[index] plot(waveshaped) stem(abs(rfft(waveshaped))) xlim(0, 10) t5 = eval_chebyt(5, x_space) waveshaped = t5[index] plot(waveshaped) stem(abs(rfft(waveshaped))) xlim(0, 10) t15 = eval_chebyt(15, x_space) waveshaped = t15[index] subplot(121) plot(waveshaped) subplot(122) stem(abs(rfft(waveshaped))) xlim(0, 50) res = 102400 x_space = linspace(-1,1,res) source = cos(2* pi * 1000 * ((x_space + 1)/2)) depth = linspace(0, 1, res) index = floor(depth * (res - 1) * (source + 1)/ 2).astype(int) t15 = eval_chebyt(15, x_space) waveshaped = t15[index] specgram(waveshaped, NFFT=1024); ylim(0, 0.5) t50 = eval_chebyt(50, x_space) waveshaped = t50[index] specgram(waveshaped, NFFT=1024); ylim(0, 1) plot(t50) t49 = eval_chebyt(49, x_space) waveshaped = t49[index] specgram(waveshaped, NFFT=1024); ylim(0, 1) plot(t49) shaper1 = eval_chebyt(10, x_space) shaper2 = tanh(x_space * 6) plot(shaper1) plot(shaper2) waveshaped1 = shaper1[index] waveshaped2 = shaper2[index] plot((waveshaped1 + waveshaped2)/2) specgram((waveshaped1 + waveshaped2)/2, NFFT=2048); newshaper = (shaper1 + shaper2)/2 waveshaped = newshaper[index] plot(waveshaped) specgram((waveshaped1 + waveshaped2)/2, NFFT=2048); waveshaped1 = shaper1[index /2] waveshaped2 = shaper2[index /2] Pxx, freqs, bins, im = specgram((waveshaped1 + waveshaped2)/2, NFFT=2048); plot(Pxx[:,50])