-
Notifications
You must be signed in to change notification settings - Fork 23
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
New signal typing #594
base: main
Are you sure you want to change the base?
New signal typing #594
Conversation
Apologies, another unreviewable PR, but if you start from the tests you can see the changes needed |
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.
Most of these are discussion points more than "requested changes". I definitely like abstracting out connection logic.
"numpy<2.0.0", | ||
"numpy", |
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.
Do we not have this working with numpy >=2
? That's what's being installed currently right?
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.
These changes will make use of np.dtypes.StringDType()
as discussed with @danielballan which is only available in numpy 2, so yes I should make it numpy >= 2
"packaging", | ||
"pint", | ||
"bluesky>=1.13.0a3", | ||
"event_model", | ||
"p4p", | ||
"event-model @ git+https://github.com/bluesky/event-model@main", |
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 we want to pin main here? Using latest release would incentivize regular event-model patch releases.
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.
Ah I see you're using Limits
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.
There will probably be a few other import level changes to event model before I'm done, then we can release event model too and go back to a release here
if not get_origin(datatype) == np.ndarray: | ||
raise TypeError(f"Expected np.ndarray, got {datatype}") | ||
# datatype = numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]] | ||
# so extract numpy.float64 from it | ||
return np.dtype(get_args(get_args(datatype)[1])[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.
Do we allow for np arrays without subtype? If so we need:
if not get_origin(datatype) == np.ndarray: | |
raise TypeError(f"Expected np.ndarray, got {datatype}") | |
# datatype = numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]] | |
# so extract numpy.float64 from it | |
return np.dtype(get_args(get_args(datatype)[1])[0]) | |
if get_origin(datatype) == np.ndarray: | |
# np.ndarray[typing.Any, np.dtype[np.float64]] returns np.float64 | |
return np.dtype(get_args(get_args(datatype)[1])[0]) | |
elif datatype == np.ndarray: | |
return np.float64 | |
else: | |
raise TypeError(f"Expected np.ndarray, got {datatype}") |
If not then perhaps a modification to the error message that the numpy array must be explicitly typed in the npt.NDArray
format?
Co-authored-by: Eva Lott <[email protected]>
Co-authored-by: Eva Lott <[email protected]>
Co-authored-by: Eva Lott <[email protected]>
WIP for review by @evalott100