def interpolate_shape(shape,numDesiredPoints):
    numPointsInShape = len(shape)/2
    #make xyxy format
    x_shape = shape[0::2]
    y_shape = shape[1::2]

    t_current = numpy.linspace(0, 1, numPointsInShape)
    t_desired = numpy.linspace(0, 1, numDesiredPoints)

    f = interpolate.interp1d(t_current, x_shape, kind='cubic')
    x_shape = f(t_desired)

    f = interpolate.interp1d(t_current, y_shape, kind='cubic')
    y_shape = f(t_desired)

    shape = []
    shape[0:numDesiredPoints] = x_shape
    shape[numDesiredPoints:] = y_shape

    return shape
Interpolate the shape to reach a predefined number of points, and
dataset/ETHPy150Open chili-epfl/shape_learning/tools/dataset-preprocessing/preprocessDataset.py/interpolate_shape