コード例 #1
0
ファイル: CrossSweep.py プロジェクト: AndreCAndersen/nupic
  def __init__(self, radius=1, stepsize=1, minradius=None, *args, **kwargs):
    """
    radius - the distance from the center to the outer x's
    stepsize - the distance between the x's
    minradius - distance from the center to the first x

    If the stepsize is greater than 1, then each 'x' in the diagrams above will be
    separated by 'stepsize' pixels. The 'radius' must always be a multiple of 'stepsize'

    By default, the inner circle starts at a radius of stepsize. If minradius is set,
    it defines the smallest circle radius. 'minradius' must also be a multiple of 'stepsize'

    If includeCenter is True, the center location will be included. By default it is not.
    """

    assert(radius >= 1)
    SpiralSweep.__init__(self, radius=radius, stepsize=stepsize, minradius=minradius,
                          *args, **kwargs)

    # Generate a list of possible offsets for this stepsize and radius
    self.offsets = []

    # First, generate the horizontal sweep
    for i in range(-radius, radius+1, stepsize):
      self.offsets += [(-i, 0)]

    # Now, the vertical sweep
    for i in range(-radius, radius+1, stepsize):
      self.offsets += [(0, -i)]
コード例 #2
0
ファイル: ToCenterSweep.py プロジェクト: willwilliams/nupic
    def __init__(self, length=1, stepsize=1, *args, **kwargs):
        """
    length - the distance from the center to the outer x
    stepsize - the distance between the x's
    minradius - distance from the center to the first x

    If the stepsize is greater than 1, then each 'x' in the diagrams above will be
    separated by 'stepsize' pixels. The 'length' must always be a multiple of
    'stepsize'

    """

        assert (length >= 1)
        SpiralSweep.__init__(self,
                             radius=length,
                             stepsize=stepsize,
                             minradius=None,
                             *args,
                             **kwargs)

        # Generate a list of possible offsets for this stepsize and length
        self.offsets = []

        # Generate the horizontal sweep
        for i in range(-length + 1, 1, stepsize):
            self.offsets += [(i, 0)]
コード例 #3
0
ファイル: CrossSweep.py プロジェクト: ldd2816/nupic
    def __init__(self, radius=1, stepsize=1, minradius=None, *args, **kwargs):
        """
    radius - the distance from the center to the outer x's
    stepsize - the distance between the x's
    minradius - distance from the center to the first x

    If the stepsize is greater than 1, then each 'x' in the diagrams above will be
    separated by 'stepsize' pixels. The 'radius' must always be a multiple of 'stepsize'

    By default, the inner circle starts at a radius of stepsize. If minradius is set,
    it defines the smallest circle radius. 'minradius' must also be a multiple of 'stepsize'

    If includeCenter is True, the center location will be included. By default it is not.
    """

        assert (radius >= 1)
        SpiralSweep.__init__(self,
                             radius=radius,
                             stepsize=stepsize,
                             minradius=minradius,
                             *args,
                             **kwargs)

        # Generate a list of possible offsets for this stepsize and radius
        self.offsets = []

        # First, generate the horizontal sweep
        for i in range(-radius, radius + 1, stepsize):
            self.offsets += [(-i, 0)]

        # Now, the vertical sweep
        for i in range(-radius, radius + 1, stepsize):
            self.offsets += [(0, -i)]
コード例 #4
0
  def __init__(self, radius=1, *args, **kwargs):
    """
    radius - the radius of the Patrol sweep
    """

    assert(radius >= 1)
    SpiralSweep.__init__(self, radius, *args, **kwargs)
    r = radius
    self.offsets = [(r, 0),  (r, r),   (0, r),  (-r, r),
                    (-r, 0), (-r, -r), (0, -r), (r, -r)]
    self.index = 0
コード例 #5
0
    def __init__(self, shift=1, radius=1, *args, **kwargs):
        """
    @param shift -- Number of pixels to shift each time.
    @param radius -- maximum amount to move away from center. Must be a multiple
                      of 'shift'

    """
        assert (radius >= 1)
        SpiralSweep.__init__(self, radius, *args, **kwargs)

        if (radius % shift) != 0:
            raise RuntimeError("radius must be a multiple of shift")

        # Generate the location offsets that we will move to for each image
        self.offsets = self._generateOffsets(shift, radius)
        self.index = 0
コード例 #6
0
ファイル: Jiggle.py プロジェクト: akhilaananthram/nupic
  def __init__(self, shift=1, radius=1, *args, **kwargs):
    """
    @param shift -- Number of pixels to shift each time.
    @param radius -- maximum amount to move away from center. Must be a multiple
                      of 'shift'

    """
    assert(radius >= 1)
    SpiralSweep.__init__(self, radius, *args, **kwargs)

    if (radius % shift) != 0:
      raise RuntimeError("radius must be a multiple of shift")

    # Generate the location offsets that we will move to for each image
    self.offsets = self._generateOffsets(shift, radius)
    self.index = 0
コード例 #7
0
ファイル: ToCenterSweep.py プロジェクト: AndreCAndersen/nupic
  def __init__(self, length=1, stepsize=1, *args, **kwargs):
    """
    length - the distance from the center to the outer x
    stepsize - the distance between the x's
    minradius - distance from the center to the first x

    If the stepsize is greater than 1, then each 'x' in the diagrams above will be
    separated by 'stepsize' pixels. The 'length' must always be a multiple of
    'stepsize'

    """

    assert(length >= 1)
    SpiralSweep.__init__(self, radius=length, stepsize=stepsize, minradius=None,
                          *args, **kwargs)

    # Generate a list of possible offsets for this stepsize and length
    self.offsets = []

    # Generate the horizontal sweep
    for i in range(-length+1, 1, stepsize):
      self.offsets += [(i, 0)]