当前位置: 首页>>代码示例>>Python>>正文


Python UasTelemetry.by_user方法代码示例

本文整理汇总了Python中auvsi_suas.models.UasTelemetry.by_user方法的典型用法代码示例。如果您正苦于以下问题:Python UasTelemetry.by_user方法的具体用法?Python UasTelemetry.by_user怎么用?Python UasTelemetry.by_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在auvsi_suas.models.UasTelemetry的用法示例。


在下文中一共展示了UasTelemetry.by_user方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_kml_simple

# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import by_user [as 别名]
    def test_kml_simple(self):
        coordinates = [
            (-76.0, 38.0, 0.0),
            (-76.0, 38.0, 10.0),
            (-76.0, 38.0, 20.0),
            (-76.0, 38.0, 30.0),
            (-76.0, 38.0, 100.0),
            (-76.0, 38.0, 30.0),
            (-76.0, 38.0, 60.0),
        ]
        # Create Coordinates
        start = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
        start.save()
        for coord in coordinates:
            self.create_log_element(*coord)
        end = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
        end.save()

        kml = Kml()
        UasTelemetry.kml(user=self.user,
                         logs=UasTelemetry.by_user(self.user),
                         kml=kml,
                         kml_doc=kml)
        for coord in coordinates:
            tag = self.coord_format.format(coord[1], coord[0],
                                           units.feet_to_meters(coord[2]))
            self.assertTrue(tag in kml.kml())
开发者ID:APTRG,项目名称:interop,代码行数:29,代码来源:uas_telemetry_test.py

示例2: test_kml_filter

# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import by_user [as 别名]
    def test_kml_filter(self):
        coordinates = [
            (-76.0, 38.0, 0.0),
            (-76.0, 38.0, 10.0),
            (-76.0, 38.0, 20.0),
            (-76.0, 38.0, 30.0),
            (-76.0, 38.0, 100.0),
            (-76.0, 38.0, 30.0),
            (-76.0, 38.0, 60.0),
        ]
        filtered_out = [(0.1, 0.001, 100), (0.0, 0.0, 0)]
        # Create Coordinates
        start = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
        start.save()
        for coord in coordinates:
            self.create_log_element(*coord)
        for coord in filtered_out:
            self.create_log_element(*coord)
        end = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
        end.save()

        kml = Kml()
        UasTelemetry.kml(user=self.user,
                         logs=UasTelemetry.by_user(self.user),
                         kml=kml,
                         kml_doc=kml)

        for filtered in filtered_out:
            tag = self.coord_format.format(filtered[1], filtered[0],
                                           filtered[2])
            self.assertTrue(tag not in kml.kml())

        for coord in coordinates:
            tag = self.coord_format.format(coord[1], coord[0], coord[2])
            self.assertTrue(tag in kml.kml())
开发者ID:RishabhSharma1906,项目名称:interop,代码行数:37,代码来源:uas_telemetry_test.py

示例3: test_kml_empty

# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import by_user [as 别名]
 def test_kml_empty(self):
     kml = Kml()
     UasTelemetry.kml(
         user=self.user,
         logs=UasTelemetry.by_user(self.user),
         kml=kml,
         kml_doc=kml, )
开发者ID:CnuUasLab,项目名称:interop,代码行数:9,代码来源:uas_telemetry_test.py

示例4: test_kml

# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import by_user [as 别名]
    def test_kml(self):
        """
        Tests the generation of kml data
            The correct number of elements are generated
            The meta-data tag is present
        """
        array_field_tag = '<gx:SimpleArrayField name="proximity" type="float">'
        coordinates = [
            (-76.0, 38.0, 0.0),
            (-76.0, 38.0, 10.0),
            (-76.0, 38.0, 20.0),
            (-76.0, 38.0, 30.0),
            (-76.0, 38.0, 100.0),
            (-76.0, 38.0, 30.0),
            (-76.0, 38.0, 60.0),
        ]

        user = User.objects.create_user('testuser', '[email protected]',
                                        'testpass')
        user.save()

        # Create Coordinates
        start_time = timezone.now()
        next_time = start_time
        end_time = start_time
        for coord in coordinates:
            self.create_log_element(*coord, user=user, log_time=next_time)
            end_time = next_time
            next_time += datetime.timedelta(seconds=1)

        # Calculate expected number of data tags
        time_delta = end_time - start_time
        ms_elapsed = time_delta.total_seconds() * 1000
        kml_output_resolution = 100  # milliseconds
        samples_expected = int(ms_elapsed / kml_output_resolution)

        for cur_obst in self.obstacles:
            kml = Kml()
            kml_mission = kml.newfolder(name='SubFolder')
            cur_obst.kml(
                path=UasTelemetry.by_user(user),
                kml=kml_mission,
                kml_doc=kml.document, )
            result_kml = kml.kml()
            self.assertEqual(samples_expected, result_kml.count('<gx:value>'))
            self.assertIn(array_field_tag, result_kml)
开发者ID:CnuUasLab,项目名称:interop,代码行数:48,代码来源:moving_obstacle_test.py

示例5: get

# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import by_user [as 别名]
    def get(self, request):
        kml = Kml(name='AUVSI SUAS Flight Data')
        kml_teams = kml.newfolder(name='Teams')
        kml_mission = kml.newfolder(name='Missions')
        users = User.objects.all()
        for user in users:
            # Ignore admins
            if user.is_superuser:
                continue
            UasTelemetry.kml(user=user,
                             logs=UasTelemetry.by_user(user),
                             kml=kml_teams,
                             kml_doc=kml.document)
        MissionConfig.kml_all(kml_mission)
        kml_flyzone = kml.newfolder(name='Fly Zones')
        FlyZone.kml_all(kml_flyzone)

        response = HttpResponse(kml.kml())
        response['Content-Type'] = 'application/vnd.google-earth.kml+xml'
        response['Content-Disposition'] = 'attachment; filename=mission.kml'
        response['Content-Length'] = str(len(response.content))
        return response
开发者ID:bho008,项目名称:interop,代码行数:24,代码来源:export_kml.py


注:本文中的auvsi_suas.models.UasTelemetry.by_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。