Add support for actfast lenient mode#281
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
==========================================
- Coverage 96.72% 96.56% -0.17%
==========================================
Files 17 17
Lines 1100 1105 +5
==========================================
+ Hits 1064 1067 +3
- Misses 36 38 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| time = time.gather(unique_time_indices) | ||
|
|
||
| for sensor_name, sensor_values in timeseries.items(): | ||
| if not isinstance(sensor_values, np.ndarray): |
There was a problem hiding this comment.
What's happening here? Should this also throw a warning?
There was a problem hiding this comment.
I think Flo may changed the type output from actfast because there was a mypy error that sensor_values was not necessarily an np.ndarray. This was just a type guard to just do nothing if we find something that isn't a numpy array in a sensor value so we don't try to create a Measurement on line 73 (now line 76) with those non-array values (I've never seen this happen from actfast).
I can add the warning if you think it is necessary
There was a problem hiding this comment.
I did not change any return types, but did update the type stubs to be more descriptive (as I could use newer typing features after bumping minimum python to 3.10)
You should now also got auto complete and docs on the returned dictionaries as well as basic numpy array types. (But yeah only the type hints got refined nothing changed about the implementation)
There was a problem hiding this comment.
There was a problem hiding this comment.
ah - then just type ignore with a comment that we believe this is a mypy issue?
There was a problem hiding this comment.
I was about to type ignore and just say, we know this is a numpy array from actfast, but I thought might as well just add this check for clarity? I'm fine with either option
There was a problem hiding this comment.
Its kind of this - apparently I should annotate them with @final, but that is also broken in mypy (also doesnt work in ty, i just checked)
There was a problem hiding this comment.
Why Python. Why.
Yeah either is fine to me @Asanto32
There was a problem hiding this comment.
You can remove the check and ignore. Values will always be numpy arrays
Bumping wristpy version
Resolves #280
Will allow sensor data to be read with actfast even if partially corrupted (data up to corrupted point is kept, see
actfastlenient mode)