yasa.hypno_str_to_int#

yasa.hypno_str_to_int(hypno, mapping_dict={'art': -1, 'mt': -1, 'n1': 1, 'n2': 2, 'n3': 3, 'nd': -2, 'r': 4, 'rem': 4, 's1': 1, 's2': 2, 's3': 3, 's4': 3, 'uns': -2, 'w': 0, 'wake': 0})#

Convert a string hypnogram array to integer.

[‘W’, ‘N2’, ‘N2’, ‘N3’, ‘R’] ==> [0, 2, 2, 3, 4]

Added in version 0.1.5.

Parameters:
hypnoarray_like

The sleep staging (hypnogram) 1D array.

mapping_dictdict

The mapping dictionnary, in lowercase. Note that this function is essentially a wrapper around pandas.Series.map.

Returns:
hypnoarray_like

The corresponding integer hypnogram.