yasa.hypno_upsample_to_data
-
yasa.hypno_upsample_to_data(hypno, sf_hypno, data, sf_data=None)[source] Upsample an hypnogram to a given sampling frequency and fit the resulting hypnogram to corresponding EEG data, such that the hypnogram and EEG data have the exact same number of samples.
New in version 0.1.5.
- Parameters
- hypnoarray_like
The sleep staging (hypnogram) 1D array.
- sf_hypnofloat
The current sampling frequency of the hypnogram, in Hz, e.g.
1/30 = 1 value per each 30 seconds of EEG data,
1 = 1 value per second of EEG data
- dataarray_like or
mne.io.BaseRaw 1D or 2D EEG data. Can also be a
mne.io.BaseRaw, in which casedataandsf_datawill be automatically extracted.- sf_datafloat
The sampling frequency of
data, in Hz (e.g. 100 Hz, 256 Hz, …). Can be omitted ifdatais amne.io.BaseRaw.
- Returns
- hypnoarray_like
The hypnogram, upsampled to
sf_dataand cropped/padded tomax(data.shape).
- Warns
- UserWarning
If the upsampled
hypnois shorter / longer thanmax(data.shape)and therefore needs to be padded/cropped respectively.
