當前位置: 首頁>>代碼示例>>Python>>正文


Python geospatial_coordinate.GeospatialCoordinateEncoder類代碼示例

本文整理匯總了Python中nupic.encoders.geospatial_coordinate.GeospatialCoordinateEncoder的典型用法代碼示例。如果您正苦於以下問題:Python GeospatialCoordinateEncoder類的具體用法?Python GeospatialCoordinateEncoder怎麽用?Python GeospatialCoordinateEncoder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了GeospatialCoordinateEncoder類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testRadiusForSpeed

 def testRadiusForSpeed(self):
   scale = 30  # meters
   timestep = 60  #seconds
   speed = 50  # meters per second
   encoder = GeospatialCoordinateEncoder(scale, timestep)
   radius = encoder.radiusForSpeed(speed)
   self.assertEqual(radius, 75)
開發者ID:AI-Cdrone,項目名稱:nupic,代碼行數:7,代碼來源:geospatial_coordinate_test.py

示例2: testCoordinateForPosition3D

 def testCoordinateForPosition3D(self):
   scale = 30 # meters
   encoder = GeospatialCoordinateEncoder(scale, 60)
   coordinate = encoder.coordinateForPosition(
     -122.229194, 37.486782, 1500
   )
   self.assertEqual(coordinate.tolist(), [-90102, -142918, 128710])
開發者ID:AI-Cdrone,項目名稱:nupic,代碼行數:7,代碼來源:geospatial_coordinate_test.py

示例3: testCoordinateForPosition

 def testCoordinateForPosition(self):
   scale = 30  # meters
   encoder = GeospatialCoordinateEncoder(scale, 60)
   coordinate = encoder.coordinateForPosition(
     -122.229194, 37.486782
   )
   self.assertEqual(coordinate.tolist(), [-453549, 150239])
開發者ID:AI-Cdrone,項目名稱:nupic,代碼行數:7,代碼來源:geospatial_coordinate_test.py

示例4: testReadWrite

  def testReadWrite(self):
    scale = 30 # meters
    timestep = 60 # seconds
    speed = 2.5 # meters per second
    original = GeospatialCoordinateEncoder(scale, timestep, n=999, w=25)
    encode(original, speed, -122.229194, 37.486782, 0)
    encode(original, speed, -122.229294, 37.486882, 100)

    proto1 = GeospatialCoordinateEncoderProto.new_message()
    original.write(proto1)

    # Write the proto to a temp file and read it back into a new proto
    with tempfile.TemporaryFile() as f:
      proto1.write(f)
      f.seek(0)
      proto2 = GeospatialCoordinateEncoderProto.read(f)

    encoder = GeospatialCoordinateEncoder.read(proto2)

    self.assertIsInstance(encoder, GeospatialCoordinateEncoder)
    self.assertEqual(encoder.w, original.w)
    self.assertEqual(encoder.n, original.n)
    self.assertEqual(encoder.name, original.name)
    self.assertEqual(encoder.verbosity, original.verbosity)

    # Compare a new value with the original and deserialized.
    encoding3 = encode(original, speed, -122.229294, 37.486982, 1000)
    encoding4 = encode(encoder, speed, -122.229294, 37.486982, 1000)
    self.assertTrue(np.array_equal(encoding3, encoding4))
開發者ID:Afey,項目名稱:nupic,代碼行數:29,代碼來源:geospatial_coordinate_test.py

示例5: testRadiusForSpeedInt

 def testRadiusForSpeedInt(self):
   """Test that radius will round to the nearest integer"""
   scale = 30  # meters
   timestep = 62  #seconds
   speed = 25  # meters per second
   encoder = GeospatialCoordinateEncoder(scale, timestep)
   radius = encoder.radiusForSpeed(speed)
   self.assertEqual(radius, 38)
開發者ID:AI-Cdrone,項目名稱:nupic,代碼行數:8,代碼來源:geospatial_coordinate_test.py

示例6: testCoordinateForPositionOrigin3D

  def testCoordinateForPositionOrigin3D(self):
    scale = 1 # meters
    encoder = GeospatialCoordinateEncoder(scale, 60)
    coordinate = encoder.coordinateForPosition(0,0,0)

    # see WGS80 defining parameters (semi-major axis) on
    # http://en.wikipedia.org/wiki/Geodetic_datum#Parameters_for_some_geodetic_systems
    self.assertEqual(coordinate.tolist(), [6378137, 0, 0])  
開發者ID:AI-Cdrone,項目名稱:nupic,代碼行數:8,代碼來源:geospatial_coordinate_test.py

示例7: testRadiusForSpeed0

 def testRadiusForSpeed0(self):
   scale = 30  # meters
   timestep = 60  #seconds
   speed = 0  # meters per second
   n = 999
   w = 27
   encoder = GeospatialCoordinateEncoder(scale, timestep, n=n, w=w)
   radius = encoder.radiusForSpeed(speed)
   self.assertEqual(radius, 3)
開發者ID:AI-Cdrone,項目名稱:nupic,代碼行數:9,代碼來源:geospatial_coordinate_test.py

示例8: testCoordinateForPositionOrigin

 def testCoordinateForPositionOrigin(self):
   scale = 30  # meters
   encoder = GeospatialCoordinateEncoder(scale, 60)
   coordinate = encoder.coordinateForPosition(0, 0)
   self.assertEqual(coordinate.tolist(), [0, 0])
開發者ID:AI-Cdrone,項目名稱:nupic,代碼行數:5,代碼來源:geospatial_coordinate_test.py


注:本文中的nupic.encoders.geospatial_coordinate.GeospatialCoordinateEncoder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。