# Path: opc/hue.py
# @mwt(timeout=20)
# @timefunc
# def hsvToRgb(h, s=1.0, v=1.0, rainbow=True):
#     """
#     Convert a (h, s, v) value to the (r, g, b) color space. By default,
#     we use a more cpu-intense method to curve the hue ramps above the
#     typical linear, with a view to evening out the visible range of yellow,
#     cyan, and purple.
# 
#     This method takes h, s, and v values in range 0..1 and returns r, g,
#     and b values in range 0..255.
#     """
#     if rainbow:
#         return [sin(c*pi/2)*255 for c in colorsys.hsv_to_rgb(h, s, v)]
# 
#     return [c*255 for c in colorsys.hsv_to_rgb(h, s, v)]
# 
# Path: opc/nphue.py
# @timefunc
# def h_to_rgb(h, sat=1, val=255.0):
#     # Local variation of hsv_to_rgb that only cares about a variable
#     # hue, with (s,v) assumed to be constant
#     # h should be a numpy array with values between 0.0 and 1.0
#     # hsv_to_rgb returns an array of uints between 0 and 255.
#     s = np.full_like(h, sat)
#     v = np.full_like(h, val)
#     hsv = np.dstack((h, s, v))
# 
#     return hsv_to_rgb(hsv)
# 
# Path: opc/utils/prof.py
# def timefunc(f, reference=False):
#     global records
# 
#     records[f.__name__] = Record(f.__name__, reference)
# 
#     @wraps(f)
#     def f_timer(*args, **kwargs):
#         global active
# 
#         if not active:
#             return f(*args, **kwargs)
# 
#         start = time.time()
#         result = f(*args, **kwargs)
#         end = time.time()
# 
#         records[f.__name__].addTime(end-start)
# 
#         return result
# 
#     return f_timer


from opc.hue import hsvToRgb
from opc.nphue import h_to_rgb
from random import random
    from exceptions import AttributeError
from art.utils.array import array
from opc.utils.prof import timefunc
import numpy as np
import sys
        stepsize = int(stepsize)
        halfstep = int(stepsize/2)

        for y in range(0, self.height+halfstep, stepsize):
            for x in range(0, self.width+halfstep, stepsize):
                self._sampleSquare(halfstep+x, halfstep+y,
                                   stepsize, self._rand() * scale)

        for y in range(0, self.height, stepsize):
            for x in range(0, self.width, stepsize):
                self._sampleDiamond(x + halfstep, y, stepsize,
                                    self._rand() * scale)
                self._sampleDiamond(x, y + halfstep, stepsize,
                                    self._rand() * scale)

    def generate(self):
        samplesize = self.featureSize
        scale = 1.0

        # seed initial values
        for y in range(0, self.height, samplesize):
            for x in range(0, self.width, samplesize):
                self._setSample(x, y, self._rand())

        # iterate through the intermediate spaces
        while samplesize > 1:
            self._diamondSquare(samplesize, scale)
            samplesize /= 2
            scale /= 2.0


# Path: opc/hue.py
# @mwt(timeout=20)
# @timefunc
# def hsvToRgb(h, s=1.0, v=1.0, rainbow=True):
#     """
#     Convert a (h, s, v) value to the (r, g, b) color space. By default,
#     we use a more cpu-intense method to curve the hue ramps above the
#     typical linear, with a view to evening out the visible range of yellow,
#     cyan, and purple.
# 
#     This method takes h, s, and v values in range 0..1 and returns r, g,
#     and b values in range 0..255.
#     """
#     if rainbow:
#         return [sin(c*pi/2)*255 for c in colorsys.hsv_to_rgb(h, s, v)]
# 
#     return [c*255 for c in colorsys.hsv_to_rgb(h, s, v)]
# 
# Path: opc/nphue.py
# @timefunc
# def h_to_rgb(h, sat=1, val=255.0):
#     # Local variation of hsv_to_rgb that only cares about a variable
#     # hue, with (s,v) assumed to be constant
#     # h should be a numpy array with values between 0.0 and 1.0
#     # hsv_to_rgb returns an array of uints between 0 and 255.
#     s = np.full_like(h, sat)
#     v = np.full_like(h, val)
#     hsv = np.dstack((h, s, v))
# 
#     return hsv_to_rgb(hsv)
# 
# Path: opc/utils/prof.py
# def timefunc(f, reference=False):
#     global records
# 
#     records[f.__name__] = Record(f.__name__, reference)
# 
#     @wraps(f)
#     def f_timer(*args, **kwargs):
#         global active
# 
#         if not active:
#             return f(*args, **kwargs)
# 
#         start = time.time()
#         result = f(*args, **kwargs)
#         end = time.time()
# 
#         records[f.__name__].addTime(end-start)
# 
#         return result
# 
#     return f_timer


# Path: art/utils/diamondsquare.py
from opc.hue import hsvToRgb
from opc.nphue import h_to_rgb
from random import random
    from exceptions import AttributeError
from art.utils.array import array
from opc.utils.prof import timefunc
import numpy as np
import sys

        stepsize = int(stepsize)
        halfstep = int(stepsize/2)

        for y in range(0, self.height+halfstep, stepsize):
            for x in range(0, self.width+halfstep, stepsize):
                self._sampleSquare(halfstep+x, halfstep+y,
                                   stepsize, self._rand() * scale)

        for y in range(0, self.height, stepsize):
            for x in range(0, self.width, stepsize):
                self._sampleDiamond(x + halfstep, y, stepsize,
                                    self._rand() * scale)
                self._sampleDiamond(x, y + halfstep, stepsize,
                                    self._rand() * scale)

    def generate(self):
        samplesize = self.featureSize
        scale = 1.0

        # seed initial values
        for y in range(0, self.height, samplesize):
            for x in range(0, self.width, samplesize):
                self._setSample(x, y, self._rand())

        # iterate through the intermediate spaces
        while samplesize > 1:
            self._diamondSquare(samplesize, scale)
            samplesize /= 2
            scale /= 2.0


    @timefunc