Ejemplo n.º 1
0
    def interpolate(self, *vecs, **kwargs):
        """Interpolate the function at given points. The points are either
        provided as a large array with each row consisting of one point
        or as a tuple of vectors each defining one coordinate of the
        interpolation points. If `as_grid` is True, each combination of
        coordinates will be used (each point on the grid defined by the
        coordinates). Additional keyword args are passed to
        scipy.interpolate.interpn.
        TODO: write up properly"""

        as_grid = kwargs.get('as_grid', False)
        if as_grid:
            coo = Coord(*vecs)
            vecs = coo.asarr()

        method = kwargs.get('method', 'linear')
        bounds_error = kwargs.get('bounds_error', False)
        fill_value = kwargs.get('fill_value', 0.0)

        return interpn(self.coord.vecs, self.fvals, vecs, method=method,
                       bounds_error=bounds_error, fill_value=fill_value)