ada.preprocessing.epocher

ada.preprocessing.epocher#

Classes#

ActivityIndex

A class for epoching actigraphic data using algorithm by Bai et al. (2013).

CKEpocher

A class for epoching data in the style of Cole-Kripke, as described in Cole et al. (1992).

Downsampler

A class for epoching (downsampling) the data using standard downsampling procedure. The only one which guarantees no aliasing artifacts.

MIMS

A class for epoching (downsampling) the data using (slightly modified) MIMS algorithm by Dinesh et al. (2019).

MVM

A class for epoching data in the style of GeneActiv software. See GeneActiv documentation for details.

Functions#

main()

A script for epoching a batch of files. Run with -h or --help for details.

Module Contents#

class ActivityIndex[source]#

A class for epoching actigraphic data using algorithm by Bai et al. (2013).

epoch_length#
Return type:

int

Length of output epochs in seconds.

Type:

int

normalized#
Return type:

bool

Whether to return data normalized (see paper for details). Defaults to True.

Type:

bool

stationary_variance#
Return type:

float | None

Variance of data recorded from stationary actigraph. Autodetected from device if None.

Type:

float | None

to_epoch(data, wake_percentage=0.8)#

Epoching actigraphic data. Works for both ActiData and ActiPSG. Actigraphic data will be epoched by the selected Epocher. PSG data (if present) will be epoched using the change_epoch method. In case of ActiPSG intended to work mostly with 20, 30 and 60 s epochs.

Parameters:
  • data (ActiPSG | _Raw | GenericData) – Object containing actigraphic data and psg scoring

  • wake_percentage (float, optional) – Parameter describing how many points inside a new epoch must be wake, so the new epoch will also be wake. Meaningless when epoching only actigraphic data. Defaults to 0.8.

Raises:

ValueError – If actigraphic data is already scored. Don’t do this.

Returns:

Epoched actigraphic data and PSG scoring (if input was ActiPsg).

Return type:

ActiPSG | _Epoched

property epoch_length: int#

Output data epoch length in seconds.

Return type:

int

property normalized: bool#

Whether to return data normalized (see paper for details). Defaults to True.

Return type:

bool

property stationary_variance: float | None#

Variance of data recorded from stationary actigraph.

Return type:

float | None

class CKEpocher[source]#

A class for epoching data in the style of Cole-Kripke, as described in Cole et al. (1992).

epoch_length#
Return type:

int

Length of output epochs in seconds.

Type:

int

subepoch_length#

Lenght of subepochs in each epoch. If None, there are no subepochs. Defaults to None. See paper for details.

Type:

int | None

metric#
Return type:

str

Metric to be calculated on each subepoch. Defaults to np.max. See paper for details.

Type:

Callable

to_epoch(data, wake_percentage=0.8)#

Epoching actigraphic data. Works for both ActiData and ActiPSG. Actigraphic data will be epoched by the selected Epocher. PSG data (if present) will be epoched using the change_epoch method. In case of ActiPSG intended to work mostly with 20, 30 and 60 s epochs.

Parameters:
  • data (ActiPSG | _Raw | GenericData) – Object containing actigraphic data and psg scoring

  • wake_percentage (float, optional) – Parameter describing how many points inside a new epoch must be wake, so the new epoch will also be wake. Meaningless when epoching only actigraphic data. Defaults to 0.8.

Raises:

ValueError – If actigraphic data is already scored. Don’t do this.

Returns:

Epoched actigraphic data and PSG scoring (if input was ActiPsg).

Return type:

ActiPSG | _Epoched

property epoch_length: int#

Output data epoch length in seconds.

Return type:

int

property metric: str#

Metric to be calculated on each subepoch. Defaults to np.max. See paper for details.

Return type:

str

property subepcoh_length: int | None#

Length of subepochs in each epoch. If None, there are no subepochs. Defaults to None. See paper for details.

Return type:

int | None

class Downsampler[source]#

