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

suite2p require essential files #330

Merged
merged 2 commits into from
May 18, 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
21 changes: 16 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -29,6 +34,7 @@
* Updated zenodo to get a DOI on each release: No PR



# v0.5.7

### Features
Expand All @@ -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
Expand All @@ -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
Expand All @@ -73,6 +83,7 @@
* Fixed override of `channel_name` in `Suite2pSegmentationExtractor`. [PR #263](https://github.com/catalystneuro/roiextractors/pull/263)



# v0.5.4

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -198,13 +198,17 @@ 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
-------
The loaded .npy file.
"""
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)
Expand Down
Loading