DARTsort 0.5.25__tar.gz → 0.5.27__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 (181) hide show
  1. {dartsort-0.5.25 → dartsort-0.5.27}/PKG-INFO +2 -2
  2. {dartsort-0.5.25 → dartsort-0.5.27}/README.md +1 -1
  3. {dartsort-0.5.25 → dartsort-0.5.27}/docs/index.md +1 -1
  4. {dartsort-0.5.25 → dartsort-0.5.27}/notebook/fit_and_batch_matching.py +20 -7
  5. {dartsort-0.5.25 → dartsort-0.5.27}/pyproject.toml +1 -0
  6. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/density.py +9 -5
  7. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/mixture.py +12 -5
  8. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/hybrid_util.py +1 -1
  9. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/hybridkit.py +2 -1
  10. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/noise_recording_tools.py +1 -1
  11. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/simkit.py +1 -1
  12. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/simlib.py +5 -5
  13. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/main.py +11 -2
  14. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/matching_util/drifty.py +68 -35
  15. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/matching_util/matching_base.py +2 -6
  16. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/templates/realignment.py +4 -3
  17. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/templates/templib.py +2 -1
  18. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/transform_base.py +1 -1
  19. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/data_util.py +3 -3
  20. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/internal_config.py +5 -5
  21. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/main_util.py +11 -2
  22. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/noise_util.py +5 -5
  23. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/preprocess_util.py +27 -3
  24. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/registration_util.py +1 -1
  25. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/spiketorch.py +8 -16
  26. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/__init__.py +2 -2
  27. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/analysis_plots.py +1 -1
  28. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/gt.py +1 -1
  29. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/vismain.py +2 -0
  30. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort.egg-info/PKG-INFO +2 -2
  31. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_config.py +1 -1
  32. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_drifty_matching.py +58 -5
  33. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_hybridkit.py +1 -1
  34. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_matching.py +4 -3
  35. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_modeling.py +146 -0
  36. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_templates.py +2 -2
  37. {dartsort-0.5.25 → dartsort-0.5.27}/.github/workflows/ci.yml +0 -0
  38. {dartsort-0.5.25 → dartsort-0.5.27}/.github/workflows/ci_windows.yml +0 -0
  39. {dartsort-0.5.25 → dartsort-0.5.27}/.github/workflows/deploy.yml +0 -0
  40. {dartsort-0.5.25 → dartsort-0.5.27}/.github/workflows/docs.yml +0 -0
  41. {dartsort-0.5.25 → dartsort-0.5.27}/.gitignore +0 -0
  42. {dartsort-0.5.25 → dartsort-0.5.27}/docs/main_api.md +0 -0
  43. {dartsort-0.5.25 → dartsort-0.5.27}/docs/toolkit_api.md +0 -0
  44. {dartsort-0.5.25 → dartsort-0.5.27}/environment.yml +0 -0
  45. {dartsort-0.5.25 → dartsort-0.5.27}/notebook/.keep +0 -0
  46. {dartsort-0.5.25 → dartsort-0.5.27}/notebook/ibl_dandi_example.py +0 -0
  47. {dartsort-0.5.25 → dartsort-0.5.27}/setup.cfg +0 -0
  48. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/__init__.py +0 -0
  49. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/__main__.py +0 -0
  50. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/cli.py +0 -0
  51. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/__init__.py +0 -0
  52. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/agglomerate.py +0 -0
  53. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/cluster_util.py +0 -0
  54. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/clustering.py +0 -0
  55. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/clustering_features.py +0 -0
  56. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/forward_backward.py +0 -0
  57. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/kmeans.py +0 -0
  58. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/merge.py +0 -0
  59. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/clustering/refine_util.py +0 -0
  60. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/config.py +0 -0
  61. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/detect/__init__.py +0 -0
  62. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/detect/detect.py +0 -0
  63. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/__init__.py +0 -0
  64. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/analysis.py +0 -0
  65. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/comparison.py +0 -0
  66. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/evaluate/sim_template_tools.py +0 -0
  67. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/localize/__init__.py +0 -0
  68. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/localize/localize_torch.py +0 -0
  69. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/localize/localize_util.py +0 -0
  70. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/__init__.py +0 -0
  71. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/grab.py +0 -0
  72. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/matching.py +0 -0
  73. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/matching_util/__init__.py +0 -0
  74. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/matching_util/compressed_upsampled.py +0 -0
  75. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/matching_util/pairwise.py +0 -0
  76. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
  77. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/peel_base.py +0 -0
  78. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/peel_lib.py +0 -0
  79. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/reduction_template.py +0 -0
  80. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/shaver.py +0 -0
  81. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/subtract.py +0 -0
  82. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/subtract_util.py +0 -0
  83. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/peel/threshold.py +0 -0
  84. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
  85. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/detect_np1.pt +0 -0
  86. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/detect_np2.pt +0 -0
  87. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/glasbey1024.npz +0 -0
  88. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
  89. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
  90. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
  91. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
  92. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
  93. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/templates/__init__.py +0 -0
  94. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/templates/get_templates.py +0 -0
  95. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/templates/postprocess_util.py +0 -0
  96. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/templates/template_util.py +0 -0
  97. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/templates/templates.py +0 -0
  98. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/__init__.py +0 -0
  99. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/_multichan_denoiser_kit.py +0 -0
  100. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/all_transformers.py +0 -0
  101. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/amortized_localization.py +0 -0
  102. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/amplitudes.py +0 -0
  103. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/decollider.py +0 -0
  104. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/denoising_scorer.py +0 -0
  105. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/enforce_decrease.py +0 -0
  106. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/fixed_prop.py +0 -0
  107. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/interp.py +0 -0
  108. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/localize.py +0 -0
  109. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/matched_filter_net.py +0 -0
  110. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/matching_denoiser.py +0 -0
  111. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/mixture_classifier.py +0 -0
  112. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/pipeline.py +0 -0
  113. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/reduction.py +0 -0
  114. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/single_channel_denoiser.py +0 -0
  115. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/supervised_denoiser.py +0 -0
  116. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/temporal_pca.py +0 -0
  117. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/vq_matched_filter.py +0 -0
  118. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/transform/whiten.py +0 -0
  119. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/__init__.py +0 -0
  120. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/cli_util.py +0 -0
  121. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/drift_util.py +0 -0
  122. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/interpolation_util.py +0 -0
  123. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/job_util.py +0 -0
  124. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/logging_util.py +0 -0
  125. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/more_operators.py +0 -0
  126. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/motion.py +0 -0
  127. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/multiprocessing_util.py +0 -0
  128. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/nn_util.py +0 -0
  129. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/peel_util.py +0 -0
  130. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/py_util.py +0 -0
  131. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/residual_util.py +0 -0
  132. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/sparse_util.py +0 -0
  133. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/spikeio.py +0 -0
  134. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/testing_util/__init__.py +0 -0
  135. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/testing_util/matching_debug_util.py +0 -0
  136. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -0
  137. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/torch_optimization_util.py +0 -0
  138. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/torch_util.py +0 -0
  139. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/util/waveform_util.py +0 -0
  140. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/colors.py +0 -0
  141. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/layout.py +0 -0
  142. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/metrics_util.py +0 -0
  143. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/mixture.py +0 -0
  144. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/recanim.py +0 -0
  145. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/scatterplots.py +0 -0
  146. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/sorting.py +0 -0
  147. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/unit.py +0 -0
  148. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/unit_comparison.py +0 -0
  149. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/versus.py +0 -0
  150. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort/vis/waveforms.py +0 -0
  151. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort.egg-info/SOURCES.txt +0 -0
  152. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort.egg-info/dependency_links.txt +0 -0
  153. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort.egg-info/entry_points.txt +0 -0
  154. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort.egg-info/requires.txt +0 -0
  155. {dartsort-0.5.25 → dartsort-0.5.27}/src/dartsort.egg-info/top_level.txt +0 -0
  156. {dartsort-0.5.25 → dartsort-0.5.27}/tests/conftest.py +0 -0
  157. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_agglomerate.py +0 -0
  158. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_alignment.py +0 -0
  159. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_cluster_util.py +0 -0
  160. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_clustering.py +0 -0
  161. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_clustering_features.py +0 -0
  162. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_dartsort.py +0 -0
  163. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_data_util.py +0 -0
  164. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_density.py +0 -0
  165. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_detect.py +0 -0
  166. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_drift_util.py +0 -0
  167. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_enforce_decrease.py +0 -0
  168. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_grab_and_featurize.py +0 -0
  169. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_kmeans.py +0 -0
  170. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_linalg.py +0 -0
  171. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_localize_torch.py +0 -0
  172. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_mixture_classifier.py +0 -0
  173. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_simkit.py +0 -0
  174. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_spiketorch.py +0 -0
  175. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_subtract.py +0 -0
  176. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_threshold.py +0 -0
  177. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_torch_optimization_util.py +0 -0
  178. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_transform.py +0 -0
  179. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_util.py +0 -0
  180. {dartsort-0.5.25 → dartsort-0.5.27}/tests/test_waveform_util.py +0 -0
  181. {dartsort-0.5.25 → dartsort-0.5.27}/zensical.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dartsort
