-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* coverage * pass model id * remove mysql config * add noise * fix tests * fix tests
- Loading branch information
1 parent
2e2294f
commit 868ccc5
Showing
9 changed files
with
130 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import random | ||
|
||
|
||
def distance_to_analog_output(distance: float): | ||
""" | ||
distance: float in m | ||
""" | ||
distance = distance * 1000 * 135 # m to mm, distance to analog output | ||
# add noise | ||
distance = distance + (distance * 0.001 * (2 * random.random() - 1)) | ||
return round(distance) | ||
|
||
|
||
def test_distance_to_analog_output(): | ||
distance_in_mm = 10.5 | ||
analog_output = distance_to_analog_output(distance_in_mm / 1000) | ||
assert analog_output > 0 | ||
assert analog_output < 19000 |