Add A module (disparity modulation) set and get test - #12466
Conversation
| def test_amp_factor(am_device, new_a_factor: float): | ||
| """ | ||
| This function set new A Factor value to advance mode device | ||
| :am_am_device: advance mode device |
| """ | ||
| This function set new A Factor value to advance mode device | ||
| :am_am_device: advance mode device | ||
| :a_factor: new A Factor value |
| :am_am_device: advance mode device | ||
| :a_factor: new A Factor value | ||
| """ | ||
| factor = am_device.get_amp_factor() |
There was a problem hiding this comment.
rename to previous_amp_factor
| am_device.set_amp_factor(factor) | ||
|
|
||
| log.d('Checking A factor: ' + str(new_a_factor)) | ||
| test.check(am_device.get_amp_factor().a_factor - new_a_factor < 0.01) |
There was a problem hiding this comment.
Try using this API test.check_float_lists
| factor.a_factor = new_a_factor | ||
| am_device.set_amp_factor(factor) | ||
|
|
||
| log.d('Checking A factor: ' + str(new_a_factor)) |
| depth_profile_depth = next(p for p in depth_sensor.profiles if p.stream_type() == rs.stream.depth) | ||
| depth_profile_infrared = next(p for p in depth_sensor.profiles if p.stream_type() == rs.stream.infrared) | ||
|
|
||
| test.start('Check that Disparity modulation receive values:') |
There was a problem hiding this comment.
Please wrap all the logic with test.start
If you don't get into the if you are not in the test?
And you do finish it in the end?
There was a problem hiding this comment.
You can wrap with with test.closure( 'verify set/get of Disparity modulation' ):
and remove the test.finish.
Like here:
https://github.com/IntelRealSense/librealsense/blob/c918402db93d6e74cade6bec1f5accf0387c4fff/unit-tests/dds/test-metadata.py#L127
| if depth_sensor and advance_mode_device: | ||
|
|
||
| depth_profile_depth = next(p for p in depth_sensor.profiles if p.stream_type() == rs.stream.depth) | ||
| depth_profile_infrared = next(p for p in depth_sensor.profiles if p.stream_type() == rs.stream.infrared) |
There was a problem hiding this comment.
WHat are you doing with lines 41 + 42?
| test_amp_factor(advance_mode_device, 0.1) | ||
| test_amp_factor(advance_mode_device, 0.15) | ||
| test_amp_factor(advance_mode_device, 0.2) | ||
| test_amp_factor(advance_mode_device, 0.0) |
|
Here is the commit with the changes. |
|
|
||
|
|
||
| device = test.find_first_device_or_exit() | ||
| depth_sensor = device.first_depth_sensor() |
There was a problem hiding this comment.
- Why do I need
depth_sensor? - Why do I need to close depth sensor if I didn't ask start streaming?
There was a problem hiding this comment.
You're right, I thought I would use it and leave it in the code. Removed
|
|
||
| with test.closure('Verify set/get of Disparity modulation'): | ||
| if depth_sensor and advance_mode_device: | ||
| a_factor_values = [0.05, 0.0] |
There was a problem hiding this comment.
Let's check 0.01 & 0.05
0 is a special case which I don't know if is valid.
There was a problem hiding this comment.
Ok, I found that 0 is a default value, so thought to return the default value at the end of the test.
There was a problem hiding this comment.
I checked values out of scope [0, 0.2] and it gave me error.
Tracked on [LRS-971]