本文整理汇总了Python中auvsi_suas.models.uas_telemetry.UasTelemetry.by_time_period方法的典型用法代码示例。如果您正苦于以下问题:Python UasTelemetry.by_time_period方法的具体用法?Python UasTelemetry.by_time_period怎么用?Python UasTelemetry.by_time_period使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auvsi_suas.models.uas_telemetry.UasTelemetry
的用法示例。
在下文中一共展示了UasTelemetry.by_time_period方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_open_start
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def test_open_start(self):
"""Logs (-inf, 2001)"""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(None, self.year2001),
])
self.assertSequenceEqual([self.year2000_logs], self.to_lists(results))
示例2: test_open_end
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def test_open_end(self):
"""Logs (2003, inf)"""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2003, None),
])
self.assertSequenceEqual([self.year2003_logs], self.to_lists(results))
示例3: test_non_intersecting_period
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def test_non_intersecting_period(self):
"""No logs matched."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2001, self.year2002),
])
self.assertSequenceEqual([[]], self.to_lists(results))
示例4: test_full_range
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def test_full_range(self):
"""All logs from (-inf, inf)."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(None, None)
])
self.assertSequenceEqual([self.logs], self.to_lists(results))
示例5: test_single_period
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def test_single_period(self):
"""Single set of logs accessible."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2000, self.year2001)
])
self.assertSequenceEqual([self.year2000_logs], self.to_lists(results))
示例6: test_one_intersecting_period
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def test_one_intersecting_period(self):
"""Only one period matches logs."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2001, self.year2002),
TimePeriod(self.year2003, self.year2004),
])
self.assertSequenceEqual(
[[], self.year2003_logs], self.to_lists(results))
示例7: test_both_periods
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def test_both_periods(self):
"""Both sets of logs, accesses individually."""
results = UasTelemetry.by_time_period(self.user1, [
TimePeriod(self.year2000, self.year2001),
TimePeriod(self.year2003, self.year2004),
])
self.assertSequenceEqual(
[self.year2000_logs, self.year2003_logs], self.to_lists(results))
示例8: test_no_data
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def test_no_data(self):
log = UasTelemetry.last_for_user(self.user1)
self.assertEqual(None, log)
logs = UasTelemetry.by_user(self.user1)
self.assertEqual(len(logs), 0)
logs = UasTelemetry.by_time_period(self.user1, [])
self.assertSequenceEqual([], logs)
log_rates = UasTelemetry.rates(self.user1, [])
self.assertTupleEqual(log_rates, (None, None))
示例9: generate_feedback
# 需要导入模块: from auvsi_suas.models.uas_telemetry import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.uas_telemetry.UasTelemetry import by_time_period [as 别名]
def generate_feedback(mission_config, user, team_eval):
"""Generates mission feedback for the given team and mission.
Args:
mission_config: The mission to evaluate the team against.
user: The team user object for which to evaluate and provide feedback.
team_eval: The team evaluation to fill.
"""
feedback = team_eval.feedback
# Calculate the total mission clock time.
missions = MissionClockEvent.missions(user)
mission_clock_time = datetime.timedelta(seconds=0)
for mission in missions:
duration = mission.duration()
if duration is None:
team_eval.warnings.append('Infinite mission clock.')
else:
mission_clock_time += duration
feedback.mission_clock_time_sec = mission_clock_time.total_seconds()
# Calculate total time in air.
flight_periods = TakeoffOrLandingEvent.flights(user)
if flight_periods:
flight_time = reduce(lambda x, y: x + y, [p.duration()
for p in flight_periods])
feedback.flight_time_sec = flight_time.total_seconds()
else:
feedback.flight_time_sec = 0
# Find the user's flights.
for period in flight_periods:
if period.duration() is None:
team_eval.warnings.append('Infinite flight period.')
uas_period_logs = [
UasTelemetry.dedupe(logs)
for logs in UasTelemetry.by_time_period(user, flight_periods)
]
uas_logs = list(itertools.chain.from_iterable(uas_period_logs))
if not uas_logs:
team_eval.warnings.append('No UAS telemetry logs.')
# Determine interop telemetry rates.
telem_max, telem_avg = UasTelemetry.rates(user,
flight_periods,
time_period_logs=uas_period_logs)
if telem_max:
feedback.uas_telemetry_time_max_sec = telem_max
if telem_avg:
feedback.uas_telemetry_time_avg_sec = telem_avg
# Determine if the uas went out of bounds. This must be done for
# each period individually so time between periods isn't counted as
# out of bounds time. Note that this calculates reported time out
# of bounds, not actual or possible time spent out of bounds.
out_of_bounds = datetime.timedelta(seconds=0)
feedback.boundary_violations = 0
for logs in uas_period_logs:
bv, bt = FlyZone.out_of_bounds(mission_config.fly_zones.all(), logs)
feedback.boundary_violations += bv
out_of_bounds += bt
feedback.out_of_bounds_time_sec = out_of_bounds.total_seconds()
# Determine if the uas hit the waypoints.
feedback.waypoints.extend(UasTelemetry.satisfied_waypoints(
mission_config.home_pos, mission_config.mission_waypoints.order_by(
'order'), uas_logs))
# Evaluate the targets.
user_targets = Target.objects.filter(user=user).all()
evaluator = TargetEvaluator(user_targets, mission_config.targets.all())
feedback.target.CopyFrom(evaluator.evaluate())
# Determine collisions with stationary and moving obstacles.
for obst in mission_config.stationary_obstacles.all():
obst_eval = feedback.stationary_obstacles.add()
obst_eval.id = obst.pk
obst_eval.hit = obst.evaluate_collision_with_uas(uas_logs)
for obst in mission_config.moving_obstacles.all():
obst_eval = feedback.moving_obstacles.add()
obst_eval.id = obst.pk
obst_eval.hit = obst.evaluate_collision_with_uas(uas_logs)
# Add judge feedback.
try:
judge_feedback = MissionJudgeFeedback.objects.get(
mission=mission_config.pk,
user=user.pk)
feedback.judge.CopyFrom(judge_feedback.proto())
except MissionJudgeFeedback.DoesNotExist:
team_eval.warnings.append('No MissionJudgeFeedback for team.')
# Sanity check mission time.
judge_mission_clock = (
feedback.judge.flight_time_sec + feedback.judge.post_process_time_sec)
if abs(feedback.mission_clock_time_sec - judge_mission_clock) > 30:
team_eval.warnings.append(
'Mission clock differs between interop and judge.')