def refine(a, n): """Refine an array, make more points. """ import numpy as np size = len(a) xp = np.linspace(0, 1, size) fp = a x = np.linspace(0, 1, n * (size - 1) + 1) f = np.interp(x, xp, fp) return f