Ejemplo n.º 1
0
    def calcDistanceFunction(self, order=2):
        """
        Calculates the `distanceVariable` as a distance function.

        :Parameters:
          - `order`: The order of accuracy for the distance funtion
            calculation, either 1 or 2.

        """

        dx, shape = self.getLSMshape()

        if LSM_SOLVER == 'lsmlib':
            from pylsmlib import distance
        elif LSM_SOLVER == 'skfmm':
            from skfmm import distance
        else:
            raise Exception, "Neither `lsmlib` nor `skfmm` can be found on the $PATH"

        self._value = distance(numerix.reshape(self._value, shape), dx=dx, order=order).flatten()
        self._markFresh()
Ejemplo n.º 2
0
    def calcDistanceFunction(self, order=2):
        """
        Calculates the `distanceVariable` as a distance function.

        Parameters
        ----------
        order : {`1`, `2`}
            The order of accuracy for the distance function calculation
        """

        dx, shape = self.getLSMshape()

        if LSM_SOLVER == 'lsmlib':
            from pylsmlib import distance
        elif LSM_SOLVER == 'skfmm':
            from skfmm import distance
        else:
            raise Exception("Neither `lsmlib` nor `skfmm` can be found on the $PATH")

        self._value = distance(numerix.reshape(self._value, shape), dx=dx, order=order).flatten()
        self._markFresh()