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

Fix Kilosort Phy reader docstrings #2022

Merged
merged 6 commits into from
Sep 21, 2023
Merged
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
46 changes: 32 additions & 14 deletions src/spikeinterface/extractors/phykilosortextractors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import annotations

from typing import Optional
from pathlib import Path

import numpy as np
Expand All @@ -13,10 +16,14 @@ class BasePhyKilosortSortingExtractor(BaseSorting):
----------
folder_path: str or Path
Path to the output Phy folder (containing the params.py)
exclude_cluster_groups: list or str, optional
exclude_cluster_groups: list or str, default: None
Cluster groups to exclude (e.g. "noise" or ["noise", "mua"]).
keep_good_only : bool, default: True
Whether to only keep good units.
remove_empty_units : bool, default: True
If True, empty units are removed from the sorting extractor.
load_all_cluster_properties : bool, default: True
If True, all cluster properties are loaded from the tsv/csv files.
"""

extractor_name = "BasePhyKilosortSorting"
Expand All @@ -29,11 +36,11 @@ class BasePhyKilosortSortingExtractor(BaseSorting):

def __init__(
self,
folder_path,
exclude_cluster_groups=None,
keep_good_only=False,
remove_empty_units=False,
load_all_cluster_properties=True,
folder_path: Path | str,
exclude_cluster_groups: Optional[list[str] | str] = None,
keep_good_only: bool = False,
remove_empty_units: bool = False,
load_all_cluster_properties: bool = True,
):
try:
import pandas as pd
Expand Down Expand Up @@ -195,20 +202,33 @@ class PhySortingExtractor(BasePhyKilosortSortingExtractor):
----------
folder_path: str or Path
Path to the output Phy folder (containing the params.py).
exclude_cluster_groups: list or str, optional
exclude_cluster_groups: list or str, default: None
Cluster groups to exclude (e.g. "noise" or ["noise", "mua"]).
load_all_cluster_properties : bool, default: True
If True, all cluster properties are loaded from the tsv/csv files.

Returns
-------
extractor : PhySortingExtractor
The loaded data.
The loaded Sorting object.
"""

extractor_name = "PhySorting"
name = "phy"

def __init__(self, folder_path, exclude_cluster_groups=None):
BasePhyKilosortSortingExtractor.__init__(self, folder_path, exclude_cluster_groups, keep_good_only=False)
def __init__(
self,
folder_path: Path | str,
exclude_cluster_groups: Optional[list[str] | str] = None,
load_all_cluster_properties: bool = True,
):
BasePhyKilosortSortingExtractor.__init__(
self,
folder_path,
exclude_cluster_groups,
keep_good_only=False,
load_all_cluster_properties=load_all_cluster_properties,
)

self._kwargs = {
"folder_path": str(Path(folder_path).absolute()),
Expand All @@ -223,8 +243,6 @@ class KiloSortSortingExtractor(BasePhyKilosortSortingExtractor):
----------
folder_path: str or Path
Path to the output Phy folder (containing the params.py).
exclude_cluster_groups: list or str, optional
Cluster groups to exclude (e.g. "noise" or ["noise", "mua"]).
keep_good_only : bool, default: True
Whether to only keep good units.
If True, only Kilosort-labeled 'good' units are returned.
Expand All @@ -234,13 +252,13 @@ class KiloSortSortingExtractor(BasePhyKilosortSortingExtractor):
Returns
-------
extractor : KiloSortSortingExtractor
The loaded data.
The loaded Sorting object.
"""

extractor_name = "KiloSortSorting"
name = "kilosort"

def __init__(self, folder_path, keep_good_only=False, remove_empty_units=True):
def __init__(self, folder_path: Path | str, keep_good_only: bool = False, remove_empty_units: bool = True):
BasePhyKilosortSortingExtractor.__init__(
self,
folder_path,
Expand Down