Define Threshold as Parameter in create_inactivity_mask()
ugGit opened this issue · comments
Hi
I'm trying to compare activity signals coming from Fitbit and Actiwatch devices. To create identical conditions for both, I create the PyActigraphy object using activity timeseries.
Now, I'd like to auto-create the inactivity mask. However, since the activity for the fitbit device has a different amplitude (somewhere between 1 and 15), I need to be able to define the threshold used differently.
Therefore, I suggest the following change to the method interface of create_inactivity_mask()
:
https://github.com/ghammad/pyActigraphy/blob/master/pyActigraphy/filters/filters.py#L71
# old
def create_inactivity_mask(self, duration)
# new
def create_inactivity_mask(self, duration, threshold=1)
And consequently the method call to _create_inactivity_mask()
:
https://github.com/ghammad/pyActigraphy/blob/master/pyActigraphy/filters/filters.py#L104
# old
self.mask = _create_inactivity_mask(self.raw_data, nepochs, 1)
# new
self.mask = _create_inactivity_mask(self.raw_data, nepochs, threshold)
If this sounds reasonable, I'll gladly make the adaption and create a corresponding PR.
Cheers
Hello @ugGit
Thanks a lot for your contribution.
Indeed, adding some flexibility about the mask creation is good, provided that it remains backward compatible and does not change the default behaviour.
Feel free to submit your PR any time and thanks again for helping us to make the software better.
Best regards,
Greg