DARTsort 0.5.27__tar.gz → 0.5.29__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 (182) hide show
  1. {dartsort-0.5.27 → dartsort-0.5.29}/.github/workflows/ci.yml +2 -2
  2. {dartsort-0.5.27 → dartsort-0.5.29}/PKG-INFO +4 -4
  3. {dartsort-0.5.27 → dartsort-0.5.29}/environment.yml +1 -2
  4. {dartsort-0.5.27 → dartsort-0.5.29}/pyproject.toml +3 -4
  5. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/agglomerate.py +14 -4
  6. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/cluster_util.py +3 -3
  7. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/mixture.py +2 -2
  8. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/refine_util.py +14 -3
  9. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/config.py +12 -2
  10. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/analysis.py +2 -1
  11. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/hybridkit.py +1 -1
  12. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/noise_recording_tools.py +2 -2
  13. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/localize/localize_util.py +1 -2
  14. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/peel_lib.py +58 -27
  15. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/shaver.py +2 -2
  16. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/subtract.py +42 -45
  17. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/subtract_util.py +127 -52
  18. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/threshold.py +146 -18
  19. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/_multichan_denoiser_kit.py +1 -1
  20. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/decollider.py +130 -66
  21. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/matched_filter_net.py +1 -2
  22. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/mixture_classifier.py +38 -71
  23. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/pipeline.py +19 -1
  24. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/reduction.py +0 -3
  25. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/temporal_pca.py +23 -17
  26. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/transform_base.py +5 -25
  27. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/data_util.py +8 -6
  28. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/drift_util.py +1 -1
  29. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/internal_config.py +37 -6
  30. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/multiprocessing_util.py +2 -2
  31. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/preprocess_util.py +25 -16
  32. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/registration_util.py +22 -14
  33. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/waveform_util.py +1 -1
  34. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/analysis_plots.py +13 -5
  35. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/mixture.py +11 -2
  36. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/unit.py +18 -4
  37. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort.egg-info/PKG-INFO +4 -4
  38. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort.egg-info/requires.txt +2 -2
  39. {dartsort-0.5.27 → dartsort-0.5.29}/tests/conftest.py +3 -3
  40. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_clustering.py +7 -3
  41. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_drift_util.py +23 -2
  42. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_simkit.py +7 -2
  43. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_subtract.py +106 -15
  44. dartsort-0.5.29/tests/test_threshold.py +80 -0
  45. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_transform.py +13 -2
  46. dartsort-0.5.27/tests/test_threshold.py +0 -9
  47. {dartsort-0.5.27 → dartsort-0.5.29}/.github/workflows/ci_windows.yml +0 -0
  48. {dartsort-0.5.27 → dartsort-0.5.29}/.github/workflows/deploy.yml +0 -0
  49. {dartsort-0.5.27 → dartsort-0.5.29}/.github/workflows/docs.yml +0 -0
  50. {dartsort-0.5.27 → dartsort-0.5.29}/.gitignore +0 -0
  51. {dartsort-0.5.27 → dartsort-0.5.29}/README.md +0 -0
  52. {dartsort-0.5.27 → dartsort-0.5.29}/docs/index.md +0 -0
  53. {dartsort-0.5.27 → dartsort-0.5.29}/docs/main_api.md +0 -0
  54. {dartsort-0.5.27 → dartsort-0.5.29}/docs/toolkit_api.md +0 -0
  55. {dartsort-0.5.27 → dartsort-0.5.29}/notebook/.keep +0 -0
  56. {dartsort-0.5.27 → dartsort-0.5.29}/notebook/fit_and_batch_matching.py +0 -0
  57. {dartsort-0.5.27 → dartsort-0.5.29}/notebook/ibl_dandi_example.py +0 -0
  58. {dartsort-0.5.27 → dartsort-0.5.29}/setup.cfg +0 -0
  59. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/__init__.py +0 -0
  60. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/__main__.py +0 -0
  61. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/cli.py +0 -0
  62. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/__init__.py +0 -0
  63. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/clustering.py +0 -0
  64. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/clustering_features.py +0 -0
  65. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/density.py +0 -0
  66. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/forward_backward.py +0 -0
  67. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/kmeans.py +0 -0
  68. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/clustering/merge.py +0 -0
  69. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/detect/__init__.py +0 -0
  70. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/detect/detect.py +0 -0
  71. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/__init__.py +0 -0
  72. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/comparison.py +0 -0
  73. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/hybrid_util.py +0 -0
  74. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/sim_template_tools.py +0 -0
  75. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/simkit.py +0 -0
  76. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/evaluate/simlib.py +0 -0
  77. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/localize/__init__.py +0 -0
  78. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/localize/localize_torch.py +0 -0
  79. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/main.py +0 -0
  80. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/__init__.py +0 -0
  81. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/grab.py +0 -0
  82. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/matching.py +0 -0
  83. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/matching_util/__init__.py +0 -0
  84. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/matching_util/compressed_upsampled.py +0 -0
  85. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/matching_util/drifty.py +0 -0
  86. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/matching_util/matching_base.py +0 -0
  87. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/matching_util/pairwise.py +0 -0
  88. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
  89. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/peel_base.py +0 -0
  90. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/peel/reduction_template.py +0 -0
  91. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
  92. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/detect_np1.pt +0 -0
  93. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/detect_np2.pt +0 -0
  94. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/glasbey1024.npz +0 -0
  95. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
  96. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
  97. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
  98. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
  99. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
  100. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/templates/__init__.py +0 -0
  101. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/templates/get_templates.py +0 -0
  102. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/templates/postprocess_util.py +0 -0
  103. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/templates/realignment.py +0 -0
  104. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/templates/template_util.py +0 -0
  105. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/templates/templates.py +0 -0
  106. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/templates/templib.py +0 -0
  107. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/__init__.py +0 -0
  108. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/all_transformers.py +0 -0
  109. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/amortized_localization.py +0 -0
  110. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/amplitudes.py +0 -0
  111. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/denoising_scorer.py +0 -0
  112. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/enforce_decrease.py +0 -0
  113. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/fixed_prop.py +0 -0
  114. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/interp.py +0 -0
  115. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/localize.py +0 -0
  116. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/matching_denoiser.py +0 -0
  117. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/single_channel_denoiser.py +0 -0
  118. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/supervised_denoiser.py +0 -0
  119. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/vq_matched_filter.py +0 -0
  120. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/transform/whiten.py +0 -0
  121. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/__init__.py +0 -0
  122. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/cli_util.py +0 -0
  123. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/interpolation_util.py +0 -0
  124. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/job_util.py +0 -0
  125. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/logging_util.py +0 -0
  126. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/main_util.py +0 -0
  127. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/more_operators.py +0 -0
  128. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/motion.py +0 -0
  129. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/nn_util.py +0 -0
  130. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/noise_util.py +0 -0
  131. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/peel_util.py +0 -0
  132. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/py_util.py +0 -0
  133. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/residual_util.py +0 -0
  134. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/sparse_util.py +0 -0
  135. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/spikeio.py +0 -0
  136. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/spiketorch.py +0 -0
  137. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/testing_util/__init__.py +0 -0
  138. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/testing_util/matching_debug_util.py +0 -0
  139. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -0
  140. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/torch_optimization_util.py +0 -0
  141. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/util/torch_util.py +0 -0
  142. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/__init__.py +0 -0
  143. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/colors.py +0 -0
  144. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/gt.py +0 -0
  145. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/layout.py +0 -0
  146. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/metrics_util.py +0 -0
  147. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/recanim.py +0 -0
  148. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/scatterplots.py +0 -0
  149. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/sorting.py +0 -0
  150. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/unit_comparison.py +0 -0
  151. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/versus.py +0 -0
  152. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/vismain.py +0 -0
  153. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort/vis/waveforms.py +0 -0
  154. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort.egg-info/SOURCES.txt +0 -0
  155. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort.egg-info/dependency_links.txt +0 -0
  156. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort.egg-info/entry_points.txt +0 -0
  157. {dartsort-0.5.27 → dartsort-0.5.29}/src/dartsort.egg-info/top_level.txt +0 -0
  158. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_agglomerate.py +0 -0
  159. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_alignment.py +0 -0
  160. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_cluster_util.py +0 -0
  161. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_clustering_features.py +0 -0
  162. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_config.py +0 -0
  163. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_dartsort.py +0 -0
  164. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_data_util.py +0 -0
  165. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_density.py +0 -0
  166. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_detect.py +0 -0
  167. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_drifty_matching.py +0 -0
  168. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_enforce_decrease.py +0 -0
  169. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_grab_and_featurize.py +0 -0
  170. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_hybridkit.py +0 -0
  171. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_kmeans.py +0 -0
  172. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_linalg.py +0 -0
  173. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_localize_torch.py +0 -0
  174. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_matching.py +0 -0
  175. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_mixture_classifier.py +0 -0
  176. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_modeling.py +0 -0
  177. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_spiketorch.py +0 -0
  178. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_templates.py +0 -0
  179. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_torch_optimization_util.py +0 -0
  180. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_util.py +0 -0
  181. {dartsort-0.5.27 → dartsort-0.5.29}/tests/test_waveform_util.py +0 -0
  182. {dartsort-0.5.27 → dartsort-0.5.29}/zensical.toml +0 -0
