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

Add is_filtered to annotations in binary.json #3245

Merged
merged 8 commits into from
Sep 11, 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
1 change: 1 addition & 0 deletions src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ def _save(self, format="binary", verbose: bool = False, **save_kwargs):
channel_ids=self.get_channel_ids(),
time_axis=0,
file_offset=0,
is_filtered=self.is_filtered(),
gain_to_uV=self.get_channel_gains(),
offset_to_uV=self.get_channel_offsets(),
)
Expand Down
4 changes: 3 additions & 1 deletion src/spikeinterface/core/binaryrecordingextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ def __init__(
num_chan=None,
):
# This assigns num_channels if num_channels is not None, otherwise num_chan is assigned
# num_chan needs to be be kept for backward compatibility but should not be used by the
# end user
num_channels = num_channels or num_chan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zm711 unfortunately, I think we need to keep this. This is not only a deprecation for a current version, but it allows to load recordings that were saved with old versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le'ts get rid of the deprecation comment then and switch it to "needed for backward compatiblity"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

assert num_channels is not None, "You must provide num_channels or num_chan"
if num_chan is not None:
warnings.warn("`num_chan` is to be deprecated in version 0.100, please use `num_channels` instead")
warnings.warn("`num_chan` is to be deprecated as of version 0.100, please use `num_channels` instead")

if channel_ids is None:
channel_ids = list(range(num_channels))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def test_sequential_reading_of_small_traces(folder_with_binary_files):
dtype = "float32"

file_paths = [folder / "traces_cached_seg0.raw"]
# `num_chan` is kept for backward compatibility so including it at least one test
# run is good to ensure that it is appropriately accepted as an argument
recording = BinaryRecordingExtractor(
num_chan=num_channels,
file_paths=file_paths,
Expand Down
Loading