raphaelvallat / yasa

YASA (Yet Another Spindle Algorithm): a Python package to analyze polysomnographic sleep recordings.
https://raphaelvallat.com/yasa/
BSD 3-Clause "New" or "Revised" License
428 stars 115 forks source link

AssertionError: hypno and include must have same dtype #144

Closed PhD-GOAT closed 10 months ago

PhD-GOAT commented 1 year ago

bandpower = yasa.bandpower(raw, hypno=hypno_up, include=(2, 3, 4))

https://raphaelvallat.com/yasa/build/html/quickstart.html

I got up to EEG power in specific frequency bands in your tutorial, but after that I get this error. I'm using my data, not an example.

AssertionError Traceback (most recent call last) in <cell line: 1>() ----> 1 bandpower = yasa.bandpower(raw, hypno=hypno_up, include=(0))

/usr/local/lib/python3.10/dist-packages/yasa/spectral.py in bandpower(data, sf, ch_names, hypno, include, win_sec, relative, bandpass, bands, kwargs_welch) 150 assert hypno.size == npts, "Hypno must have same size as data.shape[1]" 151 assert include.size >= 1, "include must have at least one element." --> 152 assert hypno.dtype.kind == include.dtype.kind, "hypno and include must have same dtype" 153 assert np.in1d( 154 hypno, include

raphaelvallat commented 1 year ago
bandpower = yasa.bandpower(raw, hypno=hypno_up.astype(int), include=(2, 3, 4))

should solve the issue