@@ -19,14 +19,14 @@ jobs:
19
19
 
20
20
  steps:
21
21
  - name: Checkout
22
- uses: actions/checkout@v4
22
+ uses: actions/checkout@v7
23
23
  with:
24
24
  path: dartsort
25
25
 
26
26
  - name: Fetch tags and describe
27
27
  run: pushd dartsort/ && git fetch --prune --unshallow --tags && git describe && popd
28
28
 
29
- - uses: actions/setup-python@v6
29
+ - uses: actions/setup-python@v7
30
30
  with:
31
31
  python-version: "3.x"
32
32
  cache: "pip" # caching pip dependencies
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dartsort
3
- Version: 0.5.27
3
+ Version: 0.5.29
4
4
  Summary: DARTsort
5
5
  Author-email: Charlie Windolf <ciw2048@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/cwindolf/dartsort
@@ -8,12 +8,11 @@ Project-URL: Bug Tracker, https://github.com/cwindolf/dartsort/issues
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.11
11
+ Requires-Python: >=3.12
12
12
  Description-Content-Type: text/markdown
13
- Requires-Dist: dredge-ephys
13
+ Requires-Dist: dredge-ephys>=0.4.0
14
14
  Requires-Dist: h5py
15
15
  Requires-Dist: jaxtyping
