Skip to content

Commit

Permalink
PR #12836 from Nir-Az: Update tests to use default profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Apr 8, 2024
2 parents d3eeb2c + 49baa39 commit 3a73853
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
8 changes: 4 additions & 4 deletions unit-tests/live/frames/test-fps.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def frame_cb(frame):
and p.stream_type() == rs.stream.depth
and p.format() == rs.format.z16)
except StopIteration:
print("Requested fps: {:.1f} [Hz], not supported".format(requested_fps))
log.i("Requested fps: {:.1f} [Hz], not supported".format(requested_fps))
else:
fps = measure_fps(ds, dp, time_to_test_fps[i])
print("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds))
log.i("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds))
delta_Hz = requested_fps * 0.05 # Validation KPI is 5%
test.check(fps <= (requested_fps + delta_Hz) and fps >= (requested_fps - delta_Hz))
test.finish()
Expand All @@ -114,10 +114,10 @@ def frame_cb(frame):
and p.stream_type() == rs.stream.color
and p.format() == rs.format.rgb8)
except StopIteration:
print("Requested fps: {:.1f} [Hz], not supported".format(requested_fps))
log.i("Requested fps: {:.1f} [Hz], not supported".format(requested_fps))
else:
fps = measure_fps(cs, cp, time_to_test_fps[i])
print("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds))
log.i("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds))
delta_Hz = requested_fps * 0.05 # Validation KPI is 5%
test.check(fps <= (requested_fps + delta_Hz) and fps >= (requested_fps - delta_Hz))

Expand Down
15 changes: 6 additions & 9 deletions unit-tests/live/frames/test-t2ff-sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,9 @@ def frame_cb(frame):
test.check(device_creation_time < max_time_for_device_creation)
test.finish()


# Set maximum delay for first frame according to product line
product_line = dev.get_info(rs.camera_info.product_line)
if product_line == "D400":
max_delay_for_depth_frame = 1
max_delay_for_color_frame = 1
else:
log.f( "This test support only D400 devices" )
max_delay_for_depth_frame = 1
max_delay_for_color_frame = 1


ds = dev.first_depth_sensor()
Expand All @@ -74,12 +69,14 @@ def frame_cb(frame):
dp = next(p for p in
ds.profiles if p.fps() == 30
and p.stream_type() == rs.stream.depth
and p.format() == rs.format.z16)
and p.format() == rs.format.z16
and p.is_default())

cp = next(p for p in
cs.profiles if p.fps() == 30
and p.stream_type() == rs.stream.color
and p.format() == rs.format.rgb8)
and p.format() == rs.format.rgb8
and p.is_default())


#####################################################################################################
Expand Down
4 changes: 2 additions & 2 deletions unit-tests/live/options/test-timestamp-domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def set_and_verify_timestamp_domain(sensor, frame_queue, global_time_enabled: bo
depth_frame_queue = rs.frame_queue(queue_capacity, keep_frames=False)

depth_sensor = device.first_depth_sensor()
depth_profile = next(p for p in depth_sensor.profiles if p.stream_type() == rs.stream.depth)
depth_profile = next(p for p in depth_sensor.profiles if p.stream_type() == rs.stream.depth and p.is_default())
depth_sensor.open(depth_profile)
depth_sensor.start(depth_frame_queue)

Expand All @@ -69,7 +69,7 @@ def set_and_verify_timestamp_domain(sensor, frame_queue, global_time_enabled: bo
color_frame_queue = rs.frame_queue(queue_capacity, keep_frames=False)

color_sensor = device.first_color_sensor()
color_profile = next(p for p in color_sensor.profiles if p.stream_type() == rs.stream.color)
color_profile = next(p for p in color_sensor.profiles if p.stream_type() == rs.stream.color and p.is_default())
color_sensor.open(color_profile)
color_sensor.start(color_frame_queue)

Expand Down

0 comments on commit 3a73853

Please sign in to comment.