-
Notifications
You must be signed in to change notification settings - Fork 178
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
chore(hardware): upgrade numpy #9880
Conversation
Bumping numpy revealed some real issues with our code and also some real issues with numpy's as-yet incomplete typing, such as - many functions particularly in numpy.linalg aren't typed, like `norm` - many arithmetic ops and functions behave quite strangely, often returning a `np.Float[_64bit, Any]` instead of a float64 equivalent - ndarray typing is still not quite there, but that's mostly because some typing peps need to be merged first This should be a low risk set of changes.
Codecov Report
@@ Coverage Diff @@
## edge #9880 +/- ##
==========================================
- Coverage 75.20% 75.00% -0.21%
==========================================
Files 2005 2007 +2
Lines 53156 53293 +137
Branches 5148 5148
==========================================
- Hits 39976 39971 -5
- Misses 12161 12303 +142
Partials 1019 1019
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Code changes look good to me! Should probably wait for an @Opentrons/embedded-sw review before merging due to my general lack of familiarity with this code, though
@@ -16,6 +16,9 @@ | |||
vectorize, | |||
) | |||
|
|||
if TYPE_CHECKING: |
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.
If we want to get rid of this annoying Codecov message, we should copy over the .coveragerc
from api
to ignore if TYPE_CHECKING:
blocks
[report]
exclude_lines =
@overload
if TYPE_CHECKING:
@@ -484,5 +490,5 @@ def unit_vector_multiplication( | |||
unit_vector: Coordinates[AxisKey, np.float64], value: np.float64 | |||
) -> Coordinates[AxisKey, np.float64]: | |||
"""Multiply coordinates type by a float value.""" | |||
targets: np.ndarray = vectorize(unit_vector) * value | |||
targets: "NDArray[np.float64]" = vectorize(unit_vector) * 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.
Should we prefer from __future__ import annotations
over string-types, where possible?
Bumping numpy revealed some real issues with our code and also some real issues with numpy's as-yet incomplete typing, such as - many functions particularly in numpy.linalg aren't typed, like `norm` - many arithmetic ops and functions behave quite strangely, often returning a `np.Float[_64bit, Any]` instead of a float64 equivalent - ndarray typing is still not quite there, but that's mostly because some typing peps need to be merged first This should be a low risk set of changes. Co-authored-by: Mike Cousins <[email protected]>
Building on #9871 and other work by @mcous , bump the version of numpy used in hardware to 1.21.1 which matches what will be on the OT-2 and has some better typing.
Bumping numpy revealed some real issues with our code and also some real
issues with numpy's as-yet incomplete typing, such as
norm
returning a
np.Float[_64bit, Any]
instead of a float64 equivalentsome typing peps need to be merged first
This should be a low risk set of changes.