From bc4fafe49f8ab18dcb21a9d6f1d8a26e2ecd50a3 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Tue, 19 Sep 2023 11:31:47 -0700 Subject: [PATCH] Added deprecation warning to legacy scanimage extractor --- .../scanimagetiffimagingextractor.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/roiextractors/extractors/tiffimagingextractors/scanimagetiffimagingextractor.py b/src/roiextractors/extractors/tiffimagingextractors/scanimagetiffimagingextractor.py index a7827a48..6ceba254 100644 --- a/src/roiextractors/extractors/tiffimagingextractors/scanimagetiffimagingextractor.py +++ b/src/roiextractors/extractors/tiffimagingextractors/scanimagetiffimagingextractor.py @@ -305,7 +305,7 @@ def __init__( ), "All imaging extractors must have the same number of planes." -class ScanImageTiffSinglePlaneImagingExtractor(ImagingExtractor): # TODO: Remove this extractor on/after December 2023 +class ScanImageTiffSinglePlaneImagingExtractor(ImagingExtractor): """Specialized extractor for reading TIFF files produced via ScanImage.""" extractor_name = "ScanImageTiffImaging" @@ -338,12 +338,6 @@ def __init__( plane : int, optional Index of the depth plane for this extractor (default=0). """ - deprecation_message = """ - This extractor is being deprecated on or after December 2023 in favor of - ScanImageTiffMultiPlaneImagingExtractor or ScanImageTiffSinglePlaneImagingExtractor. Please use one of these - extractors instead. - """ - warn(deprecation_message, category=FutureWarning) super().__init__() self.file_path = Path(file_path) self.channel = channel @@ -356,9 +350,9 @@ def __init__( self._frames_per_slice = parsed_metadata["frames_per_slice"] self._channel_names = parsed_metadata["channel_names"] if channel >= self._num_channels: - raise ValueError(f"Channel index ({channel}) exceeds number of channels ({num_channels}).") + raise ValueError(f"Channel index ({channel}) exceeds number of channels ({self._num_channels}).") if plane >= self._num_planes: - raise ValueError(f"Plane index ({plane}) exceeds number of planes ({num_planes}).") + raise ValueError(f"Plane index ({plane}) exceeds number of planes ({self._num_planes}).") if self._frames_per_slice != 1: raise NotImplementedError( "Extractor cannot handle multiple frames per slice. Please raise an issue to request this feature: " @@ -509,7 +503,7 @@ def frame_to_raw_index(self, frame): return raw_index -class ScanImageTiffImagingExtractor(ImagingExtractor): +class ScanImageTiffImagingExtractor(ImagingExtractor): # TODO: Remove this extractor on/after December 2023 """Specialized extractor for reading TIFF files produced via ScanImage. This implementation is for legacy purposes and is not recommended for use. @@ -538,6 +532,12 @@ def __init__( sampling_frequency : float The frequency at which the frames were sampled, in Hz. """ + deprecation_message = """ + This extractor is being deprecated on or after December 2023 in favor of + ScanImageTiffMultiPlaneImagingExtractor or ScanImageTiffSinglePlaneImagingExtractor. Please use one of these + extractors instead. + """ + warn(deprecation_message, category=FutureWarning) ScanImageTiffReader = _get_scanimage_reader() super().__init__()