728x90
반응형
SMALL
수면 통계 및 단계 전환 행렬 (Sleep statistics and stage-transition matrix)
hypnogram을 사용하여 함수를 사용하여 표준 수면 통계를 계산할 수 있다. yasa.sleep_statistics() 함수에는 sf_hyp최면의 샘플링 빈도인 인수가 있다. 30초마다 하나의 값이 있으므로 샘플링 주파수는 0.3333Hz 또는 1/30Hz이다.
>>> yasa.sleep_statistics(hypno, sf_hyp=1/30)
{'TIB': 482.0,
'SPT': 468.5,
'WASO': 9.0,
'TST': 459.5,
'N1': 17.5,
'N2': 214.0,
'N3': 85.5,
'REM': 142.5,
'NREM': 317.0,
'SOL': 13.0,
'Lat_N1': 13.0,
'Lat_N2': 16.5,
'Lat_N3': 31.5,
'Lat_REM': 77.0,
'%N1': 3.808487486398259,
'%N2': 46.572361262241564,
'%N3': 18.607181719260065,
'%REM': 31.01196953210011,
'%NREM': 68.98803046789989,
'SE': 95.33195020746888,
'SME': 98.07897545357524}
yasa.transition_matrix() 또한 다음 기능 을 사용하여 수면 단계 전환 행렬을 계산할 수도 있다.
>>> counts, probs = yasa.transition_matrix(hypno)
>>> probs.round(3)
probs는 확률 전이 행렬이다. 즉, 현재 수면 단계가 A인 경우 다음 수면 단계가 B일 확률은 얼마일까?
수면 단편화의 여러 메트릭은 에서 계산할 수 있다 (probs). 예를 들어, 수면의 안정성 은 N2, N3 및 REM 수면의 대각선 값의 평균을 취하여 계산할 수 있다.
>>> import numpy as np
>>> np.diag(probs.loc[2:, 2:]).mean().round(3)
Quickstart — yasa 0.6.1 documentation
This is an introduction to YASA, geared mainly for new users. However, you’ll need to know a bit of Python, and especially scientific libraries such as NumPy and Pandas. This tutorial also assumes that you are familiar with basic sleep research and metho
raphaelvallat.com
728x90
반응형
LIST
'Somnology > YASA' 카테고리의 다른 글
[YASA] Events detection (0) | 2022.04.25 |
---|---|
[YASA] Spectral analyses (0) | 2022.04.25 |
[YASA] Data loading and preprocessing (Hypnogram) (2) (0) | 2022.04.25 |
[YASA] Data loading and preprocessing (Polysomnography data) (1) (0) | 2022.04.25 |
[YASA] Prerequisites (0) | 2022.04.25 |