Source code for neuroconv.datainterfaces.ophys.cnmfe.cnmfedatainterface
import warnings
from pydantic import FilePath
from ..basesegmentationextractorinterface import BaseSegmentationExtractorInterface
[docs]
class CnmfeSegmentationInterface(BaseSegmentationExtractorInterface):
"""Data interface for constrained non-negative matrix factorization (CNMFE) segmentation extractor."""
display_name = "CNMFE Segmentation"
associated_suffixes = (".mat",)
info = "Interface for constrained non-negative matrix factorization (CNMFE) segmentation."
def __init__(
self, file_path: FilePath, *args, verbose: bool = False
): # TODO: change to * (keyword only) on or after August 2026
# Handle deprecated positional arguments
if args:
parameter_names = [
"verbose",
]
num_positional_args_before_args = 1 # file_path
if len(args) > len(parameter_names):
raise TypeError(
f"__init__() takes at most {len(parameter_names) + num_positional_args_before_args + 1} positional arguments but "
f"{len(args) + num_positional_args_before_args + 1} were given. "
"Note: Positional arguments are deprecated and will be removed on or after August 2026. "
"Please use keyword arguments."
)
positional_values = dict(zip(parameter_names, args))
passed_as_positional = list(positional_values.keys())
warnings.warn(
f"Passing arguments positionally to CnmfeSegmentationInterface.__init__() is deprecated "
f"and will be removed on or after August 2026. "
f"The following arguments were passed positionally: {passed_as_positional}. "
"Please use keyword arguments instead.",
FutureWarning,
stacklevel=2,
)
verbose = positional_values.get("verbose", verbose)
super().__init__(file_path=file_path)
self.verbose = verbose