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

Streamline Docstrings #235

Merged
merged 39 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1ca8add
add pydocstyle to pre-commit hooks
pauladkisson Aug 22, 2023
c82ac6f
add docstrings to suite2p
pauladkisson Aug 22, 2023
d1d99e7
add docstrings to hdf5
pauladkisson Aug 23, 2023
7ea3d82
add docstrings to sima
pauladkisson Aug 23, 2023
f7998d7
added docstrings to nwbextractors
pauladkisson Aug 23, 2023
766f242
added docstrings to base segementation extractor
pauladkisson Aug 23, 2023
ab5043f
ignore missing docstrings in pre-commit (D102)
pauladkisson Aug 24, 2023
020f873
ignore missing docstrings in pre-commit (D1) and enforce numpydoc style
pauladkisson Aug 24, 2023
e9f451b
remove #noqa's
pauladkisson Aug 24, 2023
5dddabe
prototype script to find functions w/o docstrings (including inherita…
pauladkisson Aug 25, 2023
7fabffa
refactored docstring check into pytest script and moved to tests
pauladkisson Aug 30, 2023
fb49473
added docstrings to base imaging extractor
pauladkisson Aug 30, 2023
19150b2
updated imagingextractor.py docstring
pauladkisson Aug 30, 2023
c3ef801
removed redundant docstrings in suite2p
pauladkisson Aug 31, 2023
b2955f7
removed redundant docstrings in hdf5
pauladkisson Aug 31, 2023
6b21e1c
removed redundant docstrings in sima
pauladkisson Aug 31, 2023
3d631bc
removed redundant docstrings in nwb
pauladkisson Aug 31, 2023
8023d52
fixed _columns vs _num_cols bug
pauladkisson Aug 31, 2023
fa2589e
added docstrings to multiimagingextractor
pauladkisson Aug 31, 2023
09b0026
added docstrings to multisegmentationextractor
pauladkisson Aug 31, 2023
d4d380c
added docstrings to caiman
pauladkisson Aug 31, 2023
ba33b96
added docstrings to caiman
pauladkisson Aug 31, 2023
0d8e86f
added docstrings to memmap
pauladkisson Aug 31, 2023
9299281
added docstrings to miniscope
pauladkisson Aug 31, 2023
3d928a6
added docstrings to numpy
pauladkisson Aug 31, 2023
e574d8f
added docstrings to scanbox image
pauladkisson Aug 31, 2023
30f71fb
added docstring to multisegmentationextractor decorator
pauladkisson Aug 31, 2023
cf6ef62
added docstrings to EXTRACT and CNMF-E
pauladkisson Sep 1, 2023
bbb7d45
added docstrings to Tiff
pauladkisson Sep 1, 2023
b87b071
added docstrings to extraction_tools
pauladkisson Sep 5, 2023
1167d13
fixed docstring checker to ignore dataclass methods
pauladkisson Sep 5, 2023
78562a0
added docstrings to package __init__s
pauladkisson Sep 5, 2023
89b146e
fixed bug in docstring test
pauladkisson Sep 5, 2023
6a1a83f
added docstrings to toy_example
pauladkisson Sep 5, 2023
c3529d6
added docstrings to helper functions in tiffimagingextractors
pauladkisson Sep 5, 2023
295f0c1
added docstrings to testing
pauladkisson Sep 5, 2023
957c53c
added docstrings to testing
pauladkisson Sep 5, 2023
47eaa3d
TODO for mode parameter in toy_example
pauladkisson Sep 6, 2023
2769b8e
removed docstring test to simplify PR
pauladkisson Sep 7, 2023
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
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ repos:
hooks:
- id: black
exclude: ^docs/
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args:
- --convention=numpy
- --add-ignore=D1
1 change: 1 addition & 0 deletions src/roiextractors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Python-based module for extracting from, converting between, and handling recorded and optical imaging data from several file formats."""
# Keeping __version__ accessible only to maintain backcompatability.
# Modern appraoch (Python >= 3.8) is to use importlib
try:
Expand Down
12 changes: 12 additions & 0 deletions src/roiextractors/example_datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
"""Toy example ImagingExtractor and SegmentationExtractor for testing.

Modules
-------
toy_example
Create a toy example of an ImagingExtractor and a SegmentationExtractor.

Functions
---------
toy_example
Create a toy example of an ImagingExtractor and a SegmentationExtractor.
"""
from .toy_example import toy_example
43 changes: 38 additions & 5 deletions src/roiextractors/example_datasets/toy_example.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""Toy example ImagingExtractor and SegmentationExtractor for testing.

Functions
---------
toy_example
Create a toy example of an ImagingExtractor and a SegmentationExtractor.
"""
import numpy as np

from ..extractors.numpyextractors import (
Expand All @@ -7,10 +14,39 @@


def _gaussian(x, mu, sigma):
"""Compute classical gaussian with parameters x, mu, sigma."""
return 1 / np.sqrt(2 * np.pi * sigma) * np.exp(-((x - mu) ** 2) / sigma)


def _generate_rois(num_units=10, size_x=100, size_y=100, roi_size=4, min_dist=5, mode="uniform"):
"""Generate ROIs with given parameters.

Parameters
----------
num_units: int
Number of ROIs
size_x: int
Size of x dimension (pixels)
size_y: int
Size of y dimension (pixels)
roi_size: int
Siz of ROI in x and y dimension (pixels)
min_dist: int
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
Minimum distance between ROI centers (pixels)
mode: str
'uniform' or 'gaussian'.
pauladkisson marked this conversation as resolved.
Show resolved Hide resolved
If 'uniform', ROI values are uniform and equal to 1.
If 'gaussian', ROI values are gaussian modulated

Returns
-------
roi_pixels: list
List of pixel coordinates for each ROI
image: np.ndarray
Image with ROIs
means: list
List of mean coordinates for each ROI
"""
image = np.zeros((size_x, size_y))
max_iter = 1000

Expand Down Expand Up @@ -73,8 +109,7 @@ def toy_example(
decay_time=0.5,
noise_std=0.05,
):
"""
Create a toy example of an ImagingExtractor and a SegmentationExtractor.
"""Create a toy example of an ImagingExtractor and a SegmentationExtractor.

Parameters
----------
Expand All @@ -87,7 +122,7 @@ def toy_example(
size_y: int
Size of y dimension (pixels)
roi_size: int
Siz of ROI in x and y dimension (pixels)
Size of ROI in x and y dimension (pixels)
pauladkisson marked this conversation as resolved.
Show resolved Hide resolved
min_dist: int
Minimum distance between ROI centers (pixels)
mode: str
Expand All @@ -107,9 +142,7 @@ def toy_example(
The output imaging extractor
seg: NumpySegmentationExtractor
The output segmentation extractor

"""

# generate ROIs
num_rois = int(num_rois)
roi_pixels, im, means = _generate_rois(
Expand Down
Loading