本文整理匯總了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