diff --git a/yasa/hypno.py b/yasa/hypno.py index c568ddb..3e0488d 100644 --- a/yasa/hypno.py +++ b/yasa/hypno.py @@ -514,7 +514,7 @@ def as_int(self): Name: Stage, dtype: int16 """ # Return as int16 (-32768 to 32767) to reduce memory usage - return self.hypno.replace(self.mapping).astype(np.int16) + return self.hypno.map(self.mapping).astype(np.int16) def consolidate_stages(self, new_n_stages): """Reduce the number of stages in a hypnogram to match actigraphy or wearables. diff --git a/yasa/staging.py b/yasa/staging.py index 8b42705..d5ce091 100644 --- a/yasa/staging.py +++ b/yasa/staging.py @@ -190,7 +190,7 @@ def __init__(self, raw, eeg_name, *, eog_name=None, emg_name=None, metadata=None ch_names = ch_names[keep_chan].tolist() ch_types = ch_types[keep_chan].tolist() # Keep only selected channels (creating a copy of Raw) - raw_pick = raw.copy().pick_channels(ch_names, ordered=True) + raw_pick = raw.copy().pick(ch_names) # Downsample if sf != 100 assert sf > 80, "Sampling frequency must be at least 80 Hz."