3
- Version: 0.5.25
3
+ Version: 0.5.27
4
4
  Summary: DARTsort
5
5
  Author-email: Charlie Windolf <ciw2048@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/cwindolf/dartsort
@@ -48,7 +48,7 @@ Requires-Dist: matplotlib-venn; extra == "vis"
48
48
  [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
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
- [![zulip: dartsort](https://img.shields.io/badge/zulip-dartsort-brightgreen.svg)](https://dartsort.zulipchat.org)
51
+ [![zulip: dartsort](https://img.shields.io/badge/zulip-dartsort-brightgreen.svg)](https://dartsort.zulipchat.com)
52
52
 
53
53
  # dartsort
54
54
 
@@ -5,7 +5,7 @@
5
5
  [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
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
- [![zulip: dartsort](https://img.shields.io/badge/zulip-dartsort-brightgreen.svg)](https://dartsort.zulipchat.org)
8
+ [![zulip: dartsort](https://img.shields.io/badge/zulip-dartsort-brightgreen.svg)](https://dartsort.zulipchat.com)
9
9
 
10
10
  # dartsort
11
11
 
@@ -5,7 +5,7 @@
5
5
  [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
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
- [![zulip: dartsort](https://img.shields.io/badge/zulip-dartsort-brightgreen.svg)](https://dartsort.zulipchat.org)
8
+ [![zulip: dartsort](https://img.shields.io/badge/zulip-dartsort-brightgreen.svg)](https://dartsort.zulipchat.com)
9
9
 
10
10
  # dartsort
11
11
 
@@ -117,11 +117,22 @@ plt.colorbar(shrink=0.5, label='standardized voltage')
117
117
  plt.xlabel('time (samples')
118
118
  plt.ylabel('channels');
119
119
 
120
+ # %% [markdown]
121
+ # # Configuration
122
+
123
+ # %%
124
+ # use defaults, except for the pipeline change
125
+ cfg = dartsort.DARTsortUserConfig(fit_matching_models_only=True)
126
+
127
+ # %%
128
+ # process into an internal config object for later use
129
+ internal_cfg = dartsort.to_internal_config(cfg)
130
+
120
131
  # %% [markdown]
121
132
  # # Fit models
122
133
 
123
134
  # %%
124
- dartsort.dartsort(rec, ds_dir, cfg=dartsort.DARTsortUserConfig(fit_matching_models_only=True))
135
+ dartsort.dartsort(rec, ds_dir, cfg=cfg)
125
136
 
126
137
  # %%
127
138
  # !ls {ds_dir}
@@ -153,7 +164,7 @@ for batch_ix, batch_start_samples in enumerate(range(0, duration_samples, 60 * 3
153
164
  hdf5_filename=f"matching1_batch{batch_ix:05}.h5",
154
165
  chunk_starts_samples=np.arange(batch_start_samples, batch_end_samples, 30_000),
155
166
  load_simple_features=False, # ignoring the output, so don't load up extra stuff
156
- featurization_cfg=dartsort.default_matching_streaming_classifier_cfg,
167
+ featurization_cfg=internal_cfg.matching_classifier_featurization_cfg,
157
168
  motion=dartsort.try_load_motion_info(ds_dir),
158
169
  )
159
170
  del res
@@ -163,11 +174,13 @@ for batch_ix, batch_start_samples in enumerate(range(0, duration_samples, 60 * 3
163
174
  #
164
175
  # In this section, I'm grabbing all of the matching outputs and concatenating them.
165
176
  # Then, I'm running *dartsort*'s standard postprocessing: a final merge step and a spike-train
166
- # cleaning step (duplicate detection removal).
177
+ # cleaning step (duplicate detection removal). This is controlled by the `DARTsortUserConfig` flag `postprocessing`,
178
+ # which is `"agglomerate_and_clean"` by default.
167
179
  #
168
- # Users can change this. If you don't want to merge, remove that config from the list. In that case, you could
169
- # run the cleaning step on each chunk before concatenating: the merge needs to agree across the batched matching
170
- # output, but the output of cleaning is the same when run batchwise or on the full result.
180
+ # Users can change this. If you don't want to merge, set `postprocessing="clean"` in the configuration
181
+ # section above. In that case, you could run the cleaning step on each chunk before concatenating: the
182
+ # merge needs to agree across the batched matching output, but the output of cleaning is the same when
183
+ # run batchwise or on the full result.
171
184
  #
172
185
  # Here, extra features (amplitudes, localizations) are loaded by the default behavior of `dartsort.load`,
173
186
  # which can be turned off for users who don't need them.
@@ -181,7 +194,7 @@ sorting = dartsort.cluster(
181
194
  sorting,
182
195
  motion=dartsort.try_load_motion_info(ds_dir),
183
196
  clustering_cfg=None,
184
- refinement_cfgs=[dartsort.default_agglomerate_cfg, dartsort.default_clean_cfg],
197
+ refinement_cfgs=internal_cfg.final_refinement_cfgs,
185
198
  )
186
199
 
187
200
  # %%
@@ -97,3 +97,4 @@ replace-imports-with-any = ["hdbscan"]
97
97
  [tool.ty.rules]
98
98
  "unsupported-base" = "ignore"
99
99
  "possibly-unresolved-reference" = "error"
100
+ "invalid-key" = "ignore"
@@ -64,7 +64,7 @@ def kdtree_inliers(
64
64
 
65
65
  def get_smoothed_density(
66
66
  X,
67
- inliers: np.ndarray | slice = slice(None),
67
+ inliers: np.ndarray | slice = slice(None), # noqa: B008
68
68
  sigma: float = 1.0,
69
69
  sigma_low: float | None = None,
70
70
  sigma_ramp_ax=-1,
@@ -154,7 +154,7 @@ def get_smoothed_density(
154
154
  def get_smoothed_density_ratio(
155
155
  X,
156
156
  *,
157
- inliers: np.ndarray | slice = slice(None),
157
+ inliers: np.ndarray | slice = slice(None), # noqa: B008
158
158
  sigmas: list[float],
159
159
  sigma_lows: list[float] | list[None] | None = None,
160
160
  sigma_ramp_ax=-1,
@@ -504,7 +504,7 @@ def density_peaks(
504
504
  remove_borders=False,
505
505
  border_search_radius=10.0,
506
506
  border_search_neighbors=3,
507
- inlier_dims=slice(0, 2),
507
+ inlier_dims=slice(0, 2), # noqa: B008
508
508
  leafsize=24,
509
509
  density_strategy="sort",
510
510
  workers=-1,
@@ -599,7 +599,9 @@ def density_peaks(
599
599
  )
600
600
 
601
601
  if remove_clusters_smaller_than:
602
- labels = decrumb_labels(labels, min_size=remove_clusters_smaller_than, in_place=True)
602
+ labels = decrumb_labels(
603
+ labels, min_size=remove_clusters_smaller_than, in_place=True
604
+ )
603
605
 
604
606
  return dict(density=density, nhdn=nhdn, labels=labels, kdtree=kdtree)
605
607
 
@@ -796,7 +798,9 @@ def gmm_density_peaks(
796
798
  if remove_clusters_smaller_than:
797
799
  if show_progress:
798
800
  logger.info("Clean...")
799
- labels = decrumb_labels(labels, min_size=remove_clusters_smaller_than, in_place=True)
801
+ labels = decrumb_labels(
802
+ labels, min_size=remove_clusters_smaller_than, in_place=True
803
+ )
800
804
  res["labels"] = labels
801
805
 
802
806
  if mop:
@@ -5518,11 +5518,10 @@ def tree_groups(
5518
5518
  distances: Tensor, max_group_size: int, max_distance: float, link="complete"
5519
5519
  ) -> list[Tensor]:
5520
5520
  """Extract groups up to size max_group_size and (@link-linked) distances out to size max_distance."""
5521
- device = distances.device
5522
5521
  k = distances.shape[0]
5523
5522
  if k <= max_group_size and distances.max() <= max_distance:
5524
5523
  # this would be common when splitting.
5525
- return [torch.arange(k, device=device)]
5524
+ return [torch.arange(k)]
5526
5525
 
5527
5526
  if pnoid:
5528
5527
  assert not distances.isnan().any()
@@ -7054,6 +7053,9 @@ def _bootstrap_top(
7054
7053
  gen: torch.Generator,
7055
7054
  batch_size: int = 1024,
7056
7055
  ):
7056
+ if n_candidates == 1:
7057
+ return
7058
+
7057
7059
  # use a un_adj_lut index-dependent probability here to avoid re-using
7058
7060
  # the current label
7059
7061
  p = un_adj.T[un_adj_lut.b.neighb_ids]
@@ -7596,7 +7598,7 @@ def _update_lut_mean_batch(
7596
7598
 
7597
7599
  # constplogdet. add in the signal-rank-0-only terms.
7598
7600
  lut_params.constplogdet[i0:i1] = neighb_cov.nobs[nn].mul_(LOG_2PI) # type: ignore # ty: ignore[x]
7599
- lut_params.constplogdet[i0:i1] += neighb_cov.b.logdet[nn] # ty: ignore[not-subscriptable]
7601
+ lut_params.constplogdet[i0:i1] += neighb_cov.b.logdet[nn]
7600
7602
  if pnoid:
7601
7603
  assert lut_params.constplogdet[i0:i1].isfinite().all() # type: ignore # ty: ignore[x]
7602
7604
 
@@ -7656,7 +7658,7 @@ def _update_lut_ppca_batch(
7656
7658
  assert lut_params.Tpad is not None
7657
7659
  lut_params.Tpad[i0:i1, :, :-1] = T # type: ignore # ty: ignore[x]
7658
7660
  cap_logdet = L.diagonal(dim1=-2, dim2=-1).log().sum(dim=1).mul_(2.0)
7659
- lut_params.constplogdet[i0:i1] += cap_logdet # ty: ignore[not-subscriptable]
7661
+ lut_params.constplogdet[i0:i1] += cap_logdet
7660
7662
  if pnoid:
7661
7663
  assert lut_params.b.constplogdet[i0:i1].isfinite().all()
7662
7664
 
@@ -7751,8 +7753,13 @@ def _score_batch(
7751
7753
  )
7752
7754
 
7753
7755
  if do_resp:
7754
- toplls, topinds = torch.topk(lls[:, :-1], n_candidates, dim=1)
7756
+ n_top = min(n_candidates, Ctot)
7757
+ toplls, topinds = torch.topk(lls[:, :-1], n_top, dim=1)
7755
7758
  candidates = candidates.take_along_dim(indices=topinds, dim=1)
7759
+ if n_top < n_candidates:
7760
+ n_pad = n_candidates - n_top
7761
+ toplls = F.pad(toplls, (0, n_pad), value=-torch.inf)
7762
+ candidates = F.pad(candidates, (0, n_pad), value=-1)
7756
7763
  toplls = torch.concatenate((toplls, lls[:, -1:]), dim=1)
7757
7764
  else:
7758
7765
  toplls = lls
@@ -118,7 +118,7 @@ def precompute_displaced_registered_templates(
118
118
  geometry: np.ndarray,
119
119
  displacements: np.ndarray,
120
120
  sampling_frequency: float = 30000,
121
- template_subset=slice(None),
121
+ template_subset=slice(None), # noqa: B008
122
122
  ) -> DriftingTemplates:
123
123
  """Use spikeinterface tools to turn templates on registered geom into
124
124
  precomputed drifting templates on the regular geom.
@@ -134,7 +134,8 @@ def make_hybrid_recording(
134
134
  assert injected_sorting._recording is None
135
135
  assert target_recording.get_num_segments() == 1
136
136
  assert injected_sorting.get_num_segments() == 1
137
- assert injected_sorting.get_last_spike_frame() < target_recording.get_num_frames()
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
139
  assert abs(templates.sampling_frequency - target_sampling_frequency) < 10
139
140
 
140
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
74
+ noise_temporal_kernel = noise_temporal_kernel.astype(spatial_vt.dtype) + 0j # ty:ignore[no-matching-overload]
75
75
  noise = StationaryFactorizedNoise(
76
76
  spatial_std=spatial_std,
77
77
  vt_spatial=spatial_vt,
@@ -90,7 +90,7 @@ def generate_simulation(
90
90
  if folder is not None and not (overwrite or just_noise or no_save):
91
91
  try:
92
92
  return load_simulation(folder)
93
- except Exception: # noqa: BLE001, S110
93
+ except Exception:
94
94
  pass
95
95
 
96
96
  if noise_recording_folder is not None:
@@ -3,7 +3,7 @@ import sys
3
3
  import warnings
4
4
  from dataclasses import replace
5
5
  from pathlib import Path
6
- from typing import TYPE_CHECKING, Literal, cast
6
+ from typing import TYPE_CHECKING, Any, Literal, cast
7
7
 
8
8
  import h5py
9
9
  import numpy as np
@@ -343,7 +343,7 @@ def add_features(h5_path, recording, featurization_cfg, computation_cfg):
343
343
  _, feats = gt_pipeline(
344
344
  chunk, channels=cast(h5py.Dataset, h5["channels"])[sli]
345
345
  )
346
- for k in f_dsets: # noqa: PLC0206
346
+ for k in f_dsets:
347
347
  f_dsets[k][sli] = feats[k].numpy(force=True)
348
348
 
349
349
 
@@ -834,11 +834,11 @@ class InjectSpikesPreprocessor(BasePreprocessor):
834
834
 
835
835
  # arrays discovered in batches below
836
836
  f_dt = self.features_dtype
837
- inj_wf_shape = (
837
+ inj_wf_shape: tuple[int, int] = (
838
838
  self.spike_length_samples,
839
839
  self.extract_channel_index.shape[1],
840
840
  )
841
- dataset_shapes = {
841
+ dataset_shapes: dict[str, tuple[tuple[int, ...], Any]] = {
842
842
  "localizations": ((3,), f_dt),
843
843
  "displacements": ((), f_dt),
844
844
  "ptp_amplitudes": ((), f_dt),
@@ -1004,7 +1004,7 @@ class InjectSpikesPreprocessor(BasePreprocessor):
1004
1004
  try:
1005
1005
  recording = read_binary_folder(recording_dir)
1006
1006
  logger.info("Loaded %s", recording_dir)
1007
- except Exception: # noqa: BLE001
1007
+ except Exception:
1008
1008
  recording = None
1009
1009
  else:
1010
1010
  recording = None
@@ -140,10 +140,19 @@ def dartsort(
140
140
  ds_handle_link_from(cfg, output_dir)
141
141
 
142
142
  # preprocess
143
- copy_rec_flag = ds_will_copy_recording(cfg)
143
+ # saves provenance info (lightweight) about the preprocessing, including
144
+ # noise levels in standardization etc to a json file
144
145
  recording = preprocess(
145
- recording, cfg.preprocessing, cfg.already_preprocessed, cfg.preprocessing_dtype
146
+ recording,
147
+ output_dir=output_dir,
148
+ strategy=cfg.preprocessing,
149
+ already_preprocessed=cfg.already_preprocessed,
150
+ dtype=cfg.preprocessing_dtype,
146
151
  )
152
+
153
+ # determine if recording will be saved to a tmpdir and warn the user
154
+ # if they're going to hit a slow case
155
+ copy_rec_flag = ds_will_copy_recording(cfg, recording)
147
156
  check_recording(recording, copy_flag=copy_rec_flag)
148
157
 
149
158
  needs_dir = copy_rec_flag or cfg.work_in_tmpdir
@@ -10,11 +10,12 @@ Features
10
10
 
11
11
  Strategy
12
12
  - Pre-compute the convolutions of all pairs of temporal basis elements
13
- across all pairs of units
14
- - This is shared if the template basis is shared
15
- - Read off the pairwise convolutions by multiplication with the spatial basis
16
- as needed
17
- - This can be precomputed if there's no drift
13
+ (shared across units, since the template basis is shared)
14
+ - Pre-compute all pairs of units' inner products spatial components,
15
+ for each rank pair
16
+ - This is recomputed per chunk if there's drift
17
+ - Form the pairwise convolutions needed by each subtraction from these
18
+ two factors
18
19
 
19
20
  Coarse-to-fine approach
20
21
  - Objective is amplitude-scaled but not temporally upsampled
@@ -56,15 +57,10 @@ from ...util.logging_util import get_logger
56
57
  from ...util.motion import MotionInfo
57
58
  from ...util.noise_util import Whitener
58
59
  from ...util.py_util import databag, panic
59
- from ...util.spiketorch import full_shared_pconv, shared_temporal_pconv
60
+ from ...util.spiketorch import shared_temporal_pconv, spatial_gram
60
61
  from ...util.torch_util import torch_compiler
61
62
  from ...util.waveform_util import upsample_singlechan_torch
62
- from .matching_base import (
63
- ChunkTemplateData,
64
- MatchingPeaks,
65
- MatchingTemplates,
66
- subtract_precomputed_pconv,
67
- )
63
+ from .matching_base import ChunkTemplateData, MatchingPeaks, MatchingTemplates
68
64
 
69
65
  logger = get_logger(__name__)
70
66
 
@@ -149,6 +145,8 @@ class DriftyMatchingTemplates(MatchingTemplates):
149
145
  conv_up_temporal_comps = up_temporal_comps
150
146
  norm_discount = None
151
147
  tconv = shared_temporal_pconv(conv_temporal_comps, conv_up_temporal_comps)
148
+ # up, rank * rank, lags
149
+ up_major_tconv = tconv.permute(2, 0, 1, 3).reshape(up_factor, rank * rank, -1)
152
150
 
153
151
  assert temporal_comps.shape == (rank, self.spike_length_samples)
154
152
  self.register_buffer("conv_temporal_comps", conv_temporal_comps.contiguous())
@@ -161,7 +159,7 @@ class DriftyMatchingTemplates(MatchingTemplates):
161
159
  up_major_temporal_comps = up_temporal_comps.permute(1, 0, 2).contiguous()
162
160
  self.register_buffer_or_none("up_major_temporal_comps", up_major_temporal_comps)
163
161
  self.register_buffer("spatial_sing", spatial_sing.contiguous())
164
- self.register_buffer("tconv", tconv)
162
+ self.register_buffer("up_major_tconv", up_major_tconv.contiguous())
165
163
  if unit_ids is None:
166
164
  unit_ids = torch.arange(self.n_units, device=device)
167
165
  self.register_buffer("unit_ids", unit_ids)
@@ -188,17 +186,14 @@ class DriftyMatchingTemplates(MatchingTemplates):
188
186
  conv_spatial_sing = conv_spatial_sing.contiguous()
189
187
  self.register_buffer_or_none("conv_spatial_sing", conv_spatial_sing)
190
188
 
191
- # full pconv can be precomputed when not interpolating
192
- if not self.interpolating:
193
- if self.whiten_strategy == "postwhiten":
194
- pconv = full_shared_pconv(self.b.tconv, self.b.spatial_sing)
195
- elif self.whiten_strategy == "prewhiten_postapply":
196
- pconv = full_shared_pconv(self.b.tconv, self.b.conv_spatial_sing)
197
- else:
198
- pconv = full_shared_pconv(self.b.tconv, self.b.spatial_sing)
189
+ # spatial gram can be precomputed when not interpolating
190
+ if self.interpolating:
191
+ sgram = None
192
+ elif self.whiten_strategy == "prewhiten_postapply":
193
+ sgram = spatial_gram(self.b.conv_spatial_sing)
199
194
  else:
200
- pconv = None
201
- self.register_buffer_or_none("pconv", pconv)
195
+ sgram = spatial_gram(self.b.spatial_sing)
196
+ self.register_buffer_or_none("sgram", sgram)
202
197
 
203
198
  # indexing helpers
204
199
  t = self.spike_length_samples
@@ -325,15 +320,15 @@ class DriftyMatchingTemplates(MatchingTemplates):
325
320
  normsq = normsq_by_chan.sum(dim=1)
326
321
 
327
322
  # normsq is always the pconv one
328
- if self.b.pconv is None:
329
- pconv = full_shared_pconv(self.b.tconv, normsq_spatial_sing)
323
+ if self.b.sgram is None:
324
+ sgram = spatial_gram(normsq_spatial_sing)
330
325
  else:
331
- pconv = self.b.pconv
326
+ sgram = self.b.sgram
332
327
 
333
328
  # padded spatial sing is used for clean wfs only
334
329
  padded_spatial_sing = F.pad(spatial_sing, (0, 1))
335
330
 
336
- return conv_spatial_sing, normsq, main_channels, padded_spatial_sing, pconv
331
+ return conv_spatial_sing, normsq, main_channels, padded_spatial_sing, sgram
337
332
 
338
333
  def data_at_time(
339
334
  self,
@@ -346,7 +341,7 @@ class DriftyMatchingTemplates(MatchingTemplates):
346
341
  scale_max: float,
347
342
  resid_offset: int,
348
343
  ) -> ChunkTemplateData:
349
- spatial_sing, normsq, main_channels, padded_spatial_sing, pconv = (
344
+ spatial_sing, normsq, main_channels, padded_spatial_sing, sgram = (
350
345
  self.spatial_at_time(t_s=t_s)
351
346
  )
352
347
  obj_normsq_plus_inv_lambda = normsq[:, None] + inv_lambda
@@ -374,7 +369,8 @@ class DriftyMatchingTemplates(MatchingTemplates):
374
369
  conv_temporal_comps=self.b.conv_temporal_comps,
375
370
  up_major_temporal_comps=self.b.up_major_temporal_comps,
376
371
  spatial_sing=spatial_sing,
377
- pconv=pconv,
372
+ sgram=sgram,
373
+ up_major_tconv=self.b.up_major_tconv,
378
374
  time_ix=self.b.time_ix,
379
375
  sub_time_ix=self.b.sub_time_ix + resid_offset,
380
376
  chan_ix=self.b.chan_ix,
@@ -412,7 +408,8 @@ class DriftyChunkTemplateData(ChunkTemplateData):
412
408
  up_major_temporal_comps: Tensor
413
409
  spatial_sing: Tensor
414
410
  padded_spatial_sing: Tensor
415
- pconv: Tensor
411
+ sgram: Tensor
412
+ up_major_tconv: Tensor
416
413
  spatial_whitener: Whitener | None
417
414
 
418
415
  time_ix: Tensor
@@ -479,14 +476,14 @@ class DriftyChunkTemplateData(ChunkTemplateData):
479
476
  )
480
477
 
481
478
  def subtract_conv(
482
- self, conv: Tensor, peaks: "MatchingPeaks", padding=0, batch_size=256, sign=-1
479
+ self, conv: Tensor, peaks: "MatchingPeaks", padding=0, batch_size=128, sign=-1
483
480
  ):
484
- subtract_precomputed_pconv(
481
+ _subtract_kron_pconv(
485
482
  conv=conv,
486
- pconv=self.pconv,
483
+ sgram=self.sgram,
484
+ up_major_tconv=self.up_major_tconv,
487
485
  peaks=peaks,
488
- padding=padding,
489
- conv_lags=self.conv_lags,
486
+ padded_conv_lags=padding + self.conv_lags,
490
487
  sign=sign,
491
488
  batch_size=batch_size,
492
489
  )
@@ -705,6 +702,42 @@ def convolve_lowrank_shared(
705
702
  return out
706
703
 
707
704
 
705
+ def _subtract_kron_pconv(
706
+ *,
707
+ conv: Tensor,
708
+ sgram: Tensor,
709
+ up_major_tconv: Tensor,
710
+ peaks: MatchingPeaks,
711
+ padded_conv_lags: Tensor,
712
+ sign: int,
713
+ batch_size: int,
714
+ ):
715
+ assert sign in (-1, 1)
716
+ if not peaks.n_spikes:
717
+ return
718
+ assert peaks.times is not None
719
+ assert peaks.template_inds is not None
720
+ n_units = conv.shape[0]
721
+ n_spikes = peaks.n_spikes
722
+ _, rank_sq, n_lags = up_major_tconv.shape
723
+ assert sgram.shape == (n_units, n_units, rank_sq)
724
+ assert padded_conv_lags.shape == (n_lags,)
725
+
726
+ if peaks.up_inds is None:
727
+ spike_tconv = up_major_tconv[0].broadcast_to(n_spikes, rank_sq, n_lags)
728
+ else:
729
+ spike_tconv = up_major_tconv[peaks.up_inds]
730
+ if peaks.scalings is not None:
731
+ spike_tconv = spike_tconv * peaks.scalings[:, None, None]
732
+
733
+ ix_time = (peaks.times[:, None] + padded_conv_lags).view(-1)
734
+ for i0 in range(0, n_units, batch_size):
735
+ i1 = min(n_units, i0 + batch_size)
736
+ batch = torch.bmm(sgram[peaks.template_inds, i0:i1], spike_tconv)
737
+ batch = batch.permute(1, 0, 2).reshape(i1 - i0, n_spikes * n_lags)
738
+ conv[i0:i1].index_add_(dim=1, index=ix_time, source=batch, alpha=sign)
739
+
740
+
708
741
  # -- fine matching
709
742
 
710
743
 
@@ -209,12 +209,8 @@ class ChunkTemplateData:
209
209
  def unsubtract(self, traces: Tensor, peaks: "MatchingPeaks"):
210
210
  return self.subtract(traces, peaks, sign=1)
211
211
 
212
- def unsubtract_conv(
213
- self, conv: Tensor, peaks: "MatchingPeaks", padding=0, batch_size=256
214
- ):
215
- return self.subtract_conv(
216
- conv=conv, peaks=peaks, padding=padding, batch_size=batch_size, sign=1
217
- )
212
+ def unsubtract_conv(self, conv: Tensor, peaks: "MatchingPeaks", padding=0):
213
+ return self.subtract_conv(conv=conv, peaks=peaks, padding=padding, sign=1)
218
214
 
219
215
  def obj_from_conv(
220
216
  self,
@@ -18,6 +18,7 @@ from ..util.internal_config import (
18
18
  from ..util.job_util import ensure_computation_config
19
19
  from ..util.logging_util import get_logger, progrange
20
20
  from ..util.motion import MotionInfo
21
+ from ..util.py_util import panic
21
22
  from ..util.spiketorch import ptp
22
23
  from ..util.torch_util import torch_compile
23
24
  from .templates import TemplateData
@@ -205,7 +206,7 @@ def estimate_offset(
205
206
  offsets = torch.round(offsets).long()
206
207
  return offsets - padded_trough_offset_samples
207
208
 
208
- assert False
209
+ panic(strategy)
209
210
 
210
211
 
211
212
  def realign_templates(
@@ -236,7 +237,7 @@ def realign_templates(
236
237
  elif realign_strategy.startswith("ampsq_weighted"):
237
238
  main_channels = np.ptp(templates).max(1).argmax(1)
238
239
  else:
239
- assert False
240
+ panic(realign_strategy)
240
241
  assert main_channels is not None
241
242
 
242
243
  # find template peak time
@@ -368,7 +369,7 @@ def dredge_realign(
368
369
  main_channels = snrs_by_channel.argmax(1)
369
370
 
370
371
  # start with trough alignment
371
- main_channels, main_channel_traces, offsets = get_main_channels_and_alignments(
372
+ main_channels, _main_channel_traces, offsets = get_main_channels_and_alignments(
372
373
  None,
373
374
  trough_factor=trough_factor,
374
375
  templates=templates.numpy(force=True),
@@ -14,6 +14,7 @@ from ..util.internal_config import (
14
14
  )
15
15
  from ..util.logging_util import get_logger
16
16
  from ..util.motion import MotionInfo
17
+ from ..util.py_util import panic
17
18
  from ..util.spikeio import read_waveforms_channel_index
18
19
  from ..util.waveform_util import make_channel_index
19
20
 
@@ -183,7 +184,7 @@ def denoising_weights(
183
184
  elif edge_behavior == "raw":
184
185
  snc = snrs
185
186
  else:
186
- assert False
187
+ panic(edge_behavior)
187
188
 
188
189
  # pass it through a hand picked squashing function
189
190
  wntc = 1.0 / (1.0 + np.exp(d + a * vt[None, :, None] - b * snc[:, None, :]))
@@ -164,7 +164,7 @@ class BaseWaveformModule(BModule):
164
164
  self.initialize_spike_length_dependent_params()
165
165
 
166
166
  if self.submodule_names:
167
- for sn, smk in zip(self.submodule_names, all_submodule_keys):
167
+ for sn, smk in zip(self.submodule_names, all_submodule_keys, strict=True):
168
168
  sn_dict = {smk: state_dict[smk]}
169
169
  getattr(self, sn)._pre_load_state(sn_dict, prefix, *args, **kwargs)
170
170
 
@@ -153,7 +153,7 @@ class DARTsortSorting:
153
153
  ) -> NumpySorting:
154
154
  """Clean up and produce a spikeinterface NumpySorting object."""
155
155
  if drop_doubles:
156
- self = self.drop_doubles() # noqa: PLW0642
156
+ self = self.drop_doubles()
157
157
  assert self.labels is not None
158
158
  st = self.drop_missing()
159
159
  assert st.labels is not None
@@ -1096,7 +1096,7 @@ class DARTsortSorting:
1096
1096
  yield chunk
1097
1097
 
1098
1098
  def slice_feature_by_name(
1099
- self, dataset_name: str, mask: np.ndarray | slice = slice(None)
1099
+ self, dataset_name: str, mask: np.ndarray | slice = slice(None) # noqa: B008
1100
1100
  ) -> np.ndarray:
1101
1101
  if hasattr(self, dataset_name):
1102
1102
  return getattr(self, dataset_name)[mask]
@@ -2279,7 +2279,7 @@ def fit_reweighting(
2279
2279
  if h5 is not None:
2280
2280
  voltages: np.ndarray = h5[voltages_dataset_name][:]
2281
2281
  elif hdf5_path is not None:
2282
- with h5py.File(hdf5_path) as h5: # noqa: PLR1704
2282
+ with h5py.File(hdf5_path) as h5:
2283
2283
  voltages: np.ndarray = h5[voltages_dataset_name][:]
2284
2284
  else:
2285
2285
  panic()
@@ -1544,6 +1544,8 @@ def _post_refinement_cfgs(
1544
1544
  collision_cleaning_error_threshold=cfg.collision_cleaning_error_threshold,
1545
1545
  )
1546
1546
  if cc_flag_active:
1547
+ assert isinstance(initial_detection_cfg, SubtractionConfig)
1548
+ temporal_dedup_radius = initial_detection_cfg.temporal_dedup_radius_samples
1547
1549
  filter_cfg = replace(
1548
1550
  filter_cfg,
1549
1551
  max_cc_flag_rate=cfg.max_cc_flag_rate,
@@ -1551,11 +1553,9 @@ def _post_refinement_cfgs(
1551
1553
  cc_flag_excess_rate=cfg.cc_flag_excess_rate,
1552
1554
  cc_flag_chance_jitter_samples=cfg.cc_flag_chance_jitter_samples,
1553
1555
  cc_flag_chance_draws=cfg.cc_flag_chance_draws,
1554
- cc_flag_temporal_radius_samples=(
1555
- cfg.cc_flag_temporal_radius_samples
1556
- or initial_detection_cfg.temporal_dedup_radius_samples
1557
- ),
1558
- cc_flag_dedup_temporal_radius_samples=initial_detection_cfg.temporal_dedup_radius_samples,
1556
+ cc_flag_temporal_radius_samples=cfg.cc_flag_temporal_radius_samples
1557
+ or temporal_dedup_radius,
1558
+ cc_flag_dedup_temporal_radius_samples=temporal_dedup_radius,
1559
1559
  cc_flag_spatial_dedup_radius_um=initial_detection_cfg.spatial_dedup_radius_um,
1560
1560
  cc_flag_radius_um=initial_detection_cfg.subtract_radius_um,
1561
1561
  )