MideTechnology / idelib

Python API for accessing .IDE data recordings made by enDAQ devices.
MIT License
5 stars 0 forks source link

Use datetime, timedelta, etc. for getting values at times #8

Open StokesMIDE opened 4 years ago

StokesMIDE commented 4 years ago

The various EventList/EventArray methods for getting data based on time (e.g. getValueAt(), getEventIndexBefore(), getEventIndexNear(), getRangeIndices(), etc.) use times in microseconds, not the most scripter-friendly units. Suggestion: also use datetime.datetime and datetime.timedelta objects. It's pretty easy to convert these into recording-relative time in microseconds. "Overload" those methods to accept those additional data types, or implement comparable methods that do.

timedelta would just get converted to microseconds (d.total_seconds() * 10**6). datetime would subtract the session start time (converting from UTC as necessary), and then use the resulting timedelta.

StokesMIDE commented 4 years ago

Also consider using Numpy's versions. Note that they operate slightly differently.