skdh.activity.ActivityEndpoint#

class skdh.activity.ActivityEndpoint(name, state)#

Base class for activity endpoints. Should be subclassed for creating custom activity endpoints.

Attributes:
name{list, str}

Name, or list of names of the endpoints being generated.

state{‘wake’, ‘sleep’}

State during which the endpoint is being computed.

Methods

predict(results, i, accel_metric, epoch_s, ...)

Method that gets called during each block of wear time during either waking hours (if state='wake') or sleeping hours (if state='sleep').

reset_cached()

Called after all the blocks during the desired state have been run.

predict(results, i, accel_metric, epoch_s, epochs_per_min)#

Method that gets called during each block of wear time during either waking hours (if state=’wake’) or sleeping hours (if state=’sleep’). This means it may run multiple times per state.

Parameters:
resultsdict

Dictionary containing the initialized results arrays. Keys in results are taken from the names of endpoints.

iint

Index of the day, used to index into individual result arrays, e.g. results[self.name][i] = 5.0

accel_metricnumpy.ndarray

Computed acceleration metric (e.g. ENMO).

epoch_sint

Duration in seconds of each sample of accel_metric.

epochs_per_minint

Number of epochs per minute.

reset_cached()#

Called after all the blocks during the desired state have been run. Can be used to calculate results on all data for the day/state.