16
- Requires-Dist: kdepy
17
16
  Requires-Dist: linear_operator
18
17
  Requires-Dist: numba
19
18
  Requires-Dist: numpy>=1.20; python_version < "3.13"
@@ -37,6 +36,7 @@ Provides-Extra: test
37
36
  Requires-Dist: pytest; extra == "test"
38
37
  Requires-Dist: pytest-cov; extra == "test"
39
38
  Provides-Extra: vis
39
+ Requires-Dist: kdepy; extra == "vis"
40
40
  Requires-Dist: matplotlib; extra == "vis"
41
41
  Requires-Dist: seaborn; extra == "vis"
42
42
  Requires-Dist: matplotlib-venn; extra == "vis"
@@ -3,12 +3,11 @@ name: dartsort
3
3
  channels:
4
4
  - conda-forge
5
5
  dependencies:
6
- - python=3.14
6
+ - python>=3.11
7
7
  - h5py
8
8
  - ipykernel
9
9
  - ipython
10
10
  - ipywidgets
11
- - kdepy
12
11
  - linear_operator
13
12
  - matplotlib
14
13
  - numba
@@ -8,17 +8,16 @@ dynamic = ["version"]
8
8
  authors = [{ name = "Charlie Windolf", email = "ciw2048@gmail.com" }]
9
9
  description = "DARTsort"
10
10
  readme = "README.md"
11
- requires-python = ">=3.11"
11
+ requires-python = ">=3.12"
12
12
  classifiers = [
13
13
  "Programming Language :: Python :: 3",
14
14
  "License :: OSI Approved :: MIT License",
15
15
  "Operating System :: OS Independent",
16
16
  ]
