# Path: opc/utils/gunroller.py
# class GunRoller(object):
# 
#     def __init__(self, subject):
#         self.shape = np.asarray(subject.shape)
#         self.subject = subject
# 
#     def unroll(self):
#         count = reduce(mul, self.shape, 1)
#         reshaped = self.subject.reshape((int(count/3), 3))
#         rotated = np.rot90(reshaped)
# 
#         return rotated
# 
#     def reroll(self, subject):
#         unrotated = np.rot90(subject, 3)
#         unshaped = unrotated.reshape(self.shape)
# 
#         return unshaped


from .gunroller import GunRoller
    """

    default = sample[base]
    total = None

    for distance in range(maxdist, -1, -1):
        samples = (
            _relative(sample, base, distance, default),
            _relative(sample, base, -distance, default)
            )

        if total is None:
            total = sum(samples)/2
        else:
            total = (total + sum(samples)/2)/2

    return total


def soften_1d(sample, maxdist):
    """
    perform inverse distance weighting of values in a one dimensional array
    """
    return [idw(sample, i, maxdist) for i in range(len(sample))]


def soften_2d(sample, maxdist):
    """
    perform inverse distance weighting of values in a two dimensional array
    """

# Path: opc/utils/gunroller.py
# class GunRoller(object):
# 
#     def __init__(self, subject):
#         self.shape = np.asarray(subject.shape)
#         self.subject = subject
# 
#     def unroll(self):
#         count = reduce(mul, self.shape, 1)
#         reshaped = self.subject.reshape((int(count/3), 3))
#         rotated = np.rot90(reshaped)
# 
#         return rotated
# 
#     def reroll(self, subject):
#         unrotated = np.rot90(subject, 3)
#         unshaped = unrotated.reshape(self.shape)
# 
#         return unshaped


# Path: opc/utils/idw.py
from .gunroller import GunRoller

    """

    default = sample[base]
    total = None

    for distance in range(maxdist, -1, -1):
        samples = (
            _relative(sample, base, distance, default),
            _relative(sample, base, -distance, default)
            )

        if total is None:
            total = sum(samples)/2
        else:
            total = (total + sum(samples)/2)/2

    return total


def soften_1d(sample, maxdist):
    """
    perform inverse distance weighting of values in a one dimensional array
    """
    return [idw(sample, i, maxdist) for i in range(len(sample))]


def soften_2d(sample, maxdist):
    """
    perform inverse distance weighting of values in a two dimensional array
    """

    gr = GunRoller(sample)