本文整理汇总了Python中nupic.vision.regions.ImageSensorExplorers.BaseExplorer.BaseExplorer.next方法的典型用法代码示例。如果您正苦于以下问题:Python BaseExplorer.next方法的具体用法?Python BaseExplorer.next怎么用?Python BaseExplorer.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nupic.vision.regions.ImageSensorExplorers.BaseExplorer.BaseExplorer
的用法示例。
在下文中一共展示了BaseExplorer.next方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: next
# 需要导入模块: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer import BaseExplorer [as 别名]
# 或者: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer.BaseExplorer import next [as 别名]
def next(self, seeking=False):
"""
Go to the next position (next iteration).
seeking -- Boolean that indicates whether the explorer is calling next()
from seek(). If True, the explorer should avoid unnecessary computation
that would not affect the seek command. The last call to next() from
seek() will be with seeking=False.
"""
BaseExplorer.next(self)
if self.pointIndex is None:
self.first()
self.pointIndex += 1
if self.pointIndex < len(self.currentPoints):
# Next fixation point for this image
self._setOffset()
else:
# Ran out of points for this image
image = self.position['image'] + 1
if image >= self.numImages:
self.first()
return
while not self.names[image] in self.points:
image += 1
if image >= self.numImages:
self.first()
return
self.position['image'] = image
self._firstPoint()
示例2: next
# 需要导入模块: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer import BaseExplorer [as 别名]
# 或者: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer.BaseExplorer import next [as 别名]
def next(self, seeking=False):
"""
Go to the next position (next iteration).
seeking -- Boolean that indicates whether the explorer is calling next()
from seek(). If True, the explorer should avoid unnecessary computation
that would not affect the seek command. The last call to next() from
seek() will be with seeking=False.
"""
BaseExplorer.next(self)
self._computeNextPosn()
示例3: next
# 需要导入模块: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer import BaseExplorer [as 别名]
# 或者: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer.BaseExplorer import next [as 别名]
def next(self, seeking=False):
"""
Go to the next position (next iteration).
seeking -- Boolean that indicates whether the explorer is calling next()
from seek(). If True, the explorer should avoid unnecessary computation
that would not affect the seek command. The last call to next() from
seek() will be with seeking=False.
"""
BaseExplorer.next(self)
if self._verbosity >= 1:
print "BlockSpread: next():"
# ========================================================================
# Update to next position
self._spreadPosIdx += 1
if self._spreadPosIdx == self._numSpreadOffsets:
self._spreadPosIdx = 0
self._centerPosIdx += 1
# If we've run through all the center positions, advance to the next
# filtered image
if self._centerPosIdx == self._numCenterOffsets:
self._centerPosIdx = 0
# --------------------------------------------------------------------
# Go to next filter for this image, or next image
# Iterate through the filters first
needNewImage = True
for i in xrange(self.numFilters):
self.position['filters'][i] += 1
if self.position['filters'][i] < self.numFilterOutputs[i]:
needNewImage = False
break
else:
self.position['filters'][i] = 0
# Go to the next image if ready
if needNewImage:
self.position['image'] += 1
if self.position['image'] == self.numImages:
self.position['image'] = 0
# -----------------------------------------------------------------
# Get the home position for this new filtered image
self._getHomePosition()
# ========================================================================
# Get the X,Y corrdinates and reset signal
if not seeking:
self._getPosition()
示例4: next
# 需要导入模块: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer import BaseExplorer [as 别名]
# 或者: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer.BaseExplorer import next [as 别名]
def next(self, seeking=False):
"""
Go to the next position (next iteration).
seeking -- Boolean that indicates whether the explorer is calling next()
from seek(). If True, the explorer should avoid unnecessary computation
that would not affect the seek command. The last call to next() from
seek() will be with seeking=False.
"""
BaseExplorer.next(self)
# If filters were changed, order may be invalid
if self.order is None or \
len([x for x in self.order if type(x) == int]) != self.numFilters:
# If user did not set a custom order, just create new one automatically
if not self.customOrder:
self.order = ["image"]
self.order.extend(range(self.numFilters))
self.order += ["sweep"]
# Otherwise, user needs to recreate the explorer with a new order
else:
raise RuntimeError("'order' is invalid. Must recreate explorer with "
"valid order after changing filters.")
if self.position['reset'] and self.blankWithReset:
# Last iteration was a blank, so don't increment the position
self.position['reset'] = False
else:
self.position['reset'] = False
for x in reversed(self.order):
if x == 'image': # Iterate the image
self.position['image'] += 1
if self.position['image'] == self.numImages:
self.position['image'] = 0
self.position['reset'] = True
else:
break
elif x == 'sweep': # Iterate the sweep position
nextImage = self._nextSweepPosition()
if not nextImage:
break
else: # Iterate the filter with index x
self.position['filters'][x] += 1
if self.position['filters'][x] == self.numFilterOutputs[x]:
self.position['filters'][x] = 0
self.position['reset'] = True
else:
break
if nextImage:
self._firstSweepPosition()
示例5: next
# 需要导入模块: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer import BaseExplorer [as 别名]
# 或者: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer.BaseExplorer import next [as 别名]
def next(self, seeking=False):
"""
Go to the next position (next iteration).
seeking -- Boolean that indicates whether the explorer is calling next()
from seek(). If True, the explorer should avoid unnecessary computation
that would not affect the seek command. The last call to next() from
seek() will be with seeking=False.
"""
BaseExplorer.next(self)
if self.position['reset'] and self.blankWithReset:
# Last iteration was a blank, so don't increment the position
self.position['reset'] = False
else:
self.position['reset'] = False
self._nextSweepPosition()
# Begin a new sweep if necessary
if self.position['reset']:
self.first()
示例6: next
# 需要导入模块: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer import BaseExplorer [as 别名]
# 或者: from nupic.vision.regions.ImageSensorExplorers.BaseExplorer.BaseExplorer import next [as 别名]
def next(self, seeking=False):
"""
Go to the next position (next iteration).
seeking -- Boolean that indicates whether the explorer is calling next()
from seek(). If True, the explorer should avoid unnecessary computation
that would not affect the seek command. The last call to next() from
seek() will be with seeking=False.
"""
BaseExplorer.next(self)
if self.position['reset'] and self.blankWithReset:
# Last iteration was a blank, so don't increment the position
self.position['reset'] = False
return
self.position['reset'] = False
prevPosition = self._copyPosition(self.position)
# Translation sweep
if self.dimension['name'] == 'translation':
self._nextTranslationPosition()
bounceDirections = self._getBounceDirections()
while self.position['reset'] and self.length < self.minSweepLength and \
bounceDirections:
# Sweep is too short - bounce and continue
self.position = self._copyPosition(prevPosition)
self.direction = bounceDirections.pop(0)
self._nextTranslationPosition()
# Image sweep
elif self.dimension['name'] == 'image':
self._nextImagePosition()
if self.position['reset'] and self.length < self.minSweepLength:
# Sweep is too short - bounce and continue
self.position = prevPosition
if self.direction == 'up':
self.direction = 'down'
else:
self.direction = 'up'
self._nextImagePosition()
# Parsed dimension sweep
elif self.dimension['name'] in self.parsedDimensions:
self._nextParsedPosition()
if self.position['reset'] and self.length < self.minSweepLength:
# Sweep is too short - bounce and continue
self.position = prevPosition
if self.direction == 'up':
self.direction = 'down'
else:
self.direction = 'up'
self._nextParsedPosition()
# Filter sweep
else:
self._nextFilterPosition()
if self.position['reset'] and self.length < self.minSweepLength:
# Sweep is too short - bounce and continue
self.position = prevPosition
if self.direction == 'up':
self.direction = 'down'
else:
self.direction = 'up'
self._nextFilterPosition()
# Stop the sweep if it has fallen off the object
if not self.position['reset'] \
and self.isBlank(self.dimension['sweepOffObject']):
self.position['reset'] = True
# Begin a new sweep if necessary
if self.position['reset']:
self.first()
else:
self.length += 1