17
17
  dependencies = [
18
- "dredge-ephys",
18
+ "dredge-ephys>=0.4.0",
19
19
  "h5py",
20
20
  "jaxtyping",
21
- "kdepy",
22
21
  "linear_operator",
23
22
  "numba",
24
23
  "numpy>=1.20;python_version<'3.13'",
@@ -40,7 +39,7 @@ dependencies = [
40
39
  [project.optional-dependencies]
41
40
  doc = ["zensical", "mkdocstrings-python"]
42
41
  test = ["pytest", "pytest-cov"]
43
- vis = ["matplotlib", "seaborn", "matplotlib-venn"]
42
+ vis = ["kdepy", "matplotlib", "seaborn", "matplotlib-venn"]
44
43
 
45
44
  [project.urls]
46
45
  "Homepage" = "https://github.com/cwindolf/dartsort"
@@ -6,9 +6,15 @@ from typing import cast
6
6
  import numba
7
7
  import numpy as np
8
8
  import torch
9
- from KDEpy import FFTKDE
10
9
  from spikeinterface.core import BaseRecording
11
10
 
11
+ try:
12
+ import KDEpy
13
+
14
+ HAVE_KDEPY = True
15
+ except ImportError:
16
+ HAVE_KDEPY = False
17
+
12
18
  from ..templates.template_util import shared_basis_compress_templates
13
19
  from ..templates.templates import TemplateData
14
20
  from ..util.data_util import (
@@ -479,6 +485,8 @@ def qda(
479
485
  ) -> QDAResult:
480
486
  from ..util.data_util import get_gmm_scores
481
487
 
488
+ assert HAVE_KDEPY or not bimodality
489
+
482
490
  # reconstruct scores from sorting attached data (exclude train_ix?)
483
491
  gscores = get_gmm_scores(sorting)
484
492
  glabels = sorting.labels
@@ -597,6 +605,8 @@ def _qda_job(ij):
597
605
  assert np.isclose(binc[bc], 0.0)
598
606
  assert binc.shape[0] == 2 * bc + 1
599
607
 
608
+ from KDEpy import FFTKDE
609
+
600
610
  try:
601
611
  kde = FFTKDE(bw="ISJ").fit(dll)
602
612
  except ValueError as e:
@@ -807,7 +817,7 @@ def _check_soft_assign_invariants(
807
817
  maxdiff = -np.inf
808
818
  n_neginf_viol = 0
809
819
 
810
- for s in numba.prange(cand.shape[0]): # ty: ignore[not-iterable]
820
+ for s in numba.prange(cand.shape[0]):
811
821
  for j in range(n_cand):
812
822
  if cand[s, j] < 0:
813
823
  nbye += 1
@@ -827,7 +837,7 @@ def _assign_labels(
827
837
  n_changed = 0
828
838
  n_labeled = 0
829
839
 
830
- for s in numba.prange(cand.shape[0]): # ty: ignore[not-iterable]
840
+ for s in numba.prange(cand.shape[0]):
831
841
  if labels[s] >= 0:
832
842
  n_labeled += 1
833
843
  if labels[s] != cand[s, 0]:
@@ -846,7 +856,7 @@ def _combine_loop(
846
856
  ):
847
857
  n_cand = cand.shape[1]
848
858
 
849
- for s in numba.prange(cand.shape[0]): # ty: ignore
859
+ for s in numba.prange(cand.shape[0]):
850
860
  spike_cand = cand[s]
851
861
  for j in range(n_cand - 1):
852
862
  spike_candj = spike_cand[j]
@@ -121,7 +121,7 @@ def merge_group_shifts(
121
121
 
122
122
  @numba.njit(nogil=True, parallel=True)
123
123
  def apply_time_shifts(times: np.ndarray, labels: np.ndarray, unit_shifts: np.ndarray):
124
- for i in numba.prange(times.shape[0]): # ty: ignore[not-iterable]
124
+ for i in numba.prange(times.shape[0]):
125
125
  label = labels[i]
126
126
  if label >= 0:
127
127
  times[i] -= unit_shifts[label]
@@ -867,7 +867,7 @@ def _violation_count_matrix(
867
867
  n = times.shape[0]
868
868
 
869
869
  # parallelize over chunks
870
- for c in numba.prange(starts.shape[0] - 1): # ty: ignore[not-iterable]
870
+ for c in numba.prange(starts.shape[0] - 1):
871
871
  out = counts[c] # my thread's output buffer
872
872
 
873
873
  for i in range(starts[c], starts[c + 1]):
@@ -904,7 +904,7 @@ def _violation_weight_matrix(
904
904
  window_length = weights.shape[0] - 1
905
905
 
906
906
  # parallelize over chunks
907
- for c in numba.prange(starts.shape[0] - 1): # ty: ignore[not-iterable]
907
+ for c in numba.prange(starts.shape[0] - 1):
908
908
  out = sums[c] # my thread's output buffer
909
909
 
910
910
  for i in range(starts[c], starts[c + 1]):
@@ -7598,7 +7598,7 @@ def _update_lut_mean_batch(
7598
7598
 
7599
7599
  # constplogdet. add in the signal-rank-0-only terms.
7600
7600
  lut_params.constplogdet[i0:i1] = neighb_cov.nobs[nn].mul_(LOG_2PI) # type: ignore # ty: ignore[x]
7601
- lut_params.constplogdet[i0:i1] += neighb_cov.b.logdet[nn]
7601
+ lut_params.constplogdet[i0:i1] += neighb_cov.b.logdet[nn] # ty: ignore[not-subscriptable]
7602
7602
  if pnoid:
7603
7603
  assert lut_params.constplogdet[i0:i1].isfinite().all() # type: ignore # ty: ignore[x]
7604
7604
 
@@ -7658,7 +7658,7 @@ def _update_lut_ppca_batch(
7658
7658
  assert lut_params.Tpad is not None
7659
7659
  lut_params.Tpad[i0:i1, :, :-1] = T # type: ignore # ty: ignore[x]
7660
7660
  cap_logdet = L.diagonal(dim1=-2, dim2=-1).log().sum(dim=1).mul_(2.0)
7661
- lut_params.constplogdet[i0:i1] += cap_logdet
7661
+ lut_params.constplogdet[i0:i1] += cap_logdet # ty: ignore[not-subscriptable]
7662
7662
  if pnoid:
7663
7663
  assert lut_params.b.constplogdet[i0:i1].isfinite().all()
7664
7664
 
@@ -4,12 +4,17 @@ from typing import cast
4
4
  import numba
5
5
  import numpy as np
6
6
  import torch
7
- from KDEpy import FFTKDE
8
- from KDEpy.bw_selection import improved_sheather_jones
9
7
  from scipy.spatial import KDTree
10
8
  from scipy.stats import norm
11
9
  from spikeinterface.core.baserecording import BaseRecording
12
10
 
11
+ try:
12
+ import KDEpy
13
+
14
+ HAVE_KDEPY = True
15
+ except ImportError:
16
+ HAVE_KDEPY = False
17
+
13
18
  from dartsort.clustering.mixture import Scores
14
19
 
15
20
  from ..util import data_util, spiketorch
@@ -392,7 +397,9 @@ def collision_cleaning_error_filter(
392
397
  assert flag_scores.excess_rate is not None
393
398
  flag_bad |= flag_scores.excess_rate > refinement_cfg.cc_flag_excess_rate
394
399
 
395
- logger.dartsortdebug(f"CC flag criterion dropped {flag_bad.sum()} / {nu0} units.")
400
+ logger.dartsortdebug(
401
+ f"CC flag criterion dropped {flag_bad.sum()} / {nu0} units."
402
+ )
396
403
  keep_mask &= np.logical_not(flag_bad)
397
404
 
398
405
  bad_ids = np.flatnonzero(np.logical_not(keep_mask))
@@ -646,6 +653,7 @@ def gmm_isolation_scores(
646
653
  kde_rhs=50.0,
647
654
  kde_dx: float = 0.5,
648
655
  ) -> GMMIsolationScores:
656
+ assert HAVE_KDEPY
649
657
  if unit_ids is None:
650
658
  unit_ids = np.arange(scores.candidates[:, 0].max().item() + 1)
651
659
  assert unit_ids is not None
@@ -761,6 +769,9 @@ def _iso_job(unit_id) -> tuple[float, np.ndarray | None, np.ndarray | None]:
761
769
  # fit kde. will symmetrize around 0 to avoid boundary issues (since lr>=0)
762
770
  amax = in_lr.abs().amax().item()
763
771
  lr = in_lr.double().numpy(force=True)
772
+ from KDEpy import FFTKDE
773
+ from KDEpy.bw_selection import improved_sheather_jones
774
+
764
775
  try:
765
776
  # select bandwidth based on positive part
766
777
  bw = improved_sheather_jones(lr[:, None])
@@ -4,14 +4,17 @@ from typing import Annotated, Literal
4
4
  from pydantic import Field
5
5
 
6
6
  from .util.internal_config import (
7
+ DetectionProposal,
7
8
  InterpKernel,
8
9
  InterpMethod,
9
10
  KmeansppSelection,
10
11
  KmeansppStopping,
11
12
  MixtureStep,
13
+ MotionBatchingMode,
12
14
  PreprocessingStrategy,
13
15
  RealignStrategy,
14
16
  TemplateSVDMethod,
17
+ TPCADenoiserFitStage,
15
18
  WhiteningEstimator,
16
19
  WhiteningStrategy,
17
20
  default_pretrained_path, # noqa
@@ -248,6 +251,10 @@ class DARTsortUserConfig:
248
251
  max_dist_from_median_um: float = 250.0
249
252
  """Motion bins farther than this from the local median will be replaced by interpolation."""
250
253
  median_neighborhood_bins: int = 51
254
+ motion_batching_mode: MotionBatchingMode = "full"
255
+ """'full' or 'online'. Online helps with long recordings."""
256
+ motion_chunk_len_s: Annotated[float, Field(gt=0)] = 3000.0
257
+ """Chunk length in seconds for online motion tracking"""
251
258
 
252
259
  # -- pipeline control parameters for specific use cases
253
260
  fit_matching_models_only: bool = False
@@ -277,10 +284,13 @@ class DeveloperConfig(DARTsortUserConfig):
277
284
  nn_denoiser_noise_waveforms: int = 100 * 256
278
285
  nn_denoiser_extra_kwargs: dict | None = None
279
286
  score_filter_radius_um: float = 0.0
280
- detection_proposal: Literal["voltage", "tpca", "vq", "score_net"] = "voltage"
287
+ detection_proposal: DetectionProposal = "voltage"
281
288
  proposal_filters: int = 1
282
- score_proposal_threshold: float = 5.0
289
+ propose_with_score_net: bool = False
290
+ proposal_threshold: float = 5.0
291
+ score_net_threshold: float = 5.0
283
292
  do_tpca_denoise: bool = True
293
+ tpca_denoise_fit: TPCADenoiserFitStage | None = None
284
294
  first_denoiser_thinning: float = 0.0
285
295
  first_denoiser_spatial_dedup_radius: float = 100.0
286
296
  realign_to_denoiser: bool = True
@@ -16,7 +16,7 @@ import spikeinterface.core as sc
16
16
  import torch
17
17
  from sklearn.decomposition import PCA
18
18
 
19
- from ..clustering.agglomerate import QDAResult, qda, template_distances
19
+ from ..clustering.agglomerate import HAVE_KDEPY, QDAResult, qda, template_distances
20
20
  from ..templates import TemplateData
21
21
  from ..util import job_util, logging_util
22
22
  from ..util.data_util import (
@@ -193,6 +193,7 @@ class DARTsortAnalysis:
193
193
 
194
194
  if (
195
195
  allow_qda
196
+ and HAVE_KDEPY
196
197
  and template_data is not None
197
198
  and hasattr(sorting, "gmm_candidates")
198
199
  ):
@@ -135,7 +135,7 @@ def make_hybrid_recording(
135
135
  assert target_recording.get_num_segments() == 1
136
136
  assert injected_sorting.get_num_segments() == 1
137
137
  if hasattr(injected_sorting, "get_last_spike_frame"):
138
- assert injected_sorting.get_last_spike_frame() < target_recording.get_num_frames() # ty:ignore[call-non-callable]
138
+ assert injected_sorting.get_last_spike_frame() < target_recording.get_num_frames()
139
139
  assert abs(templates.sampling_frequency - target_sampling_frequency) < 10
140
140
 
141
141
  if folder is not None and not overwrite:
@@ -71,7 +71,7 @@ def get_background_recording(
71
71
  spatial_std, spatial_vt = rbf_kernel_sqrt(
72
72
  geom, bandwidth=noise_spatial_kernel_bandwidth
73
73
  )
74
- noise_temporal_kernel = noise_temporal_kernel.astype(spatial_vt.dtype) + 0j # ty:ignore[no-matching-overload]
74
+ noise_temporal_kernel = noise_temporal_kernel.astype(spatial_vt.dtype) + 0j
75
75
  noise = StationaryFactorizedNoise(
76
76
  spatial_std=spatial_std,
77
77
  vt_spatial=spatial_vt,
@@ -119,7 +119,7 @@ class WhiteNoiseRecording(BaseRecording):
119
119
  channel_ids = np.asarray(channel_ids)
120
120
  assert channel_ids.shape == (n_channels,)
121
121
  assert n_segments == 1
122
- super().__init__(sampling_frequency, channel_ids=channel_ids, dtype=dtype) # type: ignore
122
+ super().__init__(sampling_frequency, channel_ids=channel_ids, dtype=dtype)
123
123
  self._serializability["json"] = False
124
124
  self._serializability["pickle"] = False
125
125
  segment = WhiteNoiseRecordingSegment(
@@ -21,7 +21,6 @@ def localize_waveforms(
21
21
  radius=None,
22
22
  n_channels_subset=None,
23
23
  ):
24
- C, dim = geom.shape
25
24
  amp_vecs = ptp(waveforms, 1)
26
25
  if main_channels is None:
27
26
  main_channels = amp_vecs.argmax(1)
@@ -287,7 +286,7 @@ def point_source_mse(locs, amp_vecs, channels, channel_index, geom):
287
286
  torch.asarray(amp_vecs).nan_to_num(),
288
287
  channel_mask,
289
288
  *torch.asarray(locs).T,
290
- torch.asarray(dxz).nan_to_num(),
289
+ torch.asarray(dxz).nan_to_num(), # ty: ignore[too-many-positional-arguments]
291
290
  )
292
291
  alpha = alpha.numpy()
293
292
  else:
@@ -12,6 +12,7 @@ from torch import Tensor
12
12
  from ..detect import detect_and_deduplicate
13
13
  from ..util.internal_config import (
14
14
  ComputationConfig,
15
+ FeaturizationConfig,
15
16
  FitSamplingConfig,
16
17
  PeakSign,
17
18
  ThresholdingConfig,
@@ -20,7 +21,6 @@ from ..util.internal_config import (
20
21
  from ..util.job_util import ensure_computation_config
21
22
  from ..util.spiketorch import grab_spikes, subtract_spikes_
22
23
  from ..util.torch_util import torch_compile
23
- from ..util.waveform_util import make_channel_index
24
24
  from .peel_base import PeelingBatchResult
25
25
 
26
26
  if TYPE_CHECKING:
@@ -120,7 +120,7 @@ def flatten_denan_and_whiten_batched(
120
120
  def threshold_chunk(
121
121
  traces,
122
122
  channel_index,
123
- detection_threshold=4.0,
123
+ voltage_threshold=4.0,
124
124
  peak_sign: PeakSign = "both",
125
125
  peak_channel_index=None,
126
126
  dedup_channel_index=None,
@@ -140,10 +140,9 @@ def threshold_chunk(
140
140
  rg=None,
141
141
  quiet=False,
142
142
  ) -> PeelingBatchResult:
143
- n_index = channel_index.shape[1]
144
143
  times_rel, channels, energies = detect_and_deduplicate(
145
144
  traces,
146
- threshold=detection_threshold,
145
+ threshold=voltage_threshold,
147
146
  peak_channel_index=peak_channel_index,
148
147
  dedup_neighborhoods=dedup_channel_index,
149
148
  peak_sign=peak_sign,
@@ -153,6 +152,46 @@ def threshold_chunk(
153
152
  return_energies=True,
154
153
  trough_priority=trough_priority,
155
154
  )
155
+ return extract_detections(
156
+ traces,
157
+ times_rel,
158
+ channels,
159
+ energies,
160
+ channel_index=channel_index,
161
+ trough_offset_samples=trough_offset_samples,
162
+ spike_length_samples=spike_length_samples,
163
+ left_margin=left_margin,
164
+ right_margin=right_margin,
165
+ max_spikes_per_chunk=max_spikes_per_chunk,
166
+ thinning=thinning,
167
+ time_jitter=time_jitter,
168
+ spatial_jitter_channel_index=spatial_jitter_channel_index,
169
+ return_waveforms=return_waveforms,
170
+ rg=rg,
171
+ quiet=quiet,
172
+ )
173
+
174
+
175
+ def extract_detections(
176
+ traces,
177
+ times_rel,
178
+ channels,
179
+ energies,
180
+ *,
181
+ channel_index,
182
+ trough_offset_samples=42,
183
+ spike_length_samples=121,
184
+ left_margin=0,
185
+ right_margin=0,
186
+ max_spikes_per_chunk=None,
187
+ thinning=0.0,
188
+ time_jitter=0,
189
+ spatial_jitter_channel_index=None,
190
+ return_waveforms=True,
191
+ rg=None,
192
+ quiet=False,
193
+ ) -> PeelingBatchResult:
194
+ n_index = channel_index.shape[1]
156
195
  if not times_rel.numel():
157
196
  return PeelingBatchResult(
158
197
  n_spikes=0,
@@ -281,7 +320,7 @@ def perturb_detections(
281
320
  n = len(times_rel)
282
321
  if time_jitter:
283
322
  assert rg is not None
284
- jitter = rg.integers(low=-time_jitter, high=time_jitter + 1)
323
+ jitter = rg.integers(low=-time_jitter, high=time_jitter + 1, size=n)
285
324
  times_rel = times_rel + torch.asarray(
286
325
  jitter, dtype=times_rel.dtype, device=times_rel.device
287
326
  )
@@ -436,8 +475,8 @@ def threshold_to_fit(
436
475
  recording: BaseRecording,
437
476
  waveform_cfg: WaveformConfig,
438
477
  channel_index: Tensor,
439
- spatial_dedup_radius: float | None,
440
478
  threshold_cfg: ThresholdingConfig,
479
+ featurization_cfg: FeaturizationConfig,
441
480
  sampling_cfg: FitSamplingConfig,
442
481
  max_waveforms_fit: int | None = None,
443
482
  n_residual_snips: int | None = None,
@@ -448,34 +487,23 @@ def threshold_to_fit(
448
487
 
449
488
  Used by subtraction to fit initial NN denoisers.
450
489
  """
451
- from ..transform import Waveform, WaveformPipeline
452
490
  from ..util.data_util import subsample_waveforms
453
491
  from .threshold import Threshold
454
492
 
455
493
  computation_cfg = ensure_computation_config(computation_cfg)
456
494
 
457
- geom = recording.get_channel_locations()
458
- waveform_node = Waveform(
459
- channel_index=channel_index,
460
- waveform_cfg=waveform_cfg,
461
- sampling_frequency=recording.sampling_frequency,
462
- )
463
- waveform_pipeline = WaveformPipeline([waveform_node])
464
-
465
- if spatial_dedup_radius:
466
- dn_dedup_ci = make_channel_index(geom, spatial_dedup_radius, to_torch=True)
467
- dn_dedup_ci = dn_dedup_ci.to(channel_index)
468
- else:
469
- dn_dedup_ci = channel_index
470
- trainer = Threshold(
495
+ trainer = Threshold.from_config(
471
496
  recording=recording,
472
- channel_index=channel_index,
473
- featurization_pipeline=waveform_pipeline,
474
- p=threshold_cfg,
475
497
  waveform_cfg=waveform_cfg,
476
- dedup_channel_index=dn_dedup_ci,
477
- fit_sampling_cfg=sampling_cfg,
498
+ thresholding_cfg=threshold_cfg,
499
+ featurization_cfg=featurization_cfg,
500
+ sampling_cfg=sampling_cfg,
501
+ extract_channel_index=channel_index,
478
502
  )
503
+ assert trainer.featurization_pipeline is not None
504
+ assert "waveforms" in {
505
+ ds.name for ds in trainer.featurization_pipeline.spike_datasets()
506
+ }
479
507
 
480
508
  if max_waveforms_fit is None:
481
509
  max_waveforms_fit = sampling_cfg.max_waveforms_fit
@@ -490,6 +518,9 @@ def threshold_to_fit(
490
518
  with TemporaryDirectory(dir=tmp_dir) as temp_dir:
491
519
  temp_hdf5_filename = Path(temp_dir) / "subtraction_denoiser0_fit.h5"
492
520
  try:
521
+ trainer.load_or_fit_and_save_models(
522
+ Path(temp_dir) / "threshold_models", computation_cfg=computation_cfg
523
+ )
493
524
  trainer.run_subsampled_peeling(
494
525
  temp_hdf5_filename,
495
526
  stop_after_n_waveforms=max_waveforms_fit,
@@ -515,7 +546,7 @@ def threshold_to_fit(
515
546
  raise ValueError(
516
547
  "Found no spikes when thresholding to get model fitting data. "
517
548
  "This usually indicates a preprocessing issue, since it means "
518
- f"that no spikes could be found at threshold {threshold_cfg.detection_threshold}."
549
+ f"that no spikes could be found at threshold {threshold_cfg.voltage_threshold}."
519
550
  )
520
551
 
521
552
  # fit the thing
@@ -59,7 +59,7 @@ class Shaver(BasePeeler):
59
59
  fixed_property_keys=fixed_prop_keys,
60
60
  )
61
61
  self.p = p
62
- self.peel_kind = f"Shave {p.detection_threshold}"
62
+ self.peel_kind = f"Shave {p.voltage_threshold}"
63
63
  self.denoising_pipeline = denoising_pipeline
64
64
  self.dedup_batch_size = self.nearest_batch_length()
65
65
 
@@ -135,7 +135,7 @@ class Shaver(BasePeeler):
135
135
  channel_index=self.b.channel_index,
136
136
  denoising_pipeline=self.denoising_pipeline,
137
137
  residnorm_decrease_threshold=self.p.shave_score,
138
- detection_threshold=self.p.detection_threshold,
138
+ detection_threshold=self.p.voltage_threshold,
139
139
  peak_sign=self.p.peak_sign,
140
140
  dedup_channel_index=self.b.dedup_channel_index,
141
141
  trough_offset_samples=self.trough_offset_samples,