-
Notifications
You must be signed in to change notification settings - Fork 93
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
datetime.timedelta not precise enough for all nimi-python use cases #744
Comments
So how to solve this? Using float in the Python APIs like before #659 would be an un-pythonic step back. What would be really neat, is a drop-in, duck-type replacement for datetime.timedelta that supports resolutions higher than than the built-in class. Then nimi-python could switch to using that wherever appropriate. |
The workaround is to use a float in seconds via #796 |
Maybe numpy datetime would be a good fit: https://docs.scipy.org/doc/numpy/reference/arrays.datetime.html#datetime-units |
Additional examples of this problem for niscope:
There may be others; I haven't gone over the API and devices with a fine-toothed comb. |
#659 is merged which is great because it's slick. However, it introduced one problem: Python's built-in datetime.timedelta is not precise enough for all of nimi-python's use cases.
For example:
The NI-SCOPE attribute NISCOPE_ATTR_END_OF_RECORD_TO_ADVANCE_TRIGGER_HOLDOFF is specified as a ViReal64 (which is a double) in the C API and can have values with resolution greater than a microsecond.
But in the Python API this corresponds to
niscope.Session.end_of_record_to_advance_trigger_holdoff
which is a datetime.timedelta and can only be specified in resolution of microseconds but not smaller.The text was updated successfully, but these errors were encountered: