DARTsort 0.5.16__tar.gz → 0.5.17__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 (175) hide show
  1. {dartsort-0.5.16 → dartsort-0.5.17}/.github/workflows/ci.yml +1 -0
  2. {dartsort-0.5.16 → dartsort-0.5.17}/PKG-INFO +1 -1
  3. {dartsort-0.5.16 → dartsort-0.5.17}/pyproject.toml +4 -1
  4. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/__init__.py +0 -1
  5. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/agglomerate.py +0 -1
  6. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/clustering.py +1 -6
  7. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/clustering_features.py +2 -4
  8. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/density.py +16 -12
  9. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/merge.py +1 -1
  10. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/mixture.py +6 -7
  11. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/refine_util.py +6 -59
  12. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/config.py +3 -3
  13. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/detect/detect.py +10 -9
  14. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/evaluate/comparison.py +83 -82
  15. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/evaluate/hybrid_util.py +8 -6
  16. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/localize/localize_torch.py +6 -5
  17. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/main.py +11 -9
  18. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/grab.py +6 -4
  19. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/matching.py +2 -0
  20. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/matching_util/compressed_upsampled.py +3 -0
  21. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/matching_util/drifty.py +6 -1
  22. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/matching_util/matching_base.py +3 -1
  23. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/peel_base.py +26 -27
  24. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/peel_lib.py +19 -17
  25. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/subtract.py +2 -1
  26. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/amortized_localization.py +12 -13
  27. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/decollider.py +1 -1
  28. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/whiten.py +4 -1
  29. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/drift_util.py +3 -3
  30. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/internal_config.py +7 -5
  31. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/interpolation_util.py +17 -16
  32. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/motion.py +12 -12
  33. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/noise_util.py +11 -61
  34. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/spiketorch.py +5 -4
  35. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/testing_util/matching_debug_util.py +10 -6
  36. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -3
  37. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/waveform_util.py +17 -23
  38. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/mixture.py +25 -24
  39. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/vismain.py +7 -5
  40. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort.egg-info/PKG-INFO +1 -1
  41. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_dartsort.py +10 -5
  42. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_matching.py +14 -11
  43. {dartsort-0.5.16 → dartsort-0.5.17}/.github/workflows/ci_windows.yml +0 -0
  44. {dartsort-0.5.16 → dartsort-0.5.17}/.github/workflows/deploy.yml +0 -0
  45. {dartsort-0.5.16 → dartsort-0.5.17}/.github/workflows/docs.yml +0 -0
  46. {dartsort-0.5.16 → dartsort-0.5.17}/.gitignore +0 -0
  47. {dartsort-0.5.16 → dartsort-0.5.17}/README.md +0 -0
  48. {dartsort-0.5.16 → dartsort-0.5.17}/docs/index.md +0 -0
  49. {dartsort-0.5.16 → dartsort-0.5.17}/docs/main_api.md +0 -0
  50. {dartsort-0.5.16 → dartsort-0.5.17}/docs/toolkit_api.md +0 -0
  51. {dartsort-0.5.16 → dartsort-0.5.17}/environment.yml +0 -0
  52. {dartsort-0.5.16 → dartsort-0.5.17}/notebook/.keep +0 -0
  53. {dartsort-0.5.16 → dartsort-0.5.17}/notebook/ibl_dandi_example.py +0 -0
  54. {dartsort-0.5.16 → dartsort-0.5.17}/setup.cfg +0 -0
  55. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/cli.py +0 -0
  56. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/__init__.py +0 -0
  57. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/cluster_util.py +0 -0
  58. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/forward_backward.py +0 -0
  59. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/kmeans.py +0 -0
  60. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/clustering/modes.py +0 -0
  61. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/detect/__init__.py +0 -0
  62. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/detect/detect_filters.py +0 -0
  63. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/evaluate/__init__.py +0 -0
  64. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/evaluate/analysis.py +0 -0
  65. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/evaluate/noise_recording_tools.py +0 -0
  66. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/evaluate/sim_template_tools.py +0 -0
  67. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/evaluate/simkit.py +0 -0
  68. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/evaluate/simlib.py +0 -0
  69. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/localize/__init__.py +0 -0
  70. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/localize/localize_util.py +0 -0
  71. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/__init__.py +0 -0
  72. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/matching_util/__init__.py +0 -0
  73. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/matching_util/pairwise.py +0 -0
  74. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
  75. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/reduction_template.py +0 -0
  76. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/shaver.py +0 -0
  77. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/peel/threshold.py +0 -0
  78. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
  79. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/detect_np1.pt +0 -0
  80. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/detect_np2.pt +0 -0
  81. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/glasbey1024.npz +0 -0
  82. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
  83. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
  84. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
  85. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
  86. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
  87. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/templates/__init__.py +0 -0
  88. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/templates/get_templates.py +0 -0
  89. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/templates/postprocess_util.py +0 -0
  90. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/templates/realignment.py +0 -0
  91. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/templates/template_util.py +0 -0
  92. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/templates/templates.py +0 -0
  93. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/templates/templib.py +0 -0
  94. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/__init__.py +0 -0
  95. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/_multichan_denoiser_kit.py +0 -0
  96. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/all_transformers.py +0 -0
  97. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/amplitudes.py +0 -0
  98. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/denoising_scorer.py +0 -0
  99. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/enforce_decrease.py +0 -0
  100. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/fixed_prop.py +0 -0
  101. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/interp.py +0 -0
  102. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/localize.py +0 -0
  103. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/matching_denoiser.py +0 -0
  104. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/mixture_classifier.py +0 -0
  105. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/pipeline.py +0 -0
  106. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/reduction.py +0 -0
  107. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/single_channel_denoiser.py +0 -0
  108. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/supervised_denoiser.py +0 -0
  109. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/temporal_pca.py +0 -0
  110. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/transform/transform_base.py +0 -0
  111. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/__init__.py +0 -0
  112. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/cli_util.py +0 -0
  113. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/data_util.py +0 -0
  114. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/job_util.py +0 -0
  115. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/logging_util.py +0 -0
  116. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/main_util.py +0 -0
  117. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/more_operators.py +0 -0
  118. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/multiprocessing_util.py +0 -0
  119. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/nn_util.py +0 -0
  120. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/peel_util.py +0 -0
  121. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/preprocess_util.py +0 -0
  122. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/py_util.py +0 -0
  123. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/registration_util.py +0 -0
  124. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/residual_util.py +0 -0
  125. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/sparse_util.py +0 -0
  126. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/spikeio.py +0 -0
  127. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/testing_util/__init__.py +0 -0
  128. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/torch_optimization_util.py +0 -0
  129. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/util/torch_util.py +0 -0
  130. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/__init__.py +0 -0
  131. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/analysis_plots.py +0 -0
  132. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/colors.py +0 -0
  133. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/gt.py +0 -0
  134. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/layout.py +0 -0
  135. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/metrics_util.py +0 -0
  136. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/recanim.py +0 -0
  137. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/scatterplots.py +0 -0
  138. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/sorting.py +0 -0
  139. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/unit.py +0 -0
  140. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/unit_comparison.py +0 -0
  141. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/versus.py +0 -0
  142. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort/vis/waveforms.py +0 -0
  143. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort.egg-info/SOURCES.txt +0 -0
  144. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort.egg-info/dependency_links.txt +0 -0
  145. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort.egg-info/entry_points.txt +0 -0
  146. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort.egg-info/requires.txt +0 -0
  147. {dartsort-0.5.16 → dartsort-0.5.17}/src/dartsort.egg-info/top_level.txt +0 -0
  148. {dartsort-0.5.16 → dartsort-0.5.17}/tests/conftest.py +0 -0
  149. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_agglomerate.py +0 -0
  150. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_alignment.py +0 -0
  151. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_cluster_util.py +0 -0
  152. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_clustering.py +0 -0
  153. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_config.py +0 -0
  154. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_data_util.py +0 -0
  155. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_density.py +0 -0
  156. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_detect.py +0 -0
  157. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_drift_util.py +0 -0
  158. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_drifty_matching.py +0 -0
  159. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_enforce_decrease.py +0 -0
  160. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_grab_and_featurize.py +0 -0
  161. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_kmeans.py +0 -0
  162. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_linalg.py +0 -0
  163. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_localize_torch.py +0 -0
  164. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_mixture_classifier.py +0 -0
  165. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_modeling.py +0 -0
  166. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_simkit.py +0 -0
  167. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_spiketorch.py +0 -0
  168. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_subtract.py +0 -0
  169. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_templates.py +0 -0
  170. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_threshold.py +0 -0
  171. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_torch_optimization_util.py +0 -0
  172. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_transform.py +0 -0
  173. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_util.py +0 -0
  174. {dartsort-0.5.16 → dartsort-0.5.17}/tests/test_waveform_util.py +0 -0
  175. {dartsort-0.5.16 → dartsort-0.5.17}/zensical.toml +0 -0
@@ -46,3 +46,4 @@ jobs:
46
46
  uses: coverallsapp/github-action@master
47
47
  with:
48
48
  path-to-lcov: coverage.lcov
49
+ fail-on-error: false
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dartsort
3
- Version: 0.5.16
3
+ Version: 0.5.17
4
4
  Summary: DARTsort
5
5
  Author-email: Charlie Windolf <ciw2048@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/cwindolf/dartsort
@@ -75,7 +75,10 @@ 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"]
78
+ ignore = ["F722", "N812", "SIM102", "SIM108", "E501", "N806", "N803", "N815", "RUF005", "SIM300", "C408"]
79
+
80
+ [tool.ruff.lint.per-file-ignores]
81
+ "**/__init__.py" = ["F401", "F403"]
79
82
 
80
83
  [tool.jupytext]
81
84
  "formats" = "ipynb,py:percent"
@@ -26,7 +26,6 @@ from .main import (
26
26
  DARTsortResult,
27
27
  ObjectiveUpdateTemplateMatchingPeeler,
28
28
  SubtractionPeeler,
29
- check_recording,
30
29
  cluster,
31
30
  dartsort,
32
31
  grab,
@@ -607,7 +607,6 @@ class QDACtx:
607
607
 
608
608
 
609
609
  def _qda_init(ctx):
610
- global _qda_context
611
610
  _qda_context.ctx = ctx
612
611
 
613
612
 
@@ -159,12 +159,7 @@ class Clusterer:
159
159
  mask_ix = np.flatnonzero(features.keep_mask)
160
160
  else:
161
161
  mask_ix = None
162
- if self.sampling_cfg is None:
163
- if mask_ix is not None:
164
- return True, mask_ix
165
- else:
166
- return False, slice(None)
167
- elif features.n <= self.sampling_cfg.n_waveforms_fit:
162
+ if self.sampling_cfg is None or features.n <= self.sampling_cfg.n_waveforms_fit:
168
163
  if mask_ix is not None:
169
164
  return True, mask_ix
170
165
  else:
@@ -1,5 +1,4 @@
1
1
  from typing import Self, cast
2
- from logging import WARN
3
2
 
4
3
  import h5py
5
4
  import numpy as np
@@ -131,7 +130,6 @@ class SimpleMatrixFeatures:
131
130
  samp = amp * np.sign(v)
132
131
 
133
132
  if clustering_features_cfg.use_signed_amplitude:
134
- samp *= clustering_features_cfg.amp_scale
135
133
  features.append(clustering_features_cfg.amp_scale * samp[:, None])
136
134
 
137
135
  do_pcs = bool(clustering_features_cfg.n_main_channel_pcs)
@@ -170,7 +168,7 @@ class SimpleMatrixFeatures:
170
168
  pcs,
171
169
  raise_for_numerics=clustering_features_cfg.raise_for_numerics,
172
170
  )
173
- erp, pcs = interpolate_by_chunk(
171
+ _erp, pcs = interpolate_by_chunk(
174
172
  mask=mask,
175
173
  dataset=pcs,
176
174
  geom=motion.geom,
@@ -190,7 +188,7 @@ class SimpleMatrixFeatures:
190
188
  else:
191
189
  assert sorting.parent_h5_path is not None
192
190
  with h5py.File(sorting.parent_h5_path, "r", locking=False) as h5:
193
- erp, pcs = interpolate_by_chunk(
191
+ _erp, pcs = interpolate_by_chunk(
194
192
  mask=mask,
195
193
  dataset=h5[clustering_features_cfg.pca_dataset_name],
196
194
  geom=motion.geom,
@@ -105,7 +105,10 @@ def get_smoothed_density(
105
105
  )
106
106
  nbins = np.ceil(dextents / bin_sizes).astype(int)
107
107
  nbins = nbins.clip(min_n_bins, max_n_bins)
108
- bin_edges = [np.linspace(e[0], e[1], num=nb + 1) for e, nb in zip(extents, nbins)]
108
+ bin_edges = [
109
+ np.linspace(e[0], e[1], num=nb + 1)
110
+ for e, nb in zip(extents, nbins, strict=True)
111
+ ]
109
112
 
110
113
  # compute histogram and figure out how big the bins actually were
111
114
  raw_histogram, bin_edges = np.histogramdd(infeats, bins=bin_edges)
@@ -178,7 +181,7 @@ def get_smoothed_density_ratio(
178
181
  max_n_bins=max_n_bins,
179
182
  min_n_bins=min_n_bins,
180
183
  )
181
- for sigma, sigma_low in zip(sigmas, sigma_lows)
184
+ for sigma, sigma_low in zip(sigmas, sigma_lows, strict=True)
182
185
  ]
183
186
  if len(sigmas) == 1:
184
187
  return dens[0]
@@ -233,7 +236,7 @@ def nearest_higher_density_neighbor(
233
236
  def remove_border_points(
234
237
  labels, density, kdtree, search_radius=1.0, n_neighbors_search=5, workers=1
235
238
  ):
236
- distances, indices = kdtree.query(
239
+ _distances, indices = kdtree.query(
237
240
  kdtree.data,
238
241
  k=1 + n_neighbors_search,
239
242
  distance_upper_bound=search_radius,
@@ -249,7 +252,7 @@ def remove_border_points(
249
252
 
250
253
  units = np.unique(labels)
251
254
  new_labels = labels.copy()
252
- for i, u in enumerate(units[units > 0]):
255
+ for u in units[units > 0]:
253
256
  in_unit = np.flatnonzero(labels == u)
254
257
  in_unit_border = in_border[labels_in_border == u]
255
258
  if not in_unit_border.size:
@@ -266,7 +269,7 @@ def sort_density(
266
269
  sigma0: float,
267
270
  sigma1: float,
268
271
  max_sigma: float = 3.0,
269
- device: torch.device = torch.device("cpu"),
272
+ device: torch.device | str = "cpu",
270
273
  batch_size: int = 2048,
271
274
  col_batch_size: int = 1024,
272
275
  show_progress: bool = False,
@@ -295,6 +298,7 @@ def sort_density(
295
298
  np.ndarray
296
299
  The density ratio for each point in X.
297
300
  """
301
+ device = torch.device(device)
298
302
  X = torch.asarray(X, device=device)
299
303
  order = torch.argsort(X[:, 0])
300
304
  X = X[order]
@@ -313,7 +317,7 @@ def sort_density(
313
317
  n1 = X.new_tensor(-0.5 * dim * np.log(2.0 * np.pi * sigma1 * sigma1))
314
318
 
315
319
  if show_progress:
316
- iter = progrange(0, n, batch_size, desc=f'SortDens:{device.type}')
320
+ iter = progrange(0, n, batch_size, desc=f"SortDens:{device.type}")
317
321
  else:
318
322
  iter = range(0, n, batch_size)
319
323
 
@@ -384,7 +388,7 @@ def kdt_density(
384
388
  max_sigma: float = 3.0,
385
389
  n_threads=8,
386
390
  ):
387
- n, d = X.shape
391
+ n = X.shape[0]
388
392
  max_dist = max_sigma * sigma_regional
389
393
 
390
394
  jobs = range(0, n, batch_size)
@@ -506,7 +510,7 @@ def density_peaks(
506
510
  leafsize=24,
507
511
  density_strategy="sort",
508
512
  workers=-1,
509
- device: torch.device = torch.device("cpu"),
513
+ device: torch.device | str = "cpu",
510
514
  ):
511
515
  """Density peaks clustering as described by Rodriguez and Laio, but...
512
516
 
@@ -584,7 +588,7 @@ def density_peaks(
584
588
  has_nhdn = np.flatnonzero(nhdn < n).astype(np.intc)
585
589
  data = np.ones(has_nhdn.size)
586
590
  graph = coo_array((data, (nhdn[has_nhdn], has_nhdn)), shape=(n, n))
587
- ncc, labels = connected_components(graph)
591
+ _ncc, labels = connected_components(graph)
588
592
 
589
593
  if remove_borders:
590
594
  labels = remove_border_points(
@@ -724,7 +728,7 @@ def gmm_density_peaks(
724
728
 
725
729
  Xi = X[choices]
726
730
  nc = len(Xi)
727
- inliers, kdtree = kdtree_inliers(
731
+ inliers, _kdtree = kdtree_inliers(
728
732
  Xi,
729
733
  n_neighbors=outlier_neighbor_count,
730
734
  distance_upper_bound=outlier_radius * np.sqrt(X.shape[1]),
@@ -735,7 +739,7 @@ def gmm_density_peaks(
735
739
 
736
740
  Xi = X[inliers]
737
741
  ni = len(Xi)
738
- uchans, cchans = np.unique(channels[inliers], return_counts=True)
742
+ _uchans, cchans = np.unique(channels[inliers], return_counts=True)
739
743
  comps_per_chan = np.minimum(
740
744
  max_components_per_channel,
741
745
  np.ceil(cchans / min_spikes_per_component).astype(int),
@@ -1211,7 +1215,7 @@ def _density_peaks_clustering_uhd_implementation(
1211
1215
  )
1212
1216
 
1213
1217
  graph = coo_array((np.ones(2 * has_nhdn.size), rc), shape=(n, n))
1214
- ncc, labels = connected_components(graph, directed=False)
1218
+ _ncc, labels = connected_components(graph, directed=False)
1215
1219
 
1216
1220
  if remove_borders:
1217
1221
  labels = remove_border_points(
@@ -185,7 +185,7 @@ def calculate_merge_distances(
185
185
  np.fill_diagonal(dists, 0.0) # sometimes numerical 0 is -1e-6.
186
186
  min_dist = dists.min()
187
187
  if min_dist < -1e-3:
188
- warnings.warn(f"Alarmingly negative min distance {min_dist}.")
188
+ warnings.warn(f"Alarmingly negative min distance {min_dist}.", stacklevel=2)
189
189
  dists = np.maximum(dists, 0.0, out=dists)
190
190
 
191
191
  return units, dists, shifts, template_snrs
@@ -1934,8 +1934,7 @@ class TruncatedSpikeData(BatchedSpikeData):
1934
1934
  d[:n_units_new, :n_units_new] = distances
1935
1935
  d[n_units_new:, n_units_new:].fill_diagonal_(0.0)
1936
1936
  distances = d
1937
- if n_new:
1938
- self.update_adjacency(n_units=n_units_new + n_new)
1937
+ self.update_adjacency(n_units=n_units_new + n_new)
1939
1938
  if pnoid and distances is not None:
1940
1939
  _max_cand = self.candidates.amax()
1941
1940
  assert _max_cand < distances.shape[0], f"{_max_cand} {distances.shape}"
@@ -3263,9 +3262,9 @@ class TruncatedMixtureModel(BaseMixtureModel):
3263
3262
  max_group_size=max(1, self.p.split_k - 1),
3264
3263
  )
3265
3264
  if _stop_after:
3266
- split_groups = list(
3265
+ split_groups = [
3267
3266
  sg for _, sg in zip(range(_stop_after), split_groups, strict=False)
3268
- )
3267
+ ]
3269
3268
  if show_progress:
3270
3269
  split_groups = progbar(split_groups, desc="Split", smoothing=0.0)
3271
3270
 
@@ -4414,14 +4413,14 @@ def get_full_neighborhood_data(
4414
4413
  ):
4415
4414
  in_unit = np.flatnonzero(sorting.labels == uid)
4416
4415
  if in_unit.size > fit_count:
4417
- fit_ixs = rg.choice(in_unit, size=fit_count)
4416
+ fit_ixs = rg.choice(in_unit, size=fit_count, replace=False)
4418
4417
  fit_ixs.sort()
4419
4418
  elif in_unit.size == fit_count:
4420
4419
  fit_ixs = in_unit
4421
4420
  else:
4422
4421
  panic()
4423
4422
  if fit_ixs.size > train_count:
4424
- train_ixs = rg.choice(fit_ixs, size=train_count)
4423
+ train_ixs = rg.choice(fit_ixs, size=train_count, replace=False)
4425
4424
  train_ixs.sort()
4426
4425
  elif fit_ixs.size == train_count:
4427
4426
  train_ixs = fit_ixs
@@ -5535,7 +5534,7 @@ def evaluate_group_demolitions(
5535
5534
  if mean_eval_resp is None:
5536
5535
  mean_eval_resp = mean_responsibilities(scores=eval_scores, n_units=mm.n_units)
5537
5536
  ratio = mean_train_resp[group] / mean_eval_resp[group]
5538
- can_demolish = ratio > 0 # mm.p.demolition_min_resp_ratio
5537
+ can_demolish = ratio > mm.p.demolition_min_resp_ratio
5539
5538
 
5540
5539
  if not can_demolish.any():
5541
5540
  return GroupDemolition(unit_ids=group, improvement=0.0, demolished=None)
@@ -1,7 +1,6 @@
1
1
  from threading import local
2
2
  from typing import cast
3
3
 
4
- import h5py
5
4
  import numba
6
5
  import numpy as np
7
6
  import torch
@@ -12,7 +11,6 @@ from spikeinterface.core.baserecording import BaseRecording
12
11
 
13
12
  from dartsort.clustering.mixture import Scores
14
13
 
15
- from ..transform.temporal_pca import BaseTemporalPCA
16
14
  from ..util import data_util, spiketorch
17
15
  from ..util.internal_config import ComputationConfig, RefinementConfig
18
16
  from ..util.logging_util import DARTSORTDEBUG, DARTSORTVERBOSE, get_logger, progbar
@@ -25,57 +23,6 @@ from .clustering_features import StableWaveformFeatures
25
23
  logger = get_logger(__name__)
26
24
 
27
25
 
28
- def get_noise_log_priors(noise, sorting, refinement_cfg):
29
- from dartsort.templates import TemplateData
30
-
31
- if not refinement_cfg.noise_fp_correction:
32
- return None
33
-
34
- h5_name = sorting.parent_h5_path
35
- if h5_name is None:
36
- return None
37
- stem = h5_name.stem
38
-
39
- if stem.startswith("matching"):
40
- model_dir = h5_name.parent / f"{stem}_models"
41
- templates_npz = model_dir / "template_data.npz"
42
- if not templates_npz.exists():
43
- raise ValueError(f"{templates_npz} is not there?")
44
-
45
- with h5py.File(h5_name, "r", locking=False) as h5:
46
- matching_labels = h5["labels"][:]
47
-
48
- template_data = TemplateData.from_npz(templates_npz)
49
- tpca = data_util.get_tpca(sorting)
50
- assert isinstance(tpca, BaseTemporalPCA)
51
- if (sl := getattr(tpca, "temporal_slice", None)) is not None:
52
- temps_tpca = torch.asarray(template_data.templates[:, sl])
53
- else:
54
- temps_tpca = torch.asarray(template_data.templates)
55
-
56
- n, t, c = temps_tpca.shape
57
- temps_tpca = temps_tpca.permute(0, 2, 1).reshape(n * c, t)
58
- temps_tpca = tpca._transform_in_probe(temps_tpca)
59
- temps_tpca = temps_tpca.reshape(n, c, -1).permute(0, 2, 1)
60
-
61
- noise_log_priors = noise.detection_prior_log_prob(temps_tpca)
62
- logger.dartsortdebug(
63
- f"Got log priors ranging {noise_log_priors.min()}-{noise_log_priors.max()}."
64
- )
65
- noise_log_priors = noise_log_priors[matching_labels]
66
-
67
- return noise_log_priors
68
- elif stem.startswith("subtract"):
69
- noise_log_priors = noise.channelwise_detection_prior_log_prob()
70
- logger.dartsortdebug(
71
- f"Got log priors ranging {noise_log_priors.min()}-{noise_log_priors.max()}."
72
- )
73
- noise_log_priors = noise_log_priors[sorting.channels]
74
- return noise_log_priors
75
- else:
76
- return None
77
-
78
-
79
26
  @databag
80
27
  class PCMergeResult:
81
28
  sorting: data_util.DARTsortSorting
@@ -186,7 +133,7 @@ def pc_merge(
186
133
  )
187
134
  sf = means.square_().sum(dim=1).sqrt_() * counts.sqrt()
188
135
  sf = sf.numpy(force=True)
189
- sorting, new_ids = reorder_by_depth(
136
+ sorting, _new_ids = reorder_by_depth(
190
137
  sorting, motion=motion, spatial_footprints=sf, geom=motion.rgeom
191
138
  )
192
139
  return PCMergeResult(sorting=sorting)
@@ -505,15 +452,15 @@ def gmm_isolation_scores(
505
452
  if dd is None:
506
453
  continue
507
454
 
508
- assert return_kdes, 1
509
- assert kde is not None, 2
455
+ assert return_kdes
456
+ assert kde is not None
510
457
  if domain is None:
511
458
  domain = dd
512
- assert kdes is None, 3
459
+ assert kdes is None
513
460
  kdes = np.full((unit_ids.size, domain.shape[0]), np.nan)
514
461
  else:
515
- assert np.array_equal(domain, dd), 4
516
- assert kdes is not None, 5
462
+ assert np.array_equal(domain, dd)
463
+ assert kdes is not None
517
464
  kdes[j] = kde
518
465
 
519
466
  return GMMIsolationScores(isolation=isolation, kde_domain=domain, kdes=kdes)
@@ -138,14 +138,14 @@ class DARTsortUserConfig:
138
138
  """Threshold in standardized (SNR) voltage units for initial detection;
139
139
  peaks or troughs larger than this value will be grabbed."""
140
140
 
141
- matching_threshold: Annotated[float, Field(gt=0)] = 8.0
141
+ matching_threshold: Annotated[float, Field(gt=0)] = 6.0
142
142
  """Template matching threshold. If subtracting a template leads
143
143
  to at least this great of a decrease in the norm of the residual,
144
144
  that match will be used. This is in the same units as the corresponding
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)] = 9.0
148
+ initial_threshold: Annotated[float, Field(gt=0)] = 7.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."""
@@ -208,7 +208,7 @@ class DARTsortUserConfig:
208
208
  agg_kind: Literal["none", "template_distance", "qda"] = "qda"
209
209
  """Final distance or GMM-based merge type."""
210
210
 
211
- spikeinterface_merge_preset: str | Literal["none"] | None = None
211
+ spikeinterface_merge_preset: str | Literal["none"] = "none"
212
212
  """Call out to SpikeInterface's auto_merge() for a final merge using timing / RP information.
213
213
  Setting this is slightly different' from calling auto_merge() externally, since the internal
214
214
  version will make use of dartsort's templates and template distances.
@@ -84,16 +84,16 @@ def detect_and_deduplicate(
84
84
  Tp = slen * nrep
85
85
  key = (traces.device.type, traces.device.index, Tp, dedup_temporal_radius)
86
86
  if key in _pepper:
87
- dedup_time_salt = _pepper[key]
87
+ dedup_time_pepper = _pepper[key]
88
88
  else:
89
89
  # favor earlier times when deduplicating identical values (at float16 prec)
90
- dedup_time_salt = torch.linspace(
90
+ dedup_time_pepper = torch.linspace(
91
91
  dedup_salt_eps, 0.0, steps=slen, device=traces.device
92
92
  )
93
- dedup_time_salt = dedup_time_salt.repeat(nrep)
94
- _pepper[key] = dedup_time_salt = dedup_time_salt
93
+ dedup_time_pepper = dedup_time_pepper.repeat(nrep)
94
+ _pepper[key] = dedup_time_pepper
95
95
  else:
96
- dedup_time_salt = None
96
+ dedup_time_pepper = None
97
97
 
98
98
  for i0 in range(0, T, batch_size):
99
99
  i1 = min(T, i0 + batch_size)
@@ -131,6 +131,9 @@ def detect_and_deduplicate(
131
131
  tmp = peak
132
132
  del peak
133
133
 
134
+ if detection_mask is not None:
135
+ detect.logical_and_(detection_mask[i00:i11].T)
136
+
134
137
  # check if deduping
135
138
  if not will_dedup:
136
139
  all_peaks[i0:i1] = detect[:, istart:iend].T
@@ -139,11 +142,9 @@ def detect_and_deduplicate(
139
142
  # -- deduplicate peaks
140
143
  if dedup_chans_salt is not None:
141
144
  Xdd[:-1] += dedup_chans_salt
142
- if dedup_time_salt is not None:
143
- Xdd[:-1] += dedup_time_salt[i00:i11]
145
+ if dedup_time_pepper is not None:
146
+ Xdd[:-1] += dedup_time_pepper[i00:i11]
144
147
  mask_out = torch.logical_not(detect, out=tmp)
145
- if detection_mask is not None:
146
- mask_out.logical_and_(detection_mask[i00:i11].T)
147
148
  Xdd[:-1].masked_fill_(mask_out, 0.0)
148
149
 
149
150
  # no-threshold max pool for deduplication
@@ -136,7 +136,7 @@ class DARTsortGroundTruthComparison:
136
136
  return res
137
137
 
138
138
  def soft_assignment_key(
139
- self, to_try=["merged_responsibilities", "gmm_responsibilities"]
139
+ self, to_try=("merged_responsibilities", "gmm_responsibilities")
140
140
  ) -> str | None:
141
141
  if hasattr(self, "_soft_assignment_key"):
142
142
  return self._soft_assignment_key
@@ -147,87 +147,88 @@ class DARTsortGroundTruthComparison:
147
147
  self._soft_assignment_key = None
148
148
  return None
149
149
 
150
- def brier_score(self, gt_unit: int) -> tuple[float, float | None]:
151
- """Compute something like a Brier score in our context
152
-
153
- There are edge cases in spike sorting that normal Brier score doesn't deal with.
154
- First of all, the GT and tested event counts are different, as are the GT and tested
155
- class counts. This means we have FPs and FNs for both events and classes. So we have
156
- to handle those cases.
157
-
158
- For handling the class mapping from GT to tested:
159
- - Use the best matching sorted unit's soft score as the probability of the
160
- true class.
161
- - If a GT unit has no matched sorted unit, its Brier score is 2, the worst
162
- possible score.
163
-
164
- That's how we deal with classe. Now for the spikes.
165
-
166
- Else, we go spike by spike through the GT spikes and get a score for the
167
- ith spike as brier[i], and output mean(brier).
168
- The cases are: TP, FP, FN.
169
-
170
- - For a true positive, it's standard. Spike i's resp[i, 0] is its true class
171
- prob, so...
172
- brier[i] = (1 - resp[i, 0])**2 + (resp[i, 1:]**2).sum()
173
-
174
- - Now, for a false positive. This spike might come from another class, but we
175
- don't know which one here. It's debatable what to do -- you could try to figure out
176
- what the best matching unit is for the true class... but we don't even know if the
177
- spike exists in the GT sorting, much less which one it is. So, we just set
178
- brier[i] = 2
179
- The worst possible value.
180
-
181
- - For a false negative, it's the same situation. Maybe the spike got picked up by another
182
- unit and has some mass on the best matching unit's component, but we don't
183
- know that, so we set
184
- brier[i] = 2
185
- """
186
- in_gt_unit, matched_gt_indices, only_gt_indices = self.matched_and_missed(gt_unit)
187
-
188
- # hard brier score
189
-
190
-
191
- tpmask = gt_is_tp[in_gt]
192
- fnmask = np.logical_not(tpmask)
193
- hard_brier = 2.0 * fnmask.mean()
194
- brier_records.append(
195
- dict(
196
- gt_unit_id=gt_unit_id,
197
- matched=matched,
198
- brier=hard_brier,
199
- kind='hard',
200
- true_class_mean_prob=tpmask.mean(),
201
- )
202
- )
203
-
204
- # soft...
205
- tested_ix = tested_index_of_gt[in_gt]
206
- uresp = resp[tested_ix]
207
- ucand = cand[tested_ix]
208
- # handle subtraction of true class one hot
209
- isbest = ucand == tested_best_match
210
-
211
- true_class_probs = uresp[isbest]
212
- uresp[isbest] = 0.0
213
- sbrier = np.square(uresp).sum(axis=1)
214
- sbrier += np.square(noiseresp[tested_ix])
215
- sbrier += np.logical_not(isbest.any(1))
216
- pass
217
-
218
- def brier_scores(self) -> tuple[np.ndarray, np.ndarray | None]:
219
- has_soft = self.soft_assignment_key() is not None
220
- hard_scores = np.zeros(self.n_gt_units)
221
- if has_soft:
222
- soft_scores = np.zeros_like(hard_scores)
223
- else:
224
- soft_scores = None
225
- for j, gt_unit in enumerate(self.unit_ids):
226
- hard_scores[j], ss = self.brier_score(gt_unit)
227
- if ss is not None:
228
- assert soft_scores is not None
229
- soft_scores[j] = ss
230
- return hard_scores, soft_scores
150
+ # def brier_score(self, gt_unit: int) -> tuple[float, float | None]:
151
+ # """Compute something like a Brier score in our context
152
+
153
+ # There are edge cases in spike sorting that normal Brier score doesn't deal with.
154
+ # First of all, the GT and tested event counts are different, as are the GT and tested
155
+ # class counts. This means we have FPs and FNs for both events and classes. So we have
156
+ # to handle those cases.
157
+
158
+ # For handling the class mapping from GT to tested:
159
+ # - Use the best matching sorted unit's soft score as the probability of the
160
+ # true class.
161
+ # - If a GT unit has no matched sorted unit, its Brier score is 2, the worst
162
+ # possible score.
163
+
164
+ # That's how we deal with classe. Now for the spikes.
165
+
166
+ # Else, we go spike by spike through the GT spikes and get a score for the
167
+ # ith spike as brier[i], and output mean(brier).
168
+ # The cases are: TP, FP, FN.
169
+
170
+ # - For a true positive, it's standard. Spike i's resp[i, 0] is its true class
171
+ # prob, so...
172
+ # brier[i] = (1 - resp[i, 0])**2 + (resp[i, 1:]**2).sum()
173
+
174
+ # - Now, for a false positive. This spike might come from another class, but we
175
+ # don't know which one here. It's debatable what to do -- you could try to figure out
176
+ # what the best matching unit is for the true class... but we don't even know if the
177
+ # spike exists in the GT sorting, much less which one it is. So, we just set
178
+ # brier[i] = 2
179
+ # The worst possible value.
180
+
181
+ # - For a false negative, it's the same situation. Maybe the spike got picked up by another
182
+ # unit and has some mass on the best matching unit's component, but we don't
183
+ # know that, so we set
184
+ # brier[i] = 2
185
+ # """
186
+ # in_gt_unit, matched_gt_indices, only_gt_indices = self.matched_and_missed(
187
+ # gt_unit
188
+ # )
189
+
190
+ # # hard brier score
191
+
192
+ # tpmask = gt_is_tp[in_gt]
193
+ # fnmask = np.logical_not(tpmask)
194
+ # hard_brier = 2.0 * fnmask.mean()
195
+ # brier_records.append(
196
+ # dict(
197
+ # gt_unit_id=gt_unit_id,
198
+ # matched=matched,
199
+ # brier=hard_brier,
200
+ # kind="hard",
201
+ # true_class_mean_prob=tpmask.mean(),
202
+ # )
203
+ # )
204
+
205
+ # # soft...
206
+ # tested_ix = tested_index_of_gt[in_gt]
207
+ # uresp = resp[tested_ix]
208
+ # ucand = cand[tested_ix]
209
+ # # handle subtraction of true class one hot
210
+ # isbest = ucand == tested_best_match
211
+
212
+ # true_class_probs = uresp[isbest]
213
+ # uresp[isbest] = 0.0
214
+ # sbrier = np.square(uresp).sum(axis=1)
215
+ # sbrier += np.square(noiseresp[tested_ix])
216
+ # sbrier += np.logical_not(isbest.any(1))
217
+ # pass
218
+
219
+ # def brier_scores(self) -> tuple[np.ndarray, np.ndarray | None]:
220
+ # has_soft = self.soft_assignment_key() is not None
221
+ # hard_scores = np.zeros(self.n_gt_units)
222
+ # if has_soft:
223
+ # soft_scores = np.zeros_like(hard_scores)
224
+ # else:
225
+ # soft_scores = None
226
+ # for j, gt_unit in enumerate(self.unit_ids):
227
+ # hard_scores[j], ss = self.brier_score(gt_unit)
228
+ # if ss is not None:
229
+ # assert soft_scores is not None
230
+ # soft_scores[j] = ss
231
+ # return hard_scores, soft_scores
231
232
 
232
233
  def _unit_info_dataframe(self, force_distances=False, perf_only=False):
233
234
  firing_rates = self.gt_analysis.firing_rates()