-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix/pressure parser error #17
Conversation
…o numpy typestrings
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.
Looks good to me.
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.
A more meaningful exception (e.g. a TypeError
with a descriptive message) would be better than an AssertError
.
I'd prefer an
However I think it's fine to, for clarity, add an error message to the assert explaining the failure. |
So, this is essentially checking if the Python and Numpy implementations match up, right? If we want to check something for the sake of the whole module, which this would be, would it make more sense to move this out of a class definition? If this is a legitimate concern, should we also be checking platform native data sizes? These are allowed to change from one platform to another, and so that actually could fail. |
I misinterpreted what the assert was doing; I thought it was validating the channel's formatting string. That said, it seems like this sort of sanity check should be in the unit tests. |
@CFlaniganMide actually there should be no platform where this fails: the left-side of the equality check is from the struct package, which uses standard sizes when an endian-ness is specified that should be consistent across platforms; the right side is numpy dtypes specified using the type-&-size style typestrings (e.g., |
@StokesMIDE not my preference but it's addressed in 4aaa724 |
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.
This generally looks good.
I don't want this discussion to prevent this from moving forwards since I think that where it is is fine. This one check is essentially validating that the struct module and Numpy agree. I'm comfortable assuming that any official releases of cpython and Numpy will be implemented correctly, and saying that is all that we officially support. Running that in the module level init.py file might hypothetically make diagnosing an esoteric error easier if it ever comes up but I don't think that's likely.
resolves #16