def __call__(self, u):
        s = len([uk for uk in self.knots if uk == u])
        for k, uk in enumerate(self.knots):
            if uk >= u:
                break
        if s == 0:
            k -= 1
        if self.degree == 0:
            if k == len(self.points):
                k -= 1
            return self.points[k]
        ps = [dict(zip(range(k - self.degree, k - s + 1),
                       self.points[k - self.degree:k - s + 1]))]

        for r in range(1, self.degree - s + 1):
            ps.append({})
            for i in range(k - self.degree + r, k - s + 1):
                a = (u - self.knots[i]) / (self.knots[i + self.degree - r + 1]
                                           - self.knots[i])
                ps[r][i] = (1 - a) * ps[r - 1][i - 1] + a * ps[r - 1][i]
        return ps[-1][k - s]
De Boor's Algorithm. Made out of more maths.
dataset/ETHPy150Open jerith/depixel/depixel/bspline.py/BSpline.__call__