diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e62a546..74086f63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,28 @@ -# Upcoming (v0.6.0) +# Upcoming (v0.5.9) -### Back-compatibility break +### Deprecations -* Remove support for Python 3.8 [PR #325](https://github.com/catalystneuro/roiextractors/pull/325) +* Remove support for Python 3.8: [PR #325](https://github.com/catalystneuro/roiextractors/pull/325) ### Features -* Add InscopixImagingExtractor [#276](https://github.com/catalystneuro/roiextractors/pull/276) +* Add InscopixImagingExtractor: [#276](https://github.com/catalystneuro/roiextractors/pull/276) * Updated testing workflows to include python 3.12, m1/intel macos, and dev tests to check neuroconv: [PR #317](https://github.com/catalystneuro/roiextractors/pull/317) ### Fixes -* Remove unecessary scipy import error handling [#315](https://github.com/catalystneuro/roiextractors/pull/315) +* Remove unecessary scipy import error handling: [#315](https://github.com/catalystneuro/roiextractors/pull/315) + +### Improvements +- The `Suite2PSegmentationExtractor` now produces an error when a required sub-file is missin: [#330](https://github.com/catalystneuro/roiextractors/pull/330) ### Testing * Updated testing workflows to include python 3.12, m1/intel macos, and dev tests to check neuroconv: [PR #317](https://github.com/catalystneuro/roiextractors/pull/317) * Added daily testing workflow and fixed bug with python 3.12 by upgrading scanimage-tiff-reader version: [PR #321](https://github.com/catalystneuro/roiextractors/pull/321) + + # v0.5.8 ### Fixes @@ -29,6 +34,7 @@ * Updated zenodo to get a DOI on each release: No PR + # v0.5.7 ### Features @@ -51,6 +57,8 @@ * Fixed a bug with `ScanImageTiffSinglePlaneImagingExtractor` in which `frames_per_slice` would be set to `_num_frames`: [PR #294](https://github.com/catalystneuro/roiextractors/pull/294) + + # v0.5.6 ### Features @@ -61,6 +69,8 @@ * Updated documentation and Readme PRs: [#283](https://github.com/catalystneuro/roiextractors/pull/283) [#282](https://github.com/catalystneuro/roiextractors/pull/282) [#280](https://github.com/catalystneuro/roiextractors/pull/280) + + # v0.5.5 ### Features @@ -73,6 +83,7 @@ * Fixed override of `channel_name` in `Suite2pSegmentationExtractor`. [PR #263](https://github.com/catalystneuro/roiextractors/pull/263) + # v0.5.4 ### Features diff --git a/src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py b/src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py index cfbd6570..3df8c130 100644 --- a/src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py +++ b/src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py @@ -57,7 +57,7 @@ def get_available_planes(cls, folder_path: PathType): Parameters ---------- - file_path : PathType + folder_path : PathType Path to Suite2p output path. Returns @@ -150,13 +150,13 @@ def __init__( self.folder_path = Path(folder_path) - options = self._load_npy(file_name="ops.npy") - self.options = options.item() if options is not None else options + options = self._load_npy(file_name="ops.npy", require=True) + self.options = options.item() self._sampling_frequency = self.options["fs"] self._num_frames = self.options["nframes"] self._image_size = (self.options["Ly"], self.options["Lx"]) - self.stat = self._load_npy(file_name="stat.npy") + self.stat = self._load_npy(file_name="stat.npy", require=True) fluorescence_traces_file_name = "F.npy" if channel_name == "chan1" else "F_chan2.npy" neuropil_traces_file_name = "Fneu.npy" if channel_name == "chan1" else "Fneu_chan2.npy" @@ -187,7 +187,7 @@ def __init__( self.get_image_size(), ) - def _load_npy(self, file_name: str, mmap_mode=None, transpose: bool = False): + def _load_npy(self, file_name: str, mmap_mode=None, transpose: bool = False, require: bool = False): """Load a .npy file with specified filename. Returns None if file is missing. Parameters @@ -198,6 +198,8 @@ def _load_npy(self, file_name: str, mmap_mode=None, transpose: bool = False): The mode to use for memory mapping. See numpy.load for details. transpose: bool, optional Whether to transpose the loaded array. + require: bool, optional + Whether to raise an error if the file is missing. Returns ------- @@ -205,6 +207,8 @@ def _load_npy(self, file_name: str, mmap_mode=None, transpose: bool = False): """ file_path = self.folder_path / self.plane_name / file_name if not file_path.exists(): + if require: + raise FileNotFoundError(f"File {file_path} not found.") return data = np.load(file_path, mmap_mode=mmap_mode, allow_pickle=mmap_mode is None)