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

Documentation and refactoring of suite2p/detection/sparsedetect.py #1085

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ Temporary Items
.apdisk

# data
data/test_data
data/
10 changes: 8 additions & 2 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ ROI detection settings

- **spatial_scale**: (*int, default: 0*), what the optimal scale of the
recording is in pixels. if set to 0, then the algorithm determines it
automatically (recommend this on the first try). If it seems off, set it yourself to the following values:
automatically (recommend this on the first try).
If it seems off, set it yourself to the following values:
1 (=6 pixels), 2 (=12 pixels), 3 (=24 pixels), or 4 (=48 pixels).
Only used when ``sparse_mode = True``.

- **connected**: (*bool, default: True*) whether or not to require ROIs
to be fully connected (set to *0* for dendrites/boutons)
Expand All @@ -238,7 +240,9 @@ ROI detection settings
fewer ROIs will be detected, and if you set it lower, more ROIs will
be detected.

- **spatial_hp_detect**: (*int, default: 25*) window for spatial high-pass filtering for neuropil subtracation before ROI detection takes place.
- **spatial_hp_detect**: (*int, default: 25*) window size in pixel
for spatial high-pass filtering for neuropil subtracation
before ROI detection takes place.

- **max_overlap**: (*float, default: 0.75*) we allow overlapping ROIs
during cell detection. After detection, ROIs with more than
Expand All @@ -258,6 +262,8 @@ ROI detection settings
- **max_iterations**: (*int, default: 20*) how many iterations over
which to extract cells - at most ops['max_iterations'], but usually
stops before due to ops['threshold_scaling'] criterion.
For ``sparse_mode = True``, this determines the maximum number of ROIs
to be extracted: ``250 * max_iterations``.

- **nbinned**: (*int, default: 5000*) maximum number of binned frames
to use for ROI detection.
Expand Down
4 changes: 1 addition & 3 deletions suite2p/detection/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def detection_wrapper(f_reg, mov=None, yrange=None, xrange=None, ops=default_ops
ops=ops,
mov=mov,
sparse_mode=ops["sparse_mode"],
classfile=classfile,
)

ymin = int(yrange[0])
Expand Down Expand Up @@ -225,8 +224,7 @@ def detection_wrapper(f_reg, mov=None, yrange=None, xrange=None, ops=default_ops
return ops, stat


def select_rois(ops: Dict[str, Any], mov: np.ndarray, sparse_mode: bool = True,
classfile: Path = None):
def select_rois(ops: Dict[str, Any], mov: np.ndarray, sparse_mode: bool = True):

t0 = time.time()
if sparse_mode:
Expand Down
Loading