-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add A module (disparity modulation) set and get test #12466
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am_am
please rename
""" | ||
This function set new A Factor value to advance mode device | ||
:am_am_device: advance mode device | ||
:a_factor: new A Factor value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new_a_factor
?
: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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this log
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can wrap with with test.closure( 'verify set/get of Disparity modulation' ):
and remove the test.finish.
Like here:
librealsense/unit-tests/dds/test-metadata.py
Line 127 in c918402
with test.closure( "No librs syncer; direct from server" ): |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/2 set is enough
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked values out of scope [0, 0.2] and it gave me error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tracked on [LRS-971]