Closed matiasandina closed 2 years ago
Hi @matiasandina,
Thanks for opening the issue. Great point. I think that a quick and dirty fix is just to divide your Raw data by 1e6, e.g. raw._data /= 1e6
(I haven't tested this).
In the long term, you're right that we need a better solution. As a matter of fact, mne.Raw.get_data() now has an units
parameter that will automatically do the conversion, if needed:
raw.get_data(units="uV")
TODO for next release of YASA
raw.get_data(units="uV")
everywhere
I am working with a
np.array
that I convert tomne.raw
to pass toSleepStaging()
. I was getting huge power values and I traced it back to this line:https://github.com/raphaelvallat/yasa/blob/71c0a8245c61b328a82ab1197c34b673333120a3/yasa/staging.py#L200
In the comments for
SleepStaging()
, you haveThe data that I am entering is in microvolts, and the transformation to
raw
is not affecting thatThe
sls
object has the scaled data storedIf I calculate the spectrum by hand, I obtain the same result either using the
eeg
object or theraw_array.get_data()
, but if I use the* 1e6
factor I get an obviously large number.Should there be a way to indicate to
SleepStaging()
that it shouldn't rescale the data ? I am thinkingThis issue might or might not be there for the other bands because the default behavior is:
But if I understand the code correctly, it might be also calculating a scaled spectrum and then doing the relative scaling back.