Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated deprecated functions #167

Merged
merged 2 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yasa/hypno.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,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.cat.rename_categories(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.
Expand Down
2 changes: 1 addition & 1 deletion yasa/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def plot_spectrogram(

if hypno is not None:
# Convert sampling frequency to pandas timefrequency string (e.g., "30s")
freq_str = pd.tseries.frequencies.to_offset(pd.Timedelta(1 / sf, "S")).freqstr
freq_str = pd.tseries.frequencies.to_offset(pd.Timedelta(1 / sf, "s")).freqstr
# Create Hypnogram instance for plotting
hyp = Hypnogram(hypno_int_to_str(hypno), freq=freq_str)
hypnoplot_kwargs = dict(lw=1.5, fill_color=None)
Expand Down
Loading