ada.short.cole_kripke

ada.short.cole_kripke#

Classes#

ColeKripke

Class for scoring data by Cole-Kripke algorithm. See Cole et al. (1992) for details.

Sazonov

Class for scoring data by Sazonov algorithm. See Sazonov et al. (2004) for details.

Scripps

Class for scoring data by Scripps Clinic algorithm. See Kripke et al. (2012) for details.

Ucsd

Class for scoring data by Sazonov algorithm. See Jean-Louis et al. (2001) for details.

Webster

Class for scoring data by Sazonov algorithm. See Webster et al. (1989) for details.

Module Contents#

class ColeKripke(threshold=None, rescoring=True)[source]#

Class for scoring data by Cole-Kripke algorithm. See Cole et al. (1992) for details.

Attributes threshold (float | None): Threshold value discriminating sleep and wake epochs. Autodetected based on input data if None. Defaults to None. rescoring (bool): Whether to apply rescoring rules. Defaults to True.

Parameters:
  • threshold (float | None)

  • rescoring (bool)

fit_threshold(acti_psg, thresholds=(0.001, 0.03), n_thresholds=1000, full_data=False)#

Fit a threshold that is maximazing mean correlation between PSG scorings and actigraphic scorings.

Parameters:
  • acti_psg (list[ActiPSG]) – List of objects containing actigraphic data and PSG sleep/wake scorings.

  • thresholds (Tuple[float, float], optional) – Range of thresholds to fit. Defaults to (.001, .03).

  • n_thresholds (int, optional) – Number of thresholds to fit. Defaults to 1000.

  • full_data (bool, optional) – If True, list with all correlations will be returned. If False, the maximal correlation will be returned. Defaults to False.

Returns:

List of all correlations (with corresponding thresholds) or maximal correlation.

Return type:

float | list[Tuple[float, float]]

to_score(epoched)#

Apply scoring algorithm to the input data.

Parameters:

epoched (_Epoched | GenericData) – Epoched data to be scored by the algorithm. Scoring by Cole-Kripke family requires previous epoching.

Returns:

Object containng scored data.

Return type:

ScoredShort

transmittance(n_points=2048, db=True)#

Transmittance of filter used in the algorithm. Evaluated for correct sampling frequency (as defined by given algorithm).

Parameters:
  • n_points (int, optional) – Number of point at which filter will be evaluated. Defaults to 2048.

  • db (bool, optional) – Whether to return in dB scale. Defaults to True.

Returns:

Vector of frequencies and vector of frequency responses.

Return type:

Tuple[np.ndarray, np.ndarray]

property scoring_method_metadata: dict#

Metadata asssociated with the scoring algorithm and its parameters.

Return type:

dict

class Sazonov(threshold=None)[source]#

Class for scoring data by Sazonov algorithm. See Sazonov et al. (2004) for details.

Attributes threshold (float | None): Threshold value discriminating sleep and wake epochs. Autodetected based on input data if None. Defaults to None.

Parameters:

threshold (float | None)

fit_threshold(acti_psg, thresholds=(0.001, 0.03), n_thresholds=1000, full_data=False)#

Fit a threshold that is maximazing mean correlation between PSG scorings and actigraphic scorings.

Parameters:
  • acti_psg (list[ActiPSG]) – List of objects containing actigraphic data and PSG sleep/wake scorings.

  • thresholds (Tuple[float, float], optional) – Range of thresholds to fit. Defaults to (.001, .03).

  • n_thresholds (int, optional) – Number of thresholds to fit. Defaults to 1000.

  • full_data (bool, optional) – If True, list with all correlations will be returned. If False, the maximal correlation will be returned. Defaults to False.

Returns:

List of all correlations (with corresponding thresholds) or maximal correlation.

Return type:

float | list[Tuple[float, float]]

to_score(epoched)#

Apply scoring algorithm to the input data.

Parameters:

epoched (_Epoched | GenericData) – Epoched data to be scored by the algorithm. Scoring by Cole-Kripke family requires previous epoching.

Returns:

Object containng scored data.

Return type:

ScoredShort

transmittance(n_points=2048, db=True)#

Transmittance of filter used in the algorithm. Evaluated for correct sampling frequency (as defined by given algorithm).

Parameters:
  • n_points (int, optional) – Number of point at which filter will be evaluated. Defaults to 2048.

  • db (bool, optional) – Whether to return in dB scale. Defaults to True.

Returns:

Vector of frequencies and vector of frequency responses.

Return type:

Tuple[np.ndarray, np.ndarray]

property scoring_method_metadata: dict#

Metadata asssociated with the scoring algorithm and its parameters.

Return type:

dict

class Scripps(threshold=None, rescoring=True)[source]#

Class for scoring data by Scripps Clinic algorithm. See Kripke et al. (2012) for details.

Attributes threshold (float | None): Threshold value discriminating sleep and wake epochs. Autodetected based on input data if None. Defaults to None. rescoring (bool): Whether to apply rescoring rules. Defaults to True.

Parameters:
  • threshold (float | None)

  • rescoring (bool)

fit_threshold(acti_psg, thresholds=(0.001, 0.03), n_thresholds=1000, full_data=False)#

Fit a threshold that is maximazing mean correlation between PSG scorings and actigraphic scorings.

