当前位置: 首页>>代码示例>>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;未经允许,请勿转载。