A class for epoching (downsampling) the data using standard downsampling procedure. The only one which guarantees no aliasing artifacts.

epoch_length#
Return type:

int

Length of output epochs in seconds.

Type:

int

to_epoch(data, wake_percentage=0.8)#

Epoching actigraphic data. Works for both ActiData and ActiPSG. Actigraphic data will be epoched by the selected Epocher. PSG data (if present) will be epoched using the change_epoch method. In case of ActiPSG intended to work mostly with 20, 30 and 60 s epochs.

Parameters:
  • data (ActiPSG | _Raw | GenericData) – Object containing actigraphic data and psg scoring

  • wake_percentage (float, optional) – Parameter describing how many points inside a new epoch must be wake, so the new epoch will also be wake. Meaningless when epoching only actigraphic data. Defaults to 0.8.

Raises:

ValueError – If actigraphic data is already scored. Don’t do this.

Returns:

Epoched actigraphic data and PSG scoring (if input was ActiPsg).

Return type:

ActiPSG | _Epoched

property epoch_length: int#

Output data epoch length in seconds.

Return type:

int

class MIMS[source]#

A class for epoching (downsampling) the data using (slightly modified) MIMS algorithm by Dinesh et al. (2019).

epoch_length#
Return type:

int

Length of output epochs in seconds.

Type:

int

stationary_variance#
Return type:

float | None

Variance of data recorded from stationary actigraph. Autodetected from device if None.

Type:

float | None

dynamic_range#

Maximum acceleration recorded by sensor. Autodetected from device if None.

Type:

float | None

extrapolation_samples#

Number of samples taken into account in the extrapolation step (see article).

Type:

int

extrapolation_shape#

Shape parameter of splines used during extrapolation step.

Type:

float

to_epoch(data, wake_percentage=0.8)#

Epoching actigraphic data. Works for both ActiData and ActiPSG. Actigraphic data will be epoched by the selected Epocher. PSG data (if present) will be epoched using the change_epoch method. In case of ActiPSG intended to work mostly with 20, 30 and 60 s epochs.

Parameters:
  • data (ActiPSG | _Raw | GenericData) – Object containing actigraphic data and psg scoring

  • wake_percentage (float, optional) – Parameter describing how many points inside a new epoch must be wake, so the new epoch will also be wake. Meaningless when epoching only actigraphic data. Defaults to 0.8.

Raises:

ValueError – If actigraphic data is already scored. Don’t do this.

Returns:

Epoched actigraphic data and PSG scoring (if input was ActiPsg).

Return type:

ActiPSG | _Epoched

property epoch_length: int#

Output data epoch length in seconds.

Return type:

int

property stationary_variance: float | None#

Variance of data recorded from stationary actigraph.

Return type:

float | None

class MVM[source]#

A class for epoching data in the style of GeneActiv software. See GeneActiv documentation for details.

epoch_length#
Return type:

int

Length of output epochs in seconds.

Type:

int

to_epoch(data, wake_percentage=0.8)#

Epoching actigraphic data. Works for both ActiData and ActiPSG. Actigraphic data will be epoched by the selected Epocher. PSG data (if present) will be epoched using the change_epoch method. In case of ActiPSG intended to work mostly with 20, 30 and 60 s epochs.

Parameters:
  • data (ActiPSG | _Raw | GenericData) – Object containing actigraphic data and psg scoring

  • wake_percentage (float, optional) – Parameter describing how many points inside a new epoch must be wake, so the new epoch will also be wake. Meaningless when epoching only actigraphic data. Defaults to 0.8.

Raises:

ValueError – If actigraphic data is already scored. Don’t do this.

Returns:

Epoched actigraphic data and PSG scoring (if input was ActiPsg).

Return type:

ActiPSG | _Epoched

property epoch_length: int#

Output data epoch length in seconds.

Return type:

int

main()[source]#

A script for epoching a batch of files. Run with -h or –help for details.