DARTsort 0.5.17__tar.gz → 0.5.18__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.
Files changed (176) hide show
  1. {dartsort-0.5.17 → dartsort-0.5.18}/PKG-INFO +35 -37
  2. {dartsort-0.5.17 → dartsort-0.5.18}/README.md +34 -36
  3. {dartsort-0.5.17 → dartsort-0.5.18}/docs/index.md +34 -36
  4. {dartsort-0.5.17 → dartsort-0.5.18}/pyproject.toml +1 -1
  5. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/mixture.py +6 -4
  6. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/config.py +5 -7
  7. dartsort-0.5.18/src/dartsort/detect/__init__.py +3 -0
  8. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/detect/detect.py +115 -7
  9. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/main.py +32 -18
  10. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/grab.py +0 -1
  11. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/matching.py +20 -141
  12. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/matching_util/compressed_upsampled.py +22 -203
  13. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/matching_util/drifty.py +10 -23
  14. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/matching_util/matching_base.py +210 -74
  15. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/peel_base.py +9 -10
  16. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/peel_lib.py +43 -133
  17. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/subtract.py +1 -7
  18. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/threshold.py +0 -2
  19. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/_multichan_denoiser_kit.py +22 -3
  20. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/amortized_localization.py +7 -2
  21. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/decollider.py +14 -1
  22. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/mixture_classifier.py +4 -1
  23. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/data_util.py +175 -86
  24. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/internal_config.py +12 -26
  25. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/main_util.py +50 -14
  26. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/noise_util.py +0 -150
  27. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/peel_util.py +7 -2
  28. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/preprocess_util.py +49 -0
  29. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/spiketorch.py +29 -0
  30. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/testing_util/matching_debug_util.py +14 -23
  31. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/analysis_plots.py +0 -5
  32. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/mixture.py +24 -7
  33. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/unit.py +0 -1
  34. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/vismain.py +11 -1
  35. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort.egg-info/PKG-INFO +35 -37
  36. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort.egg-info/SOURCES.txt +0 -1
  37. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_alignment.py +6 -8
  38. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_dartsort.py +11 -0
  39. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_data_util.py +1 -0
  40. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_detect.py +6 -12
  41. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_matching.py +1 -3
  42. dartsort-0.5.17/src/dartsort/detect/__init__.py +0 -3
  43. dartsort-0.5.17/src/dartsort/detect/detect_filters.py +0 -36
  44. {dartsort-0.5.17 → dartsort-0.5.18}/.github/workflows/ci.yml +0 -0
  45. {dartsort-0.5.17 → dartsort-0.5.18}/.github/workflows/ci_windows.yml +0 -0
  46. {dartsort-0.5.17 → dartsort-0.5.18}/.github/workflows/deploy.yml +0 -0
  47. {dartsort-0.5.17 → dartsort-0.5.18}/.github/workflows/docs.yml +0 -0
  48. {dartsort-0.5.17 → dartsort-0.5.18}/.gitignore +0 -0
  49. {dartsort-0.5.17 → dartsort-0.5.18}/docs/main_api.md +0 -0
  50. {dartsort-0.5.17 → dartsort-0.5.18}/docs/toolkit_api.md +0 -0
  51. {dartsort-0.5.17 → dartsort-0.5.18}/environment.yml +0 -0
  52. {dartsort-0.5.17 → dartsort-0.5.18}/notebook/.keep +0 -0
  53. {dartsort-0.5.17 → dartsort-0.5.18}/notebook/ibl_dandi_example.py +0 -0
  54. {dartsort-0.5.17 → dartsort-0.5.18}/setup.cfg +0 -0
  55. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/__init__.py +0 -0
  56. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/cli.py +0 -0
  57. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/__init__.py +0 -0
  58. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/agglomerate.py +0 -0
  59. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/cluster_util.py +0 -0
  60. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/clustering.py +0 -0
  61. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/clustering_features.py +0 -0
  62. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/density.py +0 -0
  63. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/forward_backward.py +0 -0
  64. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/kmeans.py +0 -0
  65. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/merge.py +0 -0
  66. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/modes.py +0 -0
  67. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/clustering/refine_util.py +0 -0
  68. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/evaluate/__init__.py +0 -0
  69. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/evaluate/analysis.py +0 -0
  70. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/evaluate/comparison.py +0 -0
  71. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/evaluate/hybrid_util.py +0 -0
  72. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/evaluate/noise_recording_tools.py +0 -0
  73. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/evaluate/sim_template_tools.py +0 -0
  74. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/evaluate/simkit.py +0 -0
  75. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/evaluate/simlib.py +0 -0
  76. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/localize/__init__.py +0 -0
  77. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/localize/localize_torch.py +0 -0
  78. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/localize/localize_util.py +0 -0
  79. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/__init__.py +0 -0
  80. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/matching_util/__init__.py +0 -0
  81. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/matching_util/pairwise.py +0 -0
  82. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
  83. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/reduction_template.py +0 -0
  84. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/peel/shaver.py +0 -0
  85. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
  86. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/detect_np1.pt +0 -0
  87. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/detect_np2.pt +0 -0
  88. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/glasbey1024.npz +0 -0
  89. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
  90. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
  91. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
  92. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
  93. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
  94. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/templates/__init__.py +0 -0
  95. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/templates/get_templates.py +0 -0
  96. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/templates/postprocess_util.py +0 -0
  97. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/templates/realignment.py +0 -0
  98. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/templates/template_util.py +0 -0
  99. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/templates/templates.py +0 -0
  100. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/templates/templib.py +0 -0
  101. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/__init__.py +0 -0
  102. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/all_transformers.py +0 -0
  103. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/amplitudes.py +0 -0
  104. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/denoising_scorer.py +0 -0
  105. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/enforce_decrease.py +0 -0
  106. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/fixed_prop.py +0 -0
  107. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/interp.py +0 -0
  108. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/localize.py +0 -0
  109. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/matching_denoiser.py +0 -0
  110. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/pipeline.py +0 -0
  111. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/reduction.py +0 -0
  112. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/single_channel_denoiser.py +0 -0
  113. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/supervised_denoiser.py +0 -0
  114. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/temporal_pca.py +0 -0
  115. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/transform_base.py +0 -0
  116. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/transform/whiten.py +0 -0
  117. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/__init__.py +0 -0
  118. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/cli_util.py +0 -0
  119. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/drift_util.py +0 -0
  120. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/interpolation_util.py +0 -0
  121. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/job_util.py +0 -0
  122. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/logging_util.py +0 -0
  123. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/more_operators.py +0 -0
  124. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/motion.py +0 -0
  125. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/multiprocessing_util.py +0 -0
  126. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/nn_util.py +0 -0
  127. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/py_util.py +0 -0
  128. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/registration_util.py +0 -0
  129. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/residual_util.py +0 -0
  130. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/sparse_util.py +0 -0
  131. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/spikeio.py +0 -0
  132. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/testing_util/__init__.py +0 -0
  133. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -0
  134. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/torch_optimization_util.py +0 -0
  135. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/torch_util.py +0 -0
  136. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/util/waveform_util.py +0 -0
  137. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/__init__.py +0 -0
  138. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/colors.py +0 -0
  139. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/gt.py +0 -0
  140. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/layout.py +0 -0
  141. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/metrics_util.py +0 -0
  142. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/recanim.py +0 -0
  143. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/scatterplots.py +0 -0
  144. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/sorting.py +0 -0
  145. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/unit_comparison.py +0 -0
  146. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/versus.py +0 -0
  147. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort/vis/waveforms.py +0 -0
  148. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort.egg-info/dependency_links.txt +0 -0
  149. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort.egg-info/entry_points.txt +0 -0
  150. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort.egg-info/requires.txt +0 -0
  151. {dartsort-0.5.17 → dartsort-0.5.18}/src/dartsort.egg-info/top_level.txt +0 -0
  152. {dartsort-0.5.17 → dartsort-0.5.18}/tests/conftest.py +0 -0
  153. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_agglomerate.py +0 -0
  154. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_cluster_util.py +0 -0
  155. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_clustering.py +0 -0
  156. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_config.py +0 -0
  157. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_density.py +0 -0
  158. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_drift_util.py +0 -0
  159. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_drifty_matching.py +0 -0
  160. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_enforce_decrease.py +0 -0
  161. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_grab_and_featurize.py +0 -0
  162. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_kmeans.py +0 -0
  163. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_linalg.py +0 -0
  164. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_localize_torch.py +0 -0
  165. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_mixture_classifier.py +0 -0
  166. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_modeling.py +0 -0
  167. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_simkit.py +0 -0
  168. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_spiketorch.py +0 -0
  169. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_subtract.py +0 -0
  170. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_templates.py +0 -0
  171. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_threshold.py +0 -0
  172. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_torch_optimization_util.py +0 -0
  173. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_transform.py +0 -0
  174. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_util.py +0 -0
  175. {dartsort-0.5.17 → dartsort-0.5.18}/tests/test_waveform_util.py +0 -0
  176. {dartsort-0.5.17 → dartsort-0.5.18}/zensical.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dartsort