Parameters:
  • acti_psg (list[ActiPSG]) – List of objects containing actigraphic data and PSG sleep/wake scorings.

  • thresholds (Tuple[float, float], optional) – Range of thresholds to fit. Defaults to (.001, .03).

  • n_thresholds (int, optional) – Number of thresholds to fit. Defaults to 1000.

  • full_data (bool, optional) – If True, list with all correlations will be returned. If False, the maximal correlation will be returned. Defaults to False.

Returns:

List of all correlations (with corresponding thresholds) or maximal correlation.

Return type:

float | list[Tuple[float, float]]

to_score(epoched)#

Apply scoring algorithm to the input data.

Parameters:

epoched (_Epoched | GenericData) – Epoched data to be scored by the algorithm. Scoring by Cole-Kripke family requires previous epoching.

Returns:

Object containng scored data.

Return type:

ScoredShort

transmittance(n_points=2048, db=True)#

Transmittance of filter used in the algorithm. Evaluated for correct sampling frequency (as defined by given algorithm).

Parameters:
  • n_points (int, optional) – Number of point at which filter will be evaluated. Defaults to 2048.

  • db (bool, optional) – Whether to return in dB scale. Defaults to True.

Returns:

Vector of frequencies and vector of frequency responses.

Return type:

Tuple[np.ndarray, np.ndarray]

property scoring_method_metadata: dict#

Metadata asssociated with the scoring algorithm and its parameters.

Return type:

dict

class Ucsd(threshold=None)[source]#

Class for scoring data by Sazonov algorithm. See Jean-Louis et al. (2001) for details.

Attributes threshold (float | None): Threshold value discriminating sleep and wake epochs. Autodetected based on input data if None. Defaults to None.

Parameters:

threshold (float | None)

fit_threshold(acti_psg, thresholds=(0.001, 0.03), n_thresholds=1000, full_data=False)#

Fit a threshold that is maximazing mean correlation between PSG scorings and actigraphic scorings.

Parameters:
  • acti_psg (list[ActiPSG]) – List of objects containing actigraphic data and PSG sleep/wake scorings.

  • thresholds (Tuple[float, float], optional) – Range of thresholds to fit. Defaults to (.001, .03).

  • n_thresholds (int, optional) – Number of thresholds to fit. Defaults to 1000.

  • full_data (bool, optional) – If True, list with all correlations will be returned. If False, the maximal correlation will be returned. Defaults to False.

Returns:

List of all correlations (with corresponding thresholds) or maximal correlation.

Return type:

float | list[Tuple[float, float]]

to_score(epoched)#

Apply scoring algorithm to the input data.

Parameters:

epoched (_Epoched | GenericData) – Epoched data to be scored by the algorithm. Scoring by Cole-Kripke family requires previous epoching.

Returns:

Object containng scored data.

Return type:

ScoredShort

transmittance(n_points=2048, db=True)#

Transmittance of filter used in the algorithm. Evaluated for correct sampling frequency (as defined by given algorithm).

Parameters:
  • n_points (int, optional) – Number of point at which filter will be evaluated. Defaults to 2048.

  • db (bool, optional) – Whether to return in dB scale. Defaults to True.

Returns:

Vector of frequencies and vector of frequency responses.

Return type:

Tuple[np.ndarray, np.ndarray]

property scoring_method_metadata: dict#

Metadata asssociated with the scoring algorithm and its parameters.

Return type:

dict

class Webster(threshold=None)[source]#

Class for scoring data by Sazonov algorithm. See Webster et al. (1989) for details.

Attributes threshold (float | None): Threshold value discriminating sleep and wake epochs. Autodetected based on input data if None. Defaults to None.

Parameters:

threshold (float | None)

fit_threshold(acti_psg, thresholds=(0.001, 0.03), n_thresholds=1000, full_data=False)#

Fit a threshold that is maximazing mean correlation between PSG scorings and actigraphic scorings.

Parameters:
  • acti_psg (list[ActiPSG]) – List of objects containing actigraphic data and PSG sleep/wake scorings.

  • thresholds (Tuple[float, float], optional) – Range of thresholds to fit. Defaults to (.001, .03).

  • n_thresholds (int, optional) – Number of thresholds to fit. Defaults to 1000.

  • full_data (bool, optional) – If True, list with all correlations will be returned. If False, the maximal correlation will be returned. Defaults to False.

Returns:

List of all correlations (with corresponding thresholds) or maximal correlation.

Return type:

float | list[Tuple[float, float]]

to_score(epoched)#

Apply scoring algorithm to the input data.

Parameters:

epoched (_Epoched | GenericData) – Epoched data to be scored by the algorithm. Scoring by Cole-Kripke family requires previous epoching.

Returns:

Object containng scored data.

Return type:

ScoredShort

transmittance(n_points=2048, db=True)#

Transmittance of filter used in the algorithm. Evaluated for correct sampling frequency (as defined by given algorithm).

Parameters:
  • n_points (int, optional) – Number of point at which filter will be evaluated. Defaults to 2048.

  • db (bool, optional) – Whether to return in dB scale. Defaults to True.

Returns:

Vector of frequencies and vector of frequency responses.

Return type:

Tuple[np.ndarray, np.ndarray]

property scoring_method_metadata: dict#

Metadata asssociated with the scoring algorithm and its parameters.

Return type:

dict