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

Deprecate get_number_of_channels #392

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Deprecations
* The 'channel' parameter in get_frames() and get_video() methods is deprecated and will be removed in August 2025. [#388](https://github.com/catalystneuro/roiextractors/pull/388)
* Removed get_num_channels from the ImagingExtractor abstract class. Implementations remain in concrete classes. [#392](https://github.com/catalystneuro/roiextractors/pull/392)

### Improvements
* Use `pyproject.toml` for project metadata and installation requirements [#382](https://github.com/catalystneuro/roiextractors/pull/382)
Expand Down
16 changes: 16 additions & 0 deletions src/roiextractors/extractors/memmapextractors/memmapextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ def get_channel_names(self):
pass

def get_num_channels(self) -> int:
"""Get the total number of active channels in the recording.

Returns
-------
num_channels: int
Integer count of number of channels.

Deprecated
----------
This method will be removed in or after August 2025.
"""
warn(
"get_num_channels() is deprecated and will be removed in or after August 2025.",
DeprecationWarning,
stacklevel=2,
)
return self._num_channels

def get_dtype(self) -> DtypeType:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,22 @@ def get_sampling_frequency(self):
return self._sampling_frequency

def get_num_channels(self):
"""Get the total number of active channels in the recording.

Returns
-------
num_channels: int
Integer count of number of channels.

Deprecated
----------
This method will be removed in or after August 2025.
"""
warn(
"get_num_channels() is deprecated and will be removed in or after August 2025.",
DeprecationWarning,
stacklevel=2,
)
return self._num_channels

def get_channel_names(self):
Expand Down
27 changes: 16 additions & 11 deletions src/roiextractors/imagingextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,6 @@ def get_channel_names(self) -> list:
"""
pass

@abstractmethod
def get_num_channels(self) -> int:
"""Get the total number of active channels in the recording.

Returns
-------
num_channels: int
Integer count of number of channels.
"""
pass

def get_dtype(self) -> DtypeType:
"""Get the data type of the video.

Expand Down Expand Up @@ -357,4 +346,20 @@ def get_channel_names(self) -> list:
return self._parent_imaging.get_channel_names()

def get_num_channels(self) -> int:
"""Get the total number of active channels in the recording.

Returns
-------
num_channels: int
Integer count of number of channels.

Deprecated
----------
This method will be removed in or after August 2025.
"""
warnings.warn(
"get_num_channels() is deprecated and will be removed in or after August 2025.",
DeprecationWarning,
stacklevel=2,
)
return self._parent_imaging.get_num_channels()
16 changes: 16 additions & 0 deletions src/roiextractors/multiimagingextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,20 @@ def get_channel_names(self) -> list:
return self._imaging_extractors[0].get_channel_names()

def get_num_channels(self) -> int:
"""Get the total number of active channels in the recording.

Returns
-------
num_channels: int
Integer count of number of channels.

Deprecated
----------
This method will be removed in or after August 2025.
"""
warnings.warn(
"get_num_channels() is deprecated and will be removed in or after August 2025.",
DeprecationWarning,
stacklevel=2,
)
return self._imaging_extractors[0].get_num_channels()
17 changes: 17 additions & 0 deletions src/roiextractors/volumetricimagingextractor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Base class definition for volumetric imaging extractors."""

from typing import Tuple, List, Iterable, Optional
import warnings
import numpy as np

from .extraction_tools import ArrayType, DtypeType
Expand Down Expand Up @@ -164,6 +165,22 @@ def get_channel_names(self) -> list:
return self._imaging_extractors[0].get_channel_names()

def get_num_channels(self) -> int:
"""Get the total number of active channels in the recording.

Returns
-------
num_channels: int
Integer count of number of channels.

Deprecated
----------
This method will be removed in or after August 2025.
"""
warnings.warn(
"get_num_channels() is deprecated and will be removed in or after August 2025.",
DeprecationWarning,
stacklevel=2,
)
return self._imaging_extractors[0].get_num_channels()

def get_dtype(self) -> DtypeType:
Expand Down
Loading