3
- Version: 0.5.17
3
+ Version: 0.5.18
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
  [![Zenodo DOI](https://zenodo.org/badge/421108722.svg)](https://doi.org/10.5281/zenodo.16943074)
50
50
  [![pypi: dartsort](https://img.shields.io/pypi/v/dartsort?label=pypi:%20dartsort)](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 *dartsort* there, use
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,18 +77,17 @@ 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
- - Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
85
- - Create an environment with
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
- - Activate the environment:
86
+ - Activate the environment:
91
87
  ```sh
92
88
  $ mamba activate dartsort
93
89
  ```
94
- - Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
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
 
@@ -100,7 +95,7 @@ For more detailed documentation of the main function parameters and configuratio
100
95
 
101
96
  ### As a Python function
102
97
 
103
- *dartsort* can be run in Python with:
98
+ _dartsort_ can be run in Python with:
104
99
 
105
100
  ```python
106
101
  import dartsort
@@ -120,46 +115,50 @@ dartsort_result = dartsort.dartsort(
120
115
  ```
121
116
 
122
117
  **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.)
118
+ In particular, you will most likely need to set the `preprocessing` flag.
125
119
 
126
120
  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 *dartsort* will save its output.
121
+ `output_dir` is the folder where _dartsort_ will save its output.
128
122
  There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
129
123
 
130
- Once you've run *dartsort*, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
124
+ Once you've run _dartsort_, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
131
125
 
132
126
  ### Important configuration details
133
127
 
134
- Before running *dartsort*, please be aware of the following important configuration options.
128
+ Before running _dartsort_, please be aware of the following important configuration options.
135
129
 
136
- - `preprocessing`: *dartsort* won't touch your data by default (`preprocessing="none"`), leaving you free to implement your own preprocessing in SpikeInterface or otherwise. However, *dartsort* expects standardized input, and therefore it will explode if you don't set this flag and your data is in its original state (for instance, the raw `int16` data off the probe).
137
- - For a cheap but sensible default, try `preprocessing="ibllikecmr"`, which applies a pipeline similar to that of [the IBL][iblsorting] but with global median common referencing instead of their spatial highpass filter. `preprocessing="ibllike"` will use their spatial highpass filter.
138
- - `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.
139
- - `work_in_tmpdir` and `copy_recording_to_tmpdir` can be helpful in some cases where slow network drives are involved.
130
+ - `preprocessing`: _dartsort_ doesn't preprocess your data by default (for now, `preprocessing="none"` by default), but this will change.
131
+ - 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.
132
+ - If you've already preprocessed your data, use `"none"` instead, or `"standardize"` if your preprocessing did not include a standardization step.
133
+ - An implementation of the full IBL strategy is available as `"ibllike"`.
134
+ - 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"`.
135
+ - (The `tmpdir_parent` flag controls the scratch dir, which is your computer's default temporary folder if this is unset.)
136
+ - `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.
137
+ - `work_in_tmpdir` can be helpful in some cases where slow network drives are involved.
140
138
 
141
139
  ### Outputs and exporting
142
140
 
143
141
  The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
144
142
  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
143
 
146
- If you already ran *dartsort* and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
144
+ If you already ran _dartsort_ and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
147
145
 
148
146
  This object can also export itself to other formats:
149
147
 
150
- - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
151
- - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
152
- - 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.
153
- - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
154
- - For pandas, use `sorting.to_pandas()`.
148
+ - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
149
+ - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
150
+ - 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.
151
+ - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
152
+ - For pandas, use `sorting.to_pandas()`.
155
153
 
156
- *dartsort* also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
154
+ _dartsort_ also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
157
155
 
158
156
  The data is saved to `output_dir` in the following files:
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.
157
+
158
+ - `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
159
+ - `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`.
160
+ - `motion_info.pkl` is a pickled `MotionInfo` object.
161
+ - 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
162
 
164
163
  ### Visualization
165
164
 
@@ -190,7 +189,7 @@ Set `make_unit_summaries=True` to create a summary plot for each unit.
190
189
 
191
190
  ### Command-line interface
192
191
 
193
- Try running
192
+ Try running
194
193
 
195
194
  ```sh
196
195
  $ dartsort -h
@@ -206,9 +205,8 @@ If it's more of a data-related or methodology thing, feel free to use the email
206
205
 
207
206
  ## References
208
207
 
209
- - [SpikeInterface][SpikeInterface]
210
- - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
211
-
208
+ - [SpikeInterface][SpikeInterface]
209
+ - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
212
210
 
213
211
  [SpikeInterface]: https://spikeinterface.readthedocs.io
214
212
  [iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
@@ -6,25 +6,21 @@
6
6
  [![Zenodo DOI](https://zenodo.org/badge/421108722.svg)](https://doi.org/10.5281/zenodo.16943074)
7
7
  [![pypi: dartsort](https://img.shields.io/pypi/v/dartsort?label=pypi:%20dartsort)](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 *dartsort* there, use
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,18 +34,17 @@ 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
- - Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
42
- - Create an environment with
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
- - Activate the environment:
43
+ - Activate the environment:
48
44
  ```sh
49
45
  $ mamba activate dartsort
50
46
  ```
51
- - Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
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
 
@@ -57,7 +52,7 @@ For more detailed documentation of the main function parameters and configuratio
57
52
 
58
53
  ### As a Python function
59
54
 
60
- *dartsort* can be run in Python with:
55
+ _dartsort_ can be run in Python with:
61
56
 
62
57
  ```python
63
58
  import dartsort
@@ -77,46 +72,50 @@ dartsort_result = dartsort.dartsort(
77
72
  ```
78
73
 
79
74
  **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.)
75
+ In particular, you will most likely need to set the `preprocessing` flag.
82
76
 
83
77
  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 *dartsort* will save its output.
78
+ `output_dir` is the folder where _dartsort_ will save its output.
85
79
  There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
86
80
 
87
- Once you've run *dartsort*, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
81
+ Once you've run _dartsort_, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
88
82
 
89
83
  ### Important configuration details
90
84
 
91
- Before running *dartsort*, please be aware of the following important configuration options.
85
+ Before running _dartsort_, please be aware of the following important configuration options.
92
86
 
93
- - `preprocessing`: *dartsort* won't touch your data by default (`preprocessing="none"`), leaving you free to implement your own preprocessing in SpikeInterface or otherwise. However, *dartsort* expects standardized input, and therefore it will explode if you don't set this flag and your data is in its original state (for instance, the raw `int16` data off the probe).
94
- - For a cheap but sensible default, try `preprocessing="ibllikecmr"`, which applies a pipeline similar to that of [the IBL][iblsorting] but with global median common referencing instead of their spatial highpass filter. `preprocessing="ibllike"` will use their spatial highpass filter.
95
- - `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.
96
- - `work_in_tmpdir` and `copy_recording_to_tmpdir` can be helpful in some cases where slow network drives are involved.
87
+ - `preprocessing`: _dartsort_ doesn't preprocess your data by default (for now, `preprocessing="none"` by default), but this will change.
88
+ - 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.
89
+ - If you've already preprocessed your data, use `"none"` instead, or `"standardize"` if your preprocessing did not include a standardization step.
90
+ - An implementation of the full IBL strategy is available as `"ibllike"`.
91
+ - 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"`.
92
+ - (The `tmpdir_parent` flag controls the scratch dir, which is your computer's default temporary folder if this is unset.)
93
+ - `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.
94
+ - `work_in_tmpdir` can be helpful in some cases where slow network drives are involved.
97
95
 
98
96
  ### Outputs and exporting
99
97
 
100
98
  The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
101
99
  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
100
 
103
- If you already ran *dartsort* and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
101
+ If you already ran _dartsort_ and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
104
102
 
105
103
  This object can also export itself to other formats:
106
104
 
107
- - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
108
- - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
109
- - 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.
110
- - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
111
- - For pandas, use `sorting.to_pandas()`.
105
+ - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
106
+ - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
107
+ - 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.
108
+ - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
109
+ - For pandas, use `sorting.to_pandas()`.
112
110
 
113
- *dartsort* also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
111
+ _dartsort_ also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
114
112
 
115
113
  The data is saved to `output_dir` in the following files:
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.
114
+
115
+ - `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
116
+ - `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`.
117
+ - `motion_info.pkl` is a pickled `MotionInfo` object.
118
+ - 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
119
 
121
120
  ### Visualization
122
121
 
@@ -147,7 +146,7 @@ Set `make_unit_summaries=True` to create a summary plot for each unit.
147
146
 
148
147
  ### Command-line interface
149
148
 
150
- Try running
149
+ Try running
151
150
 
152
151
  ```sh
153
152
  $ dartsort -h
@@ -163,9 +162,8 @@ If it's more of a data-related or methodology thing, feel free to use the email
163
162
 
164
163
  ## References
165
164
 
166
- - [SpikeInterface][SpikeInterface]
167
- - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
168
-
165
+ - [SpikeInterface][SpikeInterface]
166
+ - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
169
167
 
170
168
  [SpikeInterface]: https://spikeinterface.readthedocs.io
171
169
  [iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
@@ -6,25 +6,21 @@
6
6
  [![Zenodo DOI](https://zenodo.org/badge/421108722.svg)](https://doi.org/10.5281/zenodo.16943074)
7
7
  [![pypi: dartsort](https://img.shields.io/pypi/v/dartsort?label=pypi:%20dartsort)](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 *dartsort* there, use
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,18 +34,17 @@ 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
- - Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
42
- - Create an environment with
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
- - Activate the environment:
43
+ - Activate the environment:
48
44
  ```sh
49
45
  $ mamba activate dartsort
50
46
  ```
51
- - Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
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
 
@@ -57,7 +52,7 @@ For more detailed documentation of the main function parameters and configuratio
57
52
 
58
53
  ### As a Python function
59
54
 
60
- *dartsort* can be run in Python with:
55
+ _dartsort_ can be run in Python with:
61
56
 
62
57
  ```python
63
58
  import dartsort
@@ -77,46 +72,50 @@ dartsort_result = dartsort.dartsort(
77
72
  ```
78
73
 
79
74
  **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.)
75
+ In particular, you will most likely need to set the `preprocessing` flag.
82
76
 
83
77
  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 *dartsort* will save its output.
78
+ `output_dir` is the folder where _dartsort_ will save its output.
85
79
  There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
86
80
 
87
- Once you've run *dartsort*, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
81
+ Once you've run _dartsort_, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
88
82
 
89
83
  ### Important configuration details
90
84
 
91
- Before running *dartsort*, please be aware of the following important configuration options.
85
+ Before running _dartsort_, please be aware of the following important configuration options.
92
86
 
93
- - `preprocessing`: *dartsort* won't touch your data by default (`preprocessing="none"`), leaving you free to implement your own preprocessing in SpikeInterface or otherwise. However, *dartsort* expects standardized input, and therefore it will explode if you don't set this flag and your data is in its original state (for instance, the raw `int16` data off the probe).
94
- - For a cheap but sensible default, try `preprocessing="ibllikecmr"`, which applies a pipeline similar to that of [the IBL][iblsorting] but with global median common referencing instead of their spatial highpass filter. `preprocessing="ibllike"` will use their spatial highpass filter.
95
- - `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.
96
- - `work_in_tmpdir` and `copy_recording_to_tmpdir` can be helpful in some cases where slow network drives are involved.
87
+ - `preprocessing`: _dartsort_ doesn't preprocess your data by default (for now, `preprocessing="none"` by default), but this will change.
88
+ - 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.
89
+ - If you've already preprocessed your data, use `"none"` instead, or `"standardize"` if your preprocessing did not include a standardization step.
90
+ - An implementation of the full IBL strategy is available as `"ibllike"`.
91
+ - 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"`.
92
+ - (The `tmpdir_parent` flag controls the scratch dir, which is your computer's default temporary folder if this is unset.)
93
+ - `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.
94
+ - `work_in_tmpdir` can be helpful in some cases where slow network drives are involved.
97
95
 
98
96
  ### Outputs and exporting
99
97
 
100
98
  The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
101
99
  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
100
 
103
- If you already ran *dartsort* and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
101
+ If you already ran _dartsort_ and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
104
102
 
105
103
  This object can also export itself to other formats:
106
104
 
107
- - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
108
- - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
109
- - 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.
110
- - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
111
- - For pandas, use `sorting.to_pandas()`.
105
+ - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
106
+ - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
107
+ - 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.
108
+ - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
109
+ - For pandas, use `sorting.to_pandas()`.
112
110
 
113
- *dartsort* also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
111
+ _dartsort_ also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
114
112
 
115
113
  The data is saved to `output_dir` in the following files:
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.
114
+
115
+ - `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
116
+ - `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`.
117
+ - `motion_info.pkl` is a pickled `MotionInfo` object.
118
+ - 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
119
 
121
120
  ### Visualization
122
121
 
@@ -147,7 +146,7 @@ Set `make_unit_summaries=True` to create a summary plot for each unit.
147
146
 
148
147
  ### Command-line interface
149
148
 
150
- Try running
149
+ Try running
151
150
 
152
151
  ```sh
153
152
  $ dartsort -h
@@ -163,9 +162,8 @@ If it's more of a data-related or methodology thing, feel free to use the email
163
162
 
164
163
  ## References
165
164
 
166
- - [SpikeInterface][SpikeInterface]
167
- - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
168
-
165
+ - [SpikeInterface][SpikeInterface]
166
+ - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
169
167
 
170
168
  [SpikeInterface]: https://spikeinterface.readthedocs.io
171
169
  [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"]
@@ -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(torch.finfo(means.dtype).tiny, device=means.device)
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 * torch.finfo(explore_adj.dtype).tiny
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 * torch.finfo(explore_adj.dtype).tiny
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=torch.finfo(stats.N.dtype).tiny)
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()
@@ -96,7 +96,7 @@ class DARTsortUserConfig:
96
96
  work_in_tmpdir: bool = False
97
97
  """If True, dartsort will store all temporary data in a scratch directory in tmpdir_parent or TMPDIR."""
98
98
 
99
- copy_recording_to_tmpdir: bool = False
99
+ copy_recording_to_tmpdir: Literal["yes", "no", "if_preprocessing"] = "if_preprocessing"
100
100
  """Save a copy of the preprocessed recording to a tmpdir?"""
101
101
 
102
102
  workdir_copier: Literal["shutil", "rsync"] = "shutil"
@@ -145,7 +145,7 @@ class DARTsortUserConfig:
145
145
  threshold in Kilosort and other sorters, and it represents reduction in
146
146
  Euclidean norm of standardized data due to matching a new event."""
147
147
 
148
- initial_threshold: Annotated[float, Field(gt=0)] = 7.0
148
+ initial_threshold: Annotated[float, Field(gt=0)] = 9.0
149
149
  """Initial detection's neural net matching threshold. Same as
150
150
  matching_threshold, except that a neural net is trying to guess
151
151
  the true waveforms here, rather than using cluster templates."""
@@ -248,7 +248,7 @@ class DeveloperConfig(DARTsortUserConfig):
248
248
  detection_type: Literal["subtract", "match", "threshold"] = "subtract"
249
249
  cluster_strategy: str = "dpc"
250
250
  refinement_strategy: str = "tmm"
251
- recluster_after_first_matching: bool = False
251
+ recluster_after_matching: bool = False
252
252
 
253
253
  # general peeling
254
254
  n_waveforms_fit: int = 40_000
@@ -267,7 +267,9 @@ class DeveloperConfig(DARTsortUserConfig):
267
267
  use_nn_in_subtraction: bool = True
268
268
  whiten_in_subtraction: bool = True
269
269
  threshold_before_whitening: float = 10.0
270
+ shave_score: float = 10.0
270
271
  temporal_dedup_radius_samples: int = 7
272
+ subtract_global_dedup: bool = True
271
273
  positive_temporal_dedup_radius_samples: int = 41
272
274
  spikeinterface_merge_max_distance: float = 0.8
273
275
 
@@ -296,8 +298,6 @@ class DeveloperConfig(DARTsortUserConfig):
296
298
  whiten_estimator: WhiteningEstimator = "localzca"
297
299
  whiten_temporal_length: int | None = 3
298
300
  whiten_features: bool = False
299
- matching_fp_control: bool = False
300
- refractory_radius_frames: int = 0
301
301
  svd_alignment_iterations: int = 0
302
302
 
303
303
  # interpolation for features
@@ -312,8 +312,6 @@ class DeveloperConfig(DARTsortUserConfig):
312
312
  polyharmonic_order: int = 2
313
313
 
314
314
  # initial clustering
315
- initial_euclidean_complete_only: bool = False
316
- initial_cosine_complete_only: bool = False
317
315
  initial_amp_feat: bool = False
318
316
  initial_signed_amp_feat: bool = True
319
317
  initial_pc_feats: int = 5
@@ -0,0 +1,3 @@
1
+ """Helper functions for event detection"""
2
+
3
+ from .detect import detect_and_deduplicate, detect_and_globally_deduplicate