Example #1
0
    def __init__(self,
                 x,
                 y,
                 z,
                 w=None,
                 bbox=[None] * 4,
                 kx=3,
                 ky=3,
                 s=None,
                 eps=None):
        xb, xe, yb, ye = bbox
        nx, tx, ny, ty, c, fp, wrk1, ier = dfitpack.surfit_smth(x,
                                                                y,
                                                                z,
                                                                w,
                                                                xb,
                                                                xe,
                                                                yb,
                                                                ye,
                                                                kx,
                                                                ky,
                                                                s=s,
                                                                eps=eps,
                                                                lwrk2=1)
        if ier in [0, -1, -2]:  # normal return
            pass
        else:
            message = _surfit_messages.get(ier, 'ier=%s' % (ier))
            warnings.warn(message)

        self.fp = fp
        self.tck = tx[:nx], ty[:ny], c[:(nx - kx - 1) * (ny - ky - 1)]
        self.degrees = kx, ky
Example #2
0
    def __init__(self, x, y, z, w=None, bbox=[None] * 4, kx=3, ky=3, s=None, eps=None):
        """
        Input:
          x,y,z  - 1-d sequences of data points (order is not
                   important)
        Optional input:
          w          - positive 1-d sequence of weights
          bbox       - 4-sequence specifying the boundary of
                       the rectangular approximation domain.
                       By default, bbox=[min(x,tx),max(x,tx),
                                         min(y,ty),max(y,ty)]
          kx,ky=3,3  - degrees of the bivariate spline.
          s          - positive smoothing factor defined for
                       estimation condition:
                         sum((w[i]*(z[i]-s(x[i],y[i])))**2,axis=0) <= s
                       Default s=len(w) which should be a good value
                       if 1/w[i] is an estimate of the standard
                       deviation of z[i].
          eps        - a threshold for determining the effective rank
                       of an over-determined linear system of
                       equations. 0 < eps < 1, default is 1e-16.
        """
        xb, xe, yb, ye = bbox
        nx, tx, ny, ty, c, fp, wrk1, ier = dfitpack.surfit_smth(
            x, y, z, w, xb, xe, yb, ye, kx, ky, s=s, eps=eps, lwrk2=1
        )
        if ier in [0, -1, -2]:  # normal return
            pass
        else:
            message = _surfit_messages.get(ier, "ier=%s" % (ier))
            warnings.warn(message)

        self.fp = fp
        self.tck = tx[:nx], ty[:ny], c[: (nx - kx - 1) * (ny - ky - 1)]
        self.degrees = kx, ky
Example #3
0
    def __init__(self,
                 x,
                 y,
                 z,
                 w=None,
                 bbox=[None] * 4,
                 kx=3,
                 ky=3,
                 s=None,
                 eps=None):
        """
        Input:
          x,y,z  - 1-d sequences of data points (order is not
                   important)
        Optional input:
          w          - positive 1-d sequence of weights
          bbox       - 4-sequence specifying the boundary of
                       the rectangular approximation domain.
                       By default, bbox=[min(x,tx),max(x,tx),
                                         min(y,ty),max(y,ty)]
          kx,ky=3,3  - degrees of the bivariate spline.
          s          - positive smoothing factor defined for
                       estimation condition:
                         sum((w[i]*(z[i]-s(x[i],y[i])))**2,axis=0) <= s
                       Default s=len(w) which should be a good value
                       if 1/w[i] is an estimate of the standard
                       deviation of z[i].
          eps        - a threshold for determining the effective rank
                       of an over-determined linear system of
                       equations. 0 < eps < 1, default is 1e-16.
        """
        xb, xe, yb, ye = bbox
        nx, tx, ny, ty, c, fp, wrk1, ier = dfitpack.surfit_smth(x,
                                                                y,
                                                                z,
                                                                w,
                                                                xb,
                                                                xe,
                                                                yb,
                                                                ye,
                                                                kx,
                                                                ky,
                                                                s=s,
                                                                eps=eps,
                                                                lwrk2=1)
        if ier in [0, -1, -2]:  # normal return
            pass
        else:
            message = _surfit_messages.get(ier, 'ier=%s' % (ier))
            warnings.warn(message)

        self.fp = fp
        self.tck = tx[:nx], ty[:ny], c[:(nx - kx - 1) * (ny - ky - 1)]
        self.degrees = kx, ky
Example #4
0
    def __init__(self, x, y, z, w=None, bbox=[None] * 4, kx=3, ky=3, s=None, eps=None):
        xb, xe, yb, ye = bbox
        nx, tx, ny, ty, c, fp, wrk1, ier = dfitpack.surfit_smth(
            x, y, z, w, xb, xe, yb, ye, kx, ky, s=s, eps=eps, lwrk2=1
        )
        if ier in [0, -1, -2]:  # normal return
            pass
        else:
            message = _surfit_messages.get(ier, "ier=%s" % (ier))
            warnings.warn(message)

        self.fp = fp
        self.tck = tx[:nx], ty[:ny], c[: (nx - kx - 1) * (ny - ky - 1)]
        self.degrees = kx, ky