def compress(nparray, newMax=1, newMin=0):
    """compress an numpy array, default is from range 0 to 1"""
    minimum = min(nparray)
    maximum = max(nparray)
    if(maximum - minimum) == 0:
        return nparray
    return (((nparray - minimum)/ ( max(nparray) - minimum)) * newMax + newMin)