Advertisement
Guest User

Untitled

a guest
Mar 11th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1.   def getBucketIndices(self, input):
  2.     """ See method description in base.py """
  3.  
  4.     if type(input) is float and math.isnan(input):
  5.       input = SENTINEL_VALUE_FOR_MISSING_DATA
  6.  
  7.     if input == SENTINEL_VALUE_FOR_MISSING_DATA:
  8.       return [None]
  9.  
  10.     minbin = self._getFirstOnBit(input)[0]
  11.  
  12.     # For periodic encoders, the bucket index is the index of the center bit
  13.     if self.periodic:
  14.       bucketIdx = minbin + self.halfwidth
  15.       if bucketIdx < 0:
  16.         bucketIdx += self.n
  17.  
  18.     # for non-periodic encoders, the bucket index is the index of the left bit
  19.     else:
  20.       bucketIdx = minbin
  21.  
  22. return [bucketIdx]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement