DARTsort 0.5.17__tar.gz → 0.5.19__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dartsort-0.5.17 → dartsort-0.5.19}/PKG-INFO +39 -40
- {dartsort-0.5.17 → dartsort-0.5.19}/README.md +38 -39
- {dartsort-0.5.17 → dartsort-0.5.19}/docs/index.md +38 -39
- {dartsort-0.5.17 → dartsort-0.5.19}/pyproject.toml +1 -1
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/__init__.py +7 -2
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/mixture.py +6 -4
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/config.py +5 -7
- dartsort-0.5.19/src/dartsort/detect/__init__.py +3 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/detect/detect.py +115 -7
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/main.py +32 -18
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/grab.py +0 -1
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/matching.py +20 -141
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/matching_util/compressed_upsampled.py +22 -203
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/matching_util/drifty.py +10 -23
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/matching_util/matching_base.py +211 -74
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/peel_base.py +9 -10
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/peel_lib.py +43 -133
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/subtract.py +1 -7
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/threshold.py +0 -2
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/_multichan_denoiser_kit.py +24 -5
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/amortized_localization.py +7 -2
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/decollider.py +14 -1
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/mixture_classifier.py +4 -1
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/data_util.py +175 -86
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/internal_config.py +12 -26
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/main_util.py +50 -14
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/noise_util.py +0 -150
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/peel_util.py +8 -3
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/preprocess_util.py +49 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/spiketorch.py +29 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/testing_util/matching_debug_util.py +14 -23
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/analysis_plots.py +0 -5
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/mixture.py +24 -7
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/unit.py +0 -1
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/vismain.py +11 -1
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort.egg-info/PKG-INFO +39 -40
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort.egg-info/SOURCES.txt +0 -2
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_alignment.py +6 -8
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_dartsort.py +11 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_data_util.py +1 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_detect.py +6 -12
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_matching.py +1 -3
- dartsort-0.5.17/src/dartsort/clustering/modes.py +0 -173
- dartsort-0.5.17/src/dartsort/detect/__init__.py +0 -3
- dartsort-0.5.17/src/dartsort/detect/detect_filters.py +0 -36
- {dartsort-0.5.17 → dartsort-0.5.19}/.github/workflows/ci.yml +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/.github/workflows/ci_windows.yml +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/.github/workflows/deploy.yml +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/.github/workflows/docs.yml +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/.gitignore +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/docs/main_api.md +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/docs/toolkit_api.md +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/environment.yml +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/notebook/.keep +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/notebook/ibl_dandi_example.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/setup.cfg +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/cli.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/agglomerate.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/cluster_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/clustering.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/clustering_features.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/density.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/forward_backward.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/kmeans.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/merge.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/clustering/refine_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/evaluate/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/evaluate/analysis.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/evaluate/comparison.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/evaluate/hybrid_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/evaluate/noise_recording_tools.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/evaluate/sim_template_tools.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/evaluate/simkit.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/evaluate/simlib.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/localize/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/localize/localize_torch.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/localize/localize_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/matching_util/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/matching_util/pairwise.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/reduction_template.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/peel/shaver.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/detect_np1.pt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/detect_np2.pt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/glasbey1024.npz +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/templates/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/templates/get_templates.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/templates/postprocess_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/templates/realignment.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/templates/template_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/templates/templates.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/templates/templib.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/all_transformers.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/amplitudes.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/denoising_scorer.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/enforce_decrease.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/fixed_prop.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/interp.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/localize.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/matching_denoiser.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/pipeline.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/reduction.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/single_channel_denoiser.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/supervised_denoiser.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/temporal_pca.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/transform_base.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/transform/whiten.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/cli_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/drift_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/interpolation_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/job_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/logging_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/more_operators.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/motion.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/multiprocessing_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/nn_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/py_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/registration_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/residual_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/sparse_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/spikeio.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/testing_util/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/torch_optimization_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/torch_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/util/waveform_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/__init__.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/colors.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/gt.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/layout.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/metrics_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/recanim.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/scatterplots.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/sorting.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/unit_comparison.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/versus.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort/vis/waveforms.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort.egg-info/dependency_links.txt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort.egg-info/entry_points.txt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort.egg-info/requires.txt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/src/dartsort.egg-info/top_level.txt +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/conftest.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_agglomerate.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_cluster_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_clustering.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_config.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_density.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_drift_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_drifty_matching.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_enforce_decrease.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_grab_and_featurize.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_kmeans.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_linalg.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_localize_torch.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_mixture_classifier.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_modeling.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_simkit.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_spiketorch.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_subtract.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_templates.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_threshold.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_torch_optimization_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_transform.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/tests/test_waveform_util.py +0 -0
- {dartsort-0.5.17 → dartsort-0.5.19}/zensical.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dartsort
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.19
|
|
4
4
|
Summary: DARTsort
|
|
5
5
|
Author-email: Charlie Windolf <ciw2048@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/cwindolf/dartsort
|
|
@@ -49,25 +49,21 @@ Requires-Dist: matplotlib-venn; extra == "vis"
|
|
|
49
49
|
[](https://doi.org/10.5281/zenodo.16943074)
|
|
50
50
|
[](https://pypi.org/p/dartsort)
|
|
51
51
|
|
|
52
|
-
|
|
53
52
|
# dartsort
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
*dartsort* is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
|
|
54
|
+
_dartsort_ is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
|
|
57
55
|
It is also a toolkit of modules for building spike sorters and other analyses of electrophysiology data.
|
|
58
56
|
|
|
59
|
-
|
|
60
57
|
## :warning: work in progress :warning:
|
|
61
58
|
|
|
62
59
|
We do not currently recommend DARTsort for production spike sorting purposes.
|
|
63
60
|
Please feel free to open an issue or a discussion if you run into problems.
|
|
64
61
|
|
|
65
|
-
|
|
66
62
|
## Installation
|
|
67
63
|
|
|
68
64
|
### Installing into an existing environment
|
|
69
65
|
|
|
70
|
-
If you already have a Python environment with PyTorch working and you just want to install
|
|
66
|
+
If you already have a Python environment with PyTorch working and you just want to install _dartsort_ there, use
|
|
71
67
|
|
|
72
68
|
```sh
|
|
73
69
|
$ pip install dartsort
|
|
@@ -81,30 +77,33 @@ If you need to set up Python or PyTorch, I find that a [`conda-forge`](https://c
|
|
|
81
77
|
|
|
82
78
|
You can use `conda-forge` to install Python, `dartsort`, and its dependencies as follows:
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
- Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
|
|
81
|
+
- Create an environment with
|
|
86
82
|
```sh
|
|
87
83
|
$ mamba env create -f environment.yml
|
|
88
84
|
```
|
|
89
85
|
This will create an environment called `dartsort`, but you can change the name by adding `-n othername`.
|
|
90
|
-
|
|
86
|
+
- Activate the environment:
|
|
91
87
|
```sh
|
|
92
88
|
$ mamba activate dartsort
|
|
93
89
|
```
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
- Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
|
|
96
91
|
|
|
97
92
|
## Usage
|
|
98
93
|
|
|
94
|
+
**Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
|
|
95
|
+
In particular, you will most likely need to set the `preprocessing` flag.
|
|
96
|
+
|
|
99
97
|
For more detailed documentation of the main function parameters and configuration options, see the [main API documentation](main_api.md).
|
|
100
98
|
|
|
101
99
|
### As a Python function
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
_dartsort_ can be run in Python with (for example):
|
|
104
102
|
|
|
105
103
|
```python
|
|
106
104
|
import dartsort
|
|
107
105
|
|
|
106
|
+
# if the default settings make sense for you...
|
|
108
107
|
dartsort.dartsort(recording, output_dir)
|
|
109
108
|
|
|
110
109
|
# or, to set configuration options, something like...
|
|
@@ -114,52 +113,53 @@ dartsort_result = dartsort.dartsort(
|
|
|
114
113
|
cfg=dartsort.DARTsortUserConfig(
|
|
115
114
|
preprocessing="ibllike",
|
|
116
115
|
work_in_tmpdir=True,
|
|
117
|
-
copy_recording_to_tmpdir=
|
|
116
|
+
copy_recording_to_tmpdir="yes",
|
|
118
117
|
),
|
|
119
118
|
)
|
|
120
119
|
```
|
|
121
120
|
|
|
122
|
-
**Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
|
|
123
|
-
Some of them, like `preprocessing`, are not set by default and need your input!
|
|
124
|
-
(This will probably change.)
|
|
125
|
-
|
|
126
121
|
Here, `recording` is a [SpikeInterface][SpikeInterface] recording object (see their tutorial on [reading various recording formats](https://spikeinterface.readthedocs.io/en/stable/how_to/read_various_formats.html)).
|
|
127
|
-
`output_dir` is the folder where
|
|
122
|
+
`output_dir` is the folder where _dartsort_ will save its output.
|
|
128
123
|
There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
|
|
129
124
|
|
|
130
|
-
Once you've run
|
|
125
|
+
Once you've run _dartsort_, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
|
|
131
126
|
|
|
132
127
|
### Important configuration details
|
|
133
128
|
|
|
134
|
-
Before running
|
|
129
|
+
Before running _dartsort_, please be aware of the following important configuration options.
|
|
135
130
|
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
- `preprocessing`: _dartsort_ doesn't preprocess your data by default (for now, `preprocessing="none"` by default), but this will change.
|
|
132
|
+
- An easy choice is `preprocessing="ibllikecmr"`, which is a lightweight version of [the IBL's strategy][iblsorting], replacing their highpass spatial filter with a common median reference.
|
|
133
|
+
- If you've already preprocessed your data, use `"none"` instead, or `"standardize"` if your preprocessing did not include a standardization step.
|
|
134
|
+
- An implementation of the full IBL strategy is available as `"ibllike"`.
|
|
135
|
+
- The `copy_recording_to_tmpdir` controls whether the recording is copied to a scratch directory for faster reading. It can be `True`, `False`, or `"if_preprocessing"` (the default). By default the recording is cached if `preprocessing` is something other than `"none"`.
|
|
136
|
+
- (The `tmpdir_parent` flag controls the scratch dir, which is your computer's default temporary folder if this is unset.)
|
|
137
|
+
- `do_motion_estimation=True` by default, but you may like to disable it if you know that there is (say) less than 5 microns of total drift in your recording, or if you have handled this in your own preprocessing.
|
|
138
|
+
- `work_in_tmpdir` can be helpful in some cases where slow network drives are involved.
|
|
140
139
|
|
|
141
140
|
### Outputs and exporting
|
|
142
141
|
|
|
143
142
|
The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
|
|
144
143
|
This object has all the spike train data attached (as arrays under property names `.times_samples` and `.times_seconds` for spike times in samples and seconds, `.labels` for unit labels, and many others; `print(sorting)` to see some more).
|
|
145
144
|
|
|
146
|
-
If you already ran
|
|
145
|
+
If you already ran _dartsort_ and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
|
|
147
146
|
|
|
148
147
|
This object can also export itself to other formats:
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
- For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
|
|
150
|
+
- For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
|
|
151
|
+
- To export to Phy, we currently suggest bridging through SpikeInterface. Start with `sorting.to_numpy_sorting()` and follow the instructions [in SpikeInterface's documentation](https://spikeinterface.readthedocs.io/en/stable/modules/exporters.html#exporting-to-phy) for first creating a `SortingAnalyzer` and then exporting that to Phy.
|
|
152
|
+
- For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
|
|
153
|
+
- For pandas, use `sorting.to_pandas()`.
|
|
155
154
|
|
|
156
|
-
|
|
155
|
+
_dartsort_ also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
|
|
157
156
|
|
|
158
157
|
The data is saved to `output_dir` in the following files:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
|
|
159
|
+
- `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
|
|
160
|
+
- `matching1.h5`: This HDF5 file contains spike features and other data from the last matching step. Amplitudes, localizations, and other features live in here; use `h5ls` on the command line to see what's in there. Be aware that the `labels` dataset in this HDF5 is not the same as what's saved in the `dartsort_sorting.npz`.
|
|
161
|
+
- `motion_info.pkl` is a pickled `MotionInfo` object.
|
|
162
|
+
- There may be a models/ folder containing PyTorch weights files with modeling quantities (for instance, featurization SVD bases, localization neural nets, Gaussian mixture model parameters). If you want to load these up, feel free to reach out for help.
|
|
163
163
|
|
|
164
164
|
### Visualization
|
|
165
165
|
|
|
@@ -190,7 +190,7 @@ Set `make_unit_summaries=True` to create a summary plot for each unit.
|
|
|
190
190
|
|
|
191
191
|
### Command-line interface
|
|
192
192
|
|
|
193
|
-
Try running
|
|
193
|
+
Try running
|
|
194
194
|
|
|
195
195
|
```sh
|
|
196
196
|
$ dartsort -h
|
|
@@ -206,9 +206,8 @@ If it's more of a data-related or methodology thing, feel free to use the email
|
|
|
206
206
|
|
|
207
207
|
## References
|
|
208
208
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
- [SpikeInterface][SpikeInterface]
|
|
210
|
+
- DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
|
|
212
211
|
|
|
213
212
|
[SpikeInterface]: https://spikeinterface.readthedocs.io
|
|
214
213
|
[iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
|
|
@@ -6,25 +6,21 @@
|
|
|
6
6
|
[](https://doi.org/10.5281/zenodo.16943074)
|
|
7
7
|
[](https://pypi.org/p/dartsort)
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
# dartsort
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
*dartsort* is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
|
|
11
|
+
_dartsort_ is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
|
|
14
12
|
It is also a toolkit of modules for building spike sorters and other analyses of electrophysiology data.
|
|
15
13
|
|
|
16
|
-
|
|
17
14
|
## :warning: work in progress :warning:
|
|
18
15
|
|
|
19
16
|
We do not currently recommend DARTsort for production spike sorting purposes.
|
|
20
17
|
Please feel free to open an issue or a discussion if you run into problems.
|
|
21
18
|
|
|
22
|
-
|
|
23
19
|
## Installation
|
|
24
20
|
|
|
25
21
|
### Installing into an existing environment
|
|
26
22
|
|
|
27
|
-
If you already have a Python environment with PyTorch working and you just want to install
|
|
23
|
+
If you already have a Python environment with PyTorch working and you just want to install _dartsort_ there, use
|
|
28
24
|
|
|
29
25
|
```sh
|
|
30
26
|
$ pip install dartsort
|
|
@@ -38,30 +34,33 @@ If you need to set up Python or PyTorch, I find that a [`conda-forge`](https://c
|
|
|
38
34
|
|
|
39
35
|
You can use `conda-forge` to install Python, `dartsort`, and its dependencies as follows:
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
- Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
|
|
38
|
+
- Create an environment with
|
|
43
39
|
```sh
|
|
44
40
|
$ mamba env create -f environment.yml
|
|
45
41
|
```
|
|
46
42
|
This will create an environment called `dartsort`, but you can change the name by adding `-n othername`.
|
|
47
|
-
|
|
43
|
+
- Activate the environment:
|
|
48
44
|
```sh
|
|
49
45
|
$ mamba activate dartsort
|
|
50
46
|
```
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
- Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
|
|
53
48
|
|
|
54
49
|
## Usage
|
|
55
50
|
|
|
51
|
+
**Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
|
|
52
|
+
In particular, you will most likely need to set the `preprocessing` flag.
|
|
53
|
+
|
|
56
54
|
For more detailed documentation of the main function parameters and configuration options, see the [main API documentation](main_api.md).
|
|
57
55
|
|
|
58
56
|
### As a Python function
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
_dartsort_ can be run in Python with (for example):
|
|
61
59
|
|
|
62
60
|
```python
|
|
63
61
|
import dartsort
|
|
64
62
|
|
|
63
|
+
# if the default settings make sense for you...
|
|
65
64
|
dartsort.dartsort(recording, output_dir)
|
|
66
65
|
|
|
67
66
|
# or, to set configuration options, something like...
|
|
@@ -71,52 +70,53 @@ dartsort_result = dartsort.dartsort(
|
|
|
71
70
|
cfg=dartsort.DARTsortUserConfig(
|
|
72
71
|
preprocessing="ibllike",
|
|
73
72
|
work_in_tmpdir=True,
|
|
74
|
-
copy_recording_to_tmpdir=
|
|
73
|
+
copy_recording_to_tmpdir="yes",
|
|
75
74
|
),
|
|
76
75
|
)
|
|
77
76
|
```
|
|
78
77
|
|
|
79
|
-
**Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
|
|
80
|
-
Some of them, like `preprocessing`, are not set by default and need your input!
|
|
81
|
-
(This will probably change.)
|
|
82
|
-
|
|
83
78
|
Here, `recording` is a [SpikeInterface][SpikeInterface] recording object (see their tutorial on [reading various recording formats](https://spikeinterface.readthedocs.io/en/stable/how_to/read_various_formats.html)).
|
|
84
|
-
`output_dir` is the folder where
|
|
79
|
+
`output_dir` is the folder where _dartsort_ will save its output.
|
|
85
80
|
There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
|
|
86
81
|
|
|
87
|
-
Once you've run
|
|
82
|
+
Once you've run _dartsort_, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
|
|
88
83
|
|
|
89
84
|
### Important configuration details
|
|
90
85
|
|
|
91
|
-
Before running
|
|
86
|
+
Before running _dartsort_, please be aware of the following important configuration options.
|
|
92
87
|
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
- `preprocessing`: _dartsort_ doesn't preprocess your data by default (for now, `preprocessing="none"` by default), but this will change.
|
|
89
|
+
- An easy choice is `preprocessing="ibllikecmr"`, which is a lightweight version of [the IBL's strategy][iblsorting], replacing their highpass spatial filter with a common median reference.
|
|
90
|
+
- If you've already preprocessed your data, use `"none"` instead, or `"standardize"` if your preprocessing did not include a standardization step.
|
|
91
|
+
- An implementation of the full IBL strategy is available as `"ibllike"`.
|
|
92
|
+
- The `copy_recording_to_tmpdir` controls whether the recording is copied to a scratch directory for faster reading. It can be `True`, `False`, or `"if_preprocessing"` (the default). By default the recording is cached if `preprocessing` is something other than `"none"`.
|
|
93
|
+
- (The `tmpdir_parent` flag controls the scratch dir, which is your computer's default temporary folder if this is unset.)
|
|
94
|
+
- `do_motion_estimation=True` by default, but you may like to disable it if you know that there is (say) less than 5 microns of total drift in your recording, or if you have handled this in your own preprocessing.
|
|
95
|
+
- `work_in_tmpdir` can be helpful in some cases where slow network drives are involved.
|
|
97
96
|
|
|
98
97
|
### Outputs and exporting
|
|
99
98
|
|
|
100
99
|
The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
|
|
101
100
|
This object has all the spike train data attached (as arrays under property names `.times_samples` and `.times_seconds` for spike times in samples and seconds, `.labels` for unit labels, and many others; `print(sorting)` to see some more).
|
|
102
101
|
|
|
103
|
-
If you already ran
|
|
102
|
+
If you already ran _dartsort_ and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
|
|
104
103
|
|
|
105
104
|
This object can also export itself to other formats:
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
- For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
|
|
107
|
+
- For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
|
|
108
|
+
- To export to Phy, we currently suggest bridging through SpikeInterface. Start with `sorting.to_numpy_sorting()` and follow the instructions [in SpikeInterface's documentation](https://spikeinterface.readthedocs.io/en/stable/modules/exporters.html#exporting-to-phy) for first creating a `SortingAnalyzer` and then exporting that to Phy.
|
|
109
|
+
- For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
|
|
110
|
+
- For pandas, use `sorting.to_pandas()`.
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
_dartsort_ also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
|
|
114
113
|
|
|
115
114
|
The data is saved to `output_dir` in the following files:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
|
|
116
|
+
- `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
|
|
117
|
+
- `matching1.h5`: This HDF5 file contains spike features and other data from the last matching step. Amplitudes, localizations, and other features live in here; use `h5ls` on the command line to see what's in there. Be aware that the `labels` dataset in this HDF5 is not the same as what's saved in the `dartsort_sorting.npz`.
|
|
118
|
+
- `motion_info.pkl` is a pickled `MotionInfo` object.
|
|
119
|
+
- There may be a models/ folder containing PyTorch weights files with modeling quantities (for instance, featurization SVD bases, localization neural nets, Gaussian mixture model parameters). If you want to load these up, feel free to reach out for help.
|
|
120
120
|
|
|
121
121
|
### Visualization
|
|
122
122
|
|
|
@@ -147,7 +147,7 @@ Set `make_unit_summaries=True` to create a summary plot for each unit.
|
|
|
147
147
|
|
|
148
148
|
### Command-line interface
|
|
149
149
|
|
|
150
|
-
Try running
|
|
150
|
+
Try running
|
|
151
151
|
|
|
152
152
|
```sh
|
|
153
153
|
$ dartsort -h
|
|
@@ -163,9 +163,8 @@ If it's more of a data-related or methodology thing, feel free to use the email
|
|
|
163
163
|
|
|
164
164
|
## References
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
- [SpikeInterface][SpikeInterface]
|
|
167
|
+
- DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
|
|
169
168
|
|
|
170
169
|
[SpikeInterface]: https://spikeinterface.readthedocs.io
|
|
171
170
|
[iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
|
|
@@ -6,25 +6,21 @@
|
|
|
6
6
|
[](https://doi.org/10.5281/zenodo.16943074)
|
|
7
7
|
[](https://pypi.org/p/dartsort)
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
# dartsort
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
*dartsort* is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
|
|
11
|
+
_dartsort_ is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
|
|
14
12
|
It is also a toolkit of modules for building spike sorters and other analyses of electrophysiology data.
|
|
15
13
|
|
|
16
|
-
|
|
17
14
|
## :warning: work in progress :warning:
|
|
18
15
|
|
|
19
16
|
We do not currently recommend DARTsort for production spike sorting purposes.
|
|
20
17
|
Please feel free to open an issue or a discussion if you run into problems.
|
|
21
18
|
|
|
22
|
-
|
|
23
19
|
## Installation
|
|
24
20
|
|
|
25
21
|
### Installing into an existing environment
|
|
26
22
|
|
|
27
|
-
If you already have a Python environment with PyTorch working and you just want to install
|
|
23
|
+
If you already have a Python environment with PyTorch working and you just want to install _dartsort_ there, use
|
|
28
24
|
|
|
29
25
|
```sh
|
|
30
26
|
$ pip install dartsort
|
|
@@ -38,30 +34,33 @@ If you need to set up Python or PyTorch, I find that a [`conda-forge`](https://c
|
|
|
38
34
|
|
|
39
35
|
You can use `conda-forge` to install Python, `dartsort`, and its dependencies as follows:
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
- Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
|
|
38
|
+
- Create an environment with
|
|
43
39
|
```sh
|
|
44
40
|
$ mamba env create -f environment.yml
|
|
45
41
|
```
|
|
46
42
|
This will create an environment called `dartsort`, but you can change the name by adding `-n othername`.
|
|
47
|
-
|
|
43
|
+
- Activate the environment:
|
|
48
44
|
```sh
|
|
49
45
|
$ mamba activate dartsort
|
|
50
46
|
```
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
- Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
|
|
53
48
|
|
|
54
49
|
## Usage
|
|
55
50
|
|
|
51
|
+
**Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
|
|
52
|
+
In particular, you will most likely need to set the `preprocessing` flag.
|
|
53
|
+
|
|
56
54
|
For more detailed documentation of the main function parameters and configuration options, see the [main API documentation](main_api.md).
|
|
57
55
|
|
|
58
56
|
### As a Python function
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
_dartsort_ can be run in Python with (for example):
|
|
61
59
|
|
|
62
60
|
```python
|
|
63
61
|
import dartsort
|
|
64
62
|
|
|
63
|
+
# if the default settings make sense for you...
|
|
65
64
|
dartsort.dartsort(recording, output_dir)
|
|
66
65
|
|
|
67
66
|
# or, to set configuration options, something like...
|
|
@@ -71,52 +70,53 @@ dartsort_result = dartsort.dartsort(
|
|
|
71
70
|
cfg=dartsort.DARTsortUserConfig(
|
|
72
71
|
preprocessing="ibllike",
|
|
73
72
|
work_in_tmpdir=True,
|
|
74
|
-
copy_recording_to_tmpdir=
|
|
73
|
+
copy_recording_to_tmpdir="yes",
|
|
75
74
|
),
|
|
76
75
|
)
|
|
77
76
|
```
|
|
78
77
|
|
|
79
|
-
**Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
|
|
80
|
-
Some of them, like `preprocessing`, are not set by default and need your input!
|
|
81
|
-
(This will probably change.)
|
|
82
|
-
|
|
83
78
|
Here, `recording` is a [SpikeInterface][SpikeInterface] recording object (see their tutorial on [reading various recording formats](https://spikeinterface.readthedocs.io/en/stable/how_to/read_various_formats.html)).
|
|
84
|
-
`output_dir` is the folder where
|
|
79
|
+
`output_dir` is the folder where _dartsort_ will save its output.
|
|
85
80
|
There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
|
|
86
81
|
|
|
87
|
-
Once you've run
|
|
82
|
+
Once you've run _dartsort_, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
|
|
88
83
|
|
|
89
84
|
### Important configuration details
|
|
90
85
|
|
|
91
|
-
Before running
|
|
86
|
+
Before running _dartsort_, please be aware of the following important configuration options.
|
|
92
87
|
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
- `preprocessing`: _dartsort_ doesn't preprocess your data by default (for now, `preprocessing="none"` by default), but this will change.
|
|
89
|
+
- An easy choice is `preprocessing="ibllikecmr"`, which is a lightweight version of [the IBL's strategy][iblsorting], replacing their highpass spatial filter with a common median reference.
|
|
90
|
+
- If you've already preprocessed your data, use `"none"` instead, or `"standardize"` if your preprocessing did not include a standardization step.
|
|
91
|
+
- An implementation of the full IBL strategy is available as `"ibllike"`.
|
|
92
|
+
- The `copy_recording_to_tmpdir` controls whether the recording is copied to a scratch directory for faster reading. It can be `True`, `False`, or `"if_preprocessing"` (the default). By default the recording is cached if `preprocessing` is something other than `"none"`.
|
|
93
|
+
- (The `tmpdir_parent` flag controls the scratch dir, which is your computer's default temporary folder if this is unset.)
|
|
94
|
+
- `do_motion_estimation=True` by default, but you may like to disable it if you know that there is (say) less than 5 microns of total drift in your recording, or if you have handled this in your own preprocessing.
|
|
95
|
+
- `work_in_tmpdir` can be helpful in some cases where slow network drives are involved.
|
|
97
96
|
|
|
98
97
|
### Outputs and exporting
|
|
99
98
|
|
|
100
99
|
The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
|
|
101
100
|
This object has all the spike train data attached (as arrays under property names `.times_samples` and `.times_seconds` for spike times in samples and seconds, `.labels` for unit labels, and many others; `print(sorting)` to see some more).
|
|
102
101
|
|
|
103
|
-
If you already ran
|
|
102
|
+
If you already ran _dartsort_ and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
|
|
104
103
|
|
|
105
104
|
This object can also export itself to other formats:
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
- For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
|
|
107
|
+
- For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
|
|
108
|
+
- To export to Phy, we currently suggest bridging through SpikeInterface. Start with `sorting.to_numpy_sorting()` and follow the instructions [in SpikeInterface's documentation](https://spikeinterface.readthedocs.io/en/stable/modules/exporters.html#exporting-to-phy) for first creating a `SortingAnalyzer` and then exporting that to Phy.
|
|
109
|
+
- For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
|
|
110
|
+
- For pandas, use `sorting.to_pandas()`.
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
_dartsort_ also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
|
|
114
113
|
|
|
115
114
|
The data is saved to `output_dir` in the following files:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
|
|
116
|
+
- `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
|
|
117
|
+
- `matching1.h5`: This HDF5 file contains spike features and other data from the last matching step. Amplitudes, localizations, and other features live in here; use `h5ls` on the command line to see what's in there. Be aware that the `labels` dataset in this HDF5 is not the same as what's saved in the `dartsort_sorting.npz`.
|
|
118
|
+
- `motion_info.pkl` is a pickled `MotionInfo` object.
|
|
119
|
+
- There may be a models/ folder containing PyTorch weights files with modeling quantities (for instance, featurization SVD bases, localization neural nets, Gaussian mixture model parameters). If you want to load these up, feel free to reach out for help.
|
|
120
120
|
|
|
121
121
|
### Visualization
|
|
122
122
|
|
|
@@ -147,7 +147,7 @@ Set `make_unit_summaries=True` to create a summary plot for each unit.
|
|
|
147
147
|
|
|
148
148
|
### Command-line interface
|
|
149
149
|
|
|
150
|
-
Try running
|
|
150
|
+
Try running
|
|
151
151
|
|
|
152
152
|
```sh
|
|
153
153
|
$ dartsort -h
|
|
@@ -163,9 +163,8 @@ If it's more of a data-related or methodology thing, feel free to use the email
|
|
|
163
163
|
|
|
164
164
|
## References
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
- [SpikeInterface][SpikeInterface]
|
|
167
|
+
- DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
|
|
169
168
|
|
|
170
169
|
[SpikeInterface]: https://spikeinterface.readthedocs.io
|
|
171
170
|
[iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
|
|
@@ -75,7 +75,7 @@ line-length = 88
|
|
|
75
75
|
|
|
76
76
|
[tool.ruff.lint]
|
|
77
77
|
extend-select = ["E", "F", "I", "N", "B", "SIM", "NPY", "RUF", "PTH", "PD", "FURB"]
|
|
78
|
-
ignore = ["F722", "N812", "SIM102", "SIM108", "E501", "N806", "N803", "N815", "RUF005", "SIM300", "C408"]
|
|
78
|
+
ignore = ["F722", "N812", "SIM102", "SIM108", "E501", "N806", "N803", "N815", "RUF005", "SIM300", "C408", "TRY401"]
|
|
79
79
|
|
|
80
80
|
[tool.ruff.lint.per-file-ignores]
|
|
81
81
|
"**/__init__.py" = ["F401", "F403"]
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
from .clustering_features import SimpleMatrixFeatures, StableWaveformFeatures
|
|
2
|
-
from .clustering import get_clusterer, clustering_strategies, refinement_strategies, TMMRefinement
|
|
3
1
|
from .agglomerate import deduplicate_spikes
|
|
2
|
+
from .clustering import (
|
|
3
|
+
TMMRefinement,
|
|
4
|
+
clustering_strategies,
|
|
5
|
+
get_clusterer,
|
|
6
|
+
refinement_strategies,
|
|
7
|
+
)
|
|
8
|
+
from .clustering_features import SimpleMatrixFeatures, StableWaveformFeatures
|
|
@@ -109,6 +109,7 @@ logger = get_logger(__name__)
|
|
|
109
109
|
pnoid = logger.isEnabledFor(DARTSORTVERBOSE)
|
|
110
110
|
prop_check_atol = 1e-3
|
|
111
111
|
prop_check_rtol = 1e-5
|
|
112
|
+
tiny = torch.finfo(torch.float32).tiny
|
|
112
113
|
|
|
113
114
|
|
|
114
115
|
# -- main
|
|
@@ -2196,7 +2197,7 @@ class TruncatedMixtureModel(BaseMixtureModel):
|
|
|
2196
2197
|
assert self.b.means.is_contiguous()
|
|
2197
2198
|
if bases is not None:
|
|
2198
2199
|
assert self.b.bases.is_contiguous()
|
|
2199
|
-
self.eps = torch.tensor(
|
|
2200
|
+
self.eps = torch.tensor(tiny, device=means.device)
|
|
2200
2201
|
|
|
2201
2202
|
# needs to be initialized before doing anything serious
|
|
2202
2203
|
# see bootstrapping stage of initialize_and_bootstrap_tmm
|
|
@@ -2415,6 +2416,7 @@ class TruncatedMixtureModel(BaseMixtureModel):
|
|
|
2415
2416
|
valid = torch.tensor([r is not None for r in initialization], dtype=torch.bool)
|
|
2416
2417
|
initialization = [r for r in initialization if r is not None]
|
|
2417
2418
|
responsibilities = responsibilities[:, valid]
|
|
2419
|
+
chan_coverage = chan_coverage[:, valid]
|
|
2418
2420
|
K = responsibilities.shape[1]
|
|
2419
2421
|
|
|
2420
2422
|
fdim = noise.rank * noise.n_channels
|
|
@@ -6252,7 +6254,7 @@ def _fill_blank_labels(
|
|
|
6252
6254
|
if keep_same_adj:
|
|
6253
6255
|
adj = un_adj
|
|
6254
6256
|
else:
|
|
6255
|
-
adj = un_adj + explore_adj *
|
|
6257
|
+
adj = un_adj + explore_adj * tiny
|
|
6256
6258
|
uncovered = adj.sum(0).amin().cpu().item() == 0
|
|
6257
6259
|
if uncovered:
|
|
6258
6260
|
uncovered_adj = adj.clone()
|
|
@@ -6262,7 +6264,7 @@ def _fill_blank_labels(
|
|
|
6262
6264
|
n_steps = -1
|
|
6263
6265
|
for n_steps in range(min(int(uncovered), max_steps)): # noqa: B007
|
|
6264
6266
|
explore_adj = explore_adj @ neighb_adj
|
|
6265
|
-
adj = un_adj + explore_adj *
|
|
6267
|
+
adj = un_adj + explore_adj * tiny
|
|
6266
6268
|
if adj.sum(0).min().cpu().item() > 0:
|
|
6267
6269
|
break
|
|
6268
6270
|
|
|
@@ -7379,7 +7381,7 @@ def _finalize_e_stats(
|
|
|
7379
7381
|
Uhat_batch = means.new_ones((batch_size, hat_dim, hat_dim))
|
|
7380
7382
|
|
|
7381
7383
|
# reweighting
|
|
7382
|
-
denom = stats.N[lut.b.unit_ids].clamp_(min=
|
|
7384
|
+
denom = stats.N[lut.b.unit_ids].clamp_(min=tiny)
|
|
7383
7385
|
Nlut_N = torch.div(stats.Nlut, denom, out=denom)
|
|
7384
7386
|
if pnoid:
|
|
7385
7387
|
assert torch.isfinite(Nlut_N).all()
|