Skip to content

Commit

Permalink
also use 'rate' attr from f['samples']
Browse files Browse the repository at this point in the history
  • Loading branch information
postpop committed Sep 22, 2023
1 parent c7b71c0 commit 2628adc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/xarray_behave/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""xarray tools for behavioral data."""
__version__ = "0.33.27"
__version__ = "0.33.28"

from .xarray_behave import assemble, assemble_metrics, load, save
import os
Expand Down
5 changes: 5 additions & 0 deletions src/xarray_behave/io/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ def load(
if return_nonsong_channels:
non_song_channels = list(set(list(range(nb_channels))) - set(song_channels))
non_song = da[:, non_song_channels]

if "rate" in f.attrs:
samplerate = f.attrs["rate"]
elif "rate" in f["samples"].attrs:
samplerate = f["samples"].attrs["rate"]
else:
logger.info(" No sampling rate information in daq.h5 file - setting samplerate to default 10_000Hz.")
samplerate = 10_000
Expand All @@ -101,6 +104,8 @@ def load(

if "rate" in f.attrs:
samplerate = f.attrs["rate"]
elif "rate" in f["samples"].attrs:
samplerate = f["samples"].attrs["rate"]
else:
logger.info(" No sampling rate information in daq.h5 file - setting samplerate to default 10_000Hz.")
samplerate = 10_000
Expand Down

0 comments on commit 2628adc

Please sign in to comment.