yasa.hypno_str_to_int

yasa.hypno_str_to_int(hypno, mapping_dict={'art': -1, 'n1': 1, 'n2': 2, 'n3': 3, 'r': 4, 'rem': 4, 's1': 1, 's2': 2, 's3': 3, 'w': 0, 'wake': 0})[source]

Convert a string hypnogram array to integer.

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

New 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.