Last active
February 23, 2020 20:40
-
-
Save ktatar/2573bede64fb6c53da205cd67474da72 to your computer and use it in GitHub Desktop.
[Stretch a 1d numpy array] #python #numpy #signalprocessing #scipy #interpolate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy import interpolate | |
#Create target array. We are trying to match the size of this array | |
my_cqt = np.linspace(2.0,3.0, num=20) | |
#The array to be stretched | |
my_alfa = np.linspace(0., 1., num=10) | |
f = interpolate.interp1d(np.arange(0, len(my_alfa)), my_alfa) | |
my_stretched_alfa = f(np.linspace(0.0, len(my_alfa)-1, len(my_cqt))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment