DARTsort 0.5.1__tar.gz → 0.5.3__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 (232) hide show
  1. {dartsort-0.5.1 → dartsort-0.5.3}/.github/workflows/ci.yml +1 -1
  2. dartsort-0.5.3/.github/workflows/docs.yml +68 -0
  3. {dartsort-0.5.1 → dartsort-0.5.3}/.gitignore +4 -0
  4. dartsort-0.5.3/PKG-INFO +218 -0
  5. dartsort-0.5.3/README.md +175 -0
  6. dartsort-0.5.3/docs/index.md +175 -0
  7. dartsort-0.5.3/docs/main_api.md +47 -0
  8. dartsort-0.5.3/docs/toolkit_api.md +90 -0
  9. dartsort-0.5.3/environment.yml +24 -0
  10. {dartsort-0.5.1 → dartsort-0.5.3}/pyproject.toml +3 -3
  11. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/__init__.py +1 -0
  12. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/cluster_util.py +3 -3
  13. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/density.py +2 -2
  14. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/merge.py +3 -3
  15. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/mixture.py +60 -31
  16. dartsort-0.5.3/src/dartsort/config.py +358 -0
  17. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/detect/__init__.py +1 -0
  18. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/detect/detect.py +2 -2
  19. dartsort-0.5.3/src/dartsort/evaluate/__init__.py +2 -0
  20. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/evaluate/hybrid_util.py +2 -2
  21. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/evaluate/noise_recording_tools.py +2 -2
  22. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/evaluate/simlib.py +2 -2
  23. dartsort-0.5.3/src/dartsort/localize/__init__.py +1 -0
  24. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/localize/localize_torch.py +4 -4
  25. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/main.py +25 -23
  26. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/__init__.py +3 -0
  27. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/grab.py +1 -0
  28. dartsort-0.5.3/src/dartsort/peel/matching_util/__init__.py +15 -0
  29. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/matching_util/drifty.py +2 -2
  30. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/matching_util/matching_base.py +1 -0
  31. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/peel_base.py +6 -2
  32. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/peel_lib.py +2 -0
  33. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/reduction_template.py +4 -1
  34. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/subtract.py +6 -3
  35. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/threshold.py +1 -1
  36. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/templates/__init__.py +1 -0
  37. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/templates/get_templates.py +2 -7
  38. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/templates/template_util.py +3 -3
  39. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/__init__.py +2 -0
  40. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/_multichan_denoiser_kit.py +1 -1
  41. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/all_transformers.py +1 -1
  42. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/amortized_localization.py +3 -1
  43. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/amplitudes.py +3 -0
  44. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/decollider.py +2 -1
  45. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/interp.py +1 -0
  46. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/localize.py +3 -3
  47. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/mixture_classifier.py +1 -0
  48. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/pipeline.py +9 -2
  49. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/single_channel_denoiser.py +2 -1
  50. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/supervised_denoiser.py +2 -0
  51. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/temporal_pca.py +4 -0
  52. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/transform_base.py +7 -1
  53. dartsort-0.5.3/src/dartsort/util/__init__.py +1 -0
  54. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/cli_util.py +108 -28
  55. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/data_util.py +11 -5
  56. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/drift_util.py +2 -2
  57. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/internal_config.py +6 -4
  58. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/interpolation_util.py +9 -9
  59. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/motion.py +11 -0
  60. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/noise_util.py +10 -10
  61. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/py_util.py +0 -54
  62. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/spiketorch.py +2 -2
  63. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/testing_util/mixture_testing_util.py +8 -8
  64. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/torch_optimization_util.py +2 -2
  65. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/__init__.py +1 -0
  66. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/colors.py +2 -2
  67. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/scatterplots.py +3 -3
  68. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/unit.py +0 -1
  69. dartsort-0.5.3/src/dartsort.egg-info/PKG-INFO +218 -0
  70. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort.egg-info/SOURCES.txt +5 -0
  71. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort.egg-info/requires.txt +4 -12
  72. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_transform.py +4 -4
  73. dartsort-0.5.3/zensical.toml +389 -0
  74. dartsort-0.5.1/PKG-INFO +0 -88
  75. dartsort-0.5.1/README.md +0 -38
  76. dartsort-0.5.1/environment.yml +0 -19
  77. dartsort-0.5.1/src/dartsort/config.py +0 -392
  78. dartsort-0.5.1/src/dartsort/evaluate/__init__.py +0 -1
  79. dartsort-0.5.1/src/dartsort/peel/matching_util/__init__.py +0 -3
  80. dartsort-0.5.1/src/dartsort/util/__init__.py +0 -0
  81. dartsort-0.5.1/src/dartsort/util/testing_util/__init__.py +0 -0
  82. dartsort-0.5.1/src/dartsort.egg-info/PKG-INFO +0 -88
  83. {dartsort-0.5.1 → dartsort-0.5.3}/.github/workflows/ci_windows.yml +0 -0
  84. {dartsort-0.5.1 → dartsort-0.5.3}/.github/workflows/deploy.yml +0 -0
  85. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/.keep +0 -0
  86. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/basic_integration_test.py +0 -0
  87. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/ci diag.py +0 -0
  88. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/dartsort_dredge_demo.ipynb +0 -0
  89. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/dartsort_dredge_demo.py +0 -0
  90. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/data test.py +0 -0
  91. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/dead reckoning.py +0 -0
  92. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/denoise np1.py +0 -0
  93. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/denoise np2.py +0 -0
  94. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/exploratory.py +0 -0
  95. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/geom debug.py +0 -0
  96. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/hdbscan_clustering_5min.py +0 -0
  97. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/hybrid 10.py +0 -0
  98. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/hybrid cluster.py +0 -0
  99. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/hybrid_11.py +0 -0
  100. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/initial training.py +0 -0
  101. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/make hybrid.py +0 -0
  102. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/mgh.py +0 -0
  103. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/np1 feats.py +0 -0
  104. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/np2 processing version c.py +0 -0
  105. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/paperfigs.py +0 -0
  106. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/pdists.py +0 -0
  107. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/postcheck.py +0 -0
  108. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/ptp vae.py +0 -0
  109. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/re clust.py +0 -0
  110. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/reg fig loop.py +0 -0
  111. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/reg_sim_exp.py +0 -0
  112. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/relocating.py +0 -0
  113. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/relocating_all.py +0 -0
  114. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/restats +0 -0
  115. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/sortStinger1.py +0 -0
  116. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/sortStinger3.py +0 -0
  117. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/sortStinger4.py +0 -0
  118. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/sortStinger5.py +0 -0
  119. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/sortStinger6.py +0 -0
  120. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/spike farm.py +0 -0
  121. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/ss_ensemble_sim.py +0 -0
  122. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/ss_ensemble_sim_drift.py +0 -0
  123. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/ss_sim.py +0 -0
  124. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/stan diagnostics.py +0 -0
  125. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/storytelling c.py +0 -0
  126. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/storytelling.py +0 -0
  127. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/subtract_with_phaseshift_denoiser.py +0 -0
  128. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/debug_matching.py +0 -0
  129. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/test_agreement.py +0 -0
  130. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/test_amplitude_scaling.py +0 -0
  131. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/test_batch_optim.py +0 -0
  132. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/test_ibme.py +0 -0
  133. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/test_mm_initialization.py +0 -0
  134. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/test_normxcorr1d.py +0 -0
  135. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/test_reassignment.py +0 -0
  136. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/tests/test_relocation.py +0 -0
  137. {dartsort-0.5.1 → dartsort-0.5.3}/notebook/thomas.py +0 -0
  138. {dartsort-0.5.1 → dartsort-0.5.3}/setup.cfg +0 -0
  139. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/cli.py +0 -0
  140. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/__init__.py +0 -0
  141. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/agglomerate.py +0 -0
  142. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/clustering.py +0 -0
  143. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/clustering_features.py +0 -0
  144. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/forward_backward.py +0 -0
  145. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/kmeans.py +0 -0
  146. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/modes.py +0 -0
  147. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/clustering/refine_util.py +0 -0
  148. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/detect/detect_filters.py +0 -0
  149. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/evaluate/analysis.py +0 -0
  150. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/evaluate/comparison.py +0 -0
  151. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/evaluate/sim_template_tools.py +0 -0
  152. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/evaluate/simkit.py +0 -0
  153. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/localize/localize_util.py +0 -0
  154. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/matching.py +0 -0
  155. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/matching_util/compressed_upsampled.py +0 -0
  156. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/matching_util/pairwise.py +0 -0
  157. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
  158. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/peel/shaver.py +0 -0
  159. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
  160. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/detect_np1.pt +0 -0
  161. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/detect_np2.pt +0 -0
  162. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/glasbey1024.npz +0 -0
  163. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
  164. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
  165. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
  166. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
  167. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
  168. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/templates/postprocess_util.py +0 -0
  169. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/templates/realignment.py +0 -0
  170. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/templates/templates.py +0 -0
  171. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/templates/templib.py +0 -0
  172. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/denoising_scorer.py +0 -0
  173. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/enforce_decrease.py +0 -0
  174. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/fixed_prop.py +0 -0
  175. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/matching_denoiser.py +0 -0
  176. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/reduction.py +0 -0
  177. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/transform/whiten.py +0 -0
  178. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/job_util.py +0 -0
  179. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/logging_util.py +0 -0
  180. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/main_util.py +0 -0
  181. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/more_operators.py +0 -0
  182. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/multiprocessing_util.py +0 -0
  183. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/nn_util.py +0 -0
  184. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/peel_util.py +0 -0
  185. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/preprocess_util.py +0 -0
  186. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/registration_util.py +0 -0
  187. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/residual_util.py +0 -0
  188. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/sparse_util.py +0 -0
  189. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/spikeio.py +0 -0
  190. {dartsort-0.5.1/src/dartsort/localize → dartsort-0.5.3/src/dartsort/util/testing_util}/__init__.py +0 -0
  191. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/testing_util/matching_debug_util.py +0 -0
  192. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/torch_util.py +0 -0
  193. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/util/waveform_util.py +0 -0
  194. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/analysis_plots.py +0 -0
  195. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/gt.py +0 -0
  196. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/layout.py +0 -0
  197. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/metrics_util.py +0 -0
  198. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/mixture.py +0 -0
  199. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/recanim.py +0 -0
  200. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/sorting.py +0 -0
  201. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/unit_comparison.py +0 -0
  202. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/versus.py +0 -0
  203. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/vismain.py +0 -0
  204. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort/vis/waveforms.py +0 -0
  205. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort.egg-info/dependency_links.txt +0 -0
  206. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort.egg-info/entry_points.txt +0 -0
  207. {dartsort-0.5.1 → dartsort-0.5.3}/src/dartsort.egg-info/top_level.txt +0 -0
  208. {dartsort-0.5.1 → dartsort-0.5.3}/tests/conftest.py +0 -0
  209. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_alignment.py +0 -0
  210. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_clustering.py +0 -0
  211. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_config.py +0 -0
  212. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_dartsort.py +0 -0
  213. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_data_util.py +0 -0
  214. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_detect.py +0 -0
  215. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_drift_util.py +0 -0
  216. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_drifty_matching.py +0 -0
  217. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_enforce_decrease.py +0 -0
  218. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_grab_and_featurize.py +0 -0
  219. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_kmeans.py +0 -0
  220. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_linalg.py +0 -0
  221. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_localize_torch.py +0 -0
  222. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_matching.py +0 -0
  223. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_mixture_classifier.py +0 -0
  224. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_modeling.py +0 -0
  225. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_simkit.py +0 -0
  226. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_spiketorch.py +0 -0
  227. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_subtract.py +0 -0
  228. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_templates.py +0 -0
  229. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_threshold.py +0 -0
  230. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_torch_optimization_util.py +0 -0
  231. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_util.py +0 -0
  232. {dartsort-0.5.1 → dartsort-0.5.3}/tests/test_waveform_util.py +0 -0
@@ -26,7 +26,7 @@ jobs:
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@v5
29
+ - uses: actions/setup-python@v6
30
30
  with:
31
31
  python-version: "3.x"
32
32
  cache: "pip" # caching pip dependencies
@@ -0,0 +1,68 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+ jobs:
13
+ deploy:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Checkout dartsort repo
17
+ uses: actions/checkout@v6
18
+ with:
19
+ path: dartsort
20
+
21
+ - name: Fetch tags and describe
22
+ run: pushd dartsort && git fetch --prune --unshallow --tags && git describe && popd
23
+
24
+ - name: Checkout dartsort.github.io repo
25
+ uses: actions/checkout@v6
26
+ with:
27
+ repository: dartsort/dartsort.github.io
28
+ path: io
29
+ # this is a "fine-grained token"
30
+ token: ${{ secrets.DARTSORT_GITHUB_IO }}
31
+
32
+ - name: Setup Python
33
+ uses: actions/setup-python@v6
34
+ with:
35
+ python-version: 3.x
36
+ cache: "pip" # caching pip dependencies
37
+
38
+ - name: pip install stuff
39
+ run: python3 -m pip install -e dartsort/[doc]
40
+
41
+ - name: Zensical build
42
+ run: pushd dartsort/ && zensical build --clean && popd
43
+
44
+ - name: overwrite site
45
+ shell: bash
46
+ run: |
47
+ cp -r dartsort/site/* io/
48
+
49
+ # shouts out to some-natalie.dev/blog/multi-repo-actions/
50
+ - name: Push to io
51
+ shell: bash
52
+ env:
53
+ CI_COMMIT_MESSAGE: update dartsort.github.io
54
+ CI_COMMIT_AUTHOR: github-actions[bot]
55
+ CI_COMMIT_EMAIL: username@users.noreply.github.com
56
+ run: |
57
+ cd io/
58
+ git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
59
+ git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
60
+
61
+ if [[ `git status --porcelain` ]]; then
62
+ git add .
63
+ git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
64
+ git push
65
+ else
66
+ echo "no changes"
67
+ exit 0
68
+ fi
@@ -16,6 +16,10 @@ figs/*
16
16
  *.sublime-project
17
17
  .vscode/
18
18
 
19
+ # sphinx
20
+ docs/source/_autosummary/
21
+ docs/source/api/
22
+
19
23
  ## Core latex/pdflatex auxiliary files:
20
24
  *.aux
21
25
  *.lof
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.4
2
+ Name: dartsort
3
+ Version: 0.5.3
4
+ Summary: DARTsort
5
+ Author-email: Charlie Windolf <ciw2048@gmail.com>
6
+ Project-URL: Homepage, https://github.com/cwindolf/dartsort
7
+ Project-URL: Bug Tracker, https://github.com/cwindolf/dartsort/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: dredge-ephys
14
+ Requires-Dist: h5py
15
+ Requires-Dist: jaxtyping
16
+ Requires-Dist: kdepy
17
+ Requires-Dist: linear_operator
18
+ Requires-Dist: numba
19
+ Requires-Dist: numpy>=1.20; python_version < "3.13"
20
+ Requires-Dist: numpy>=2.0.0; python_version >= "3.13"
21
+ Requires-Dist: opt-einsum
22
+ Requires-Dist: pandas
23
+ Requires-Dist: probeinterface
24
+ Requires-Dist: pydantic
25
+ Requires-Dist: pynapple
26
+ Requires-Dist: scipy>=1.13
27
+ Requires-Dist: scikit-learn
28
+ Requires-Dist: spikeinterface>=0.104.0
29
+ Requires-Dist: sympy
30
+ Requires-Dist: torch>=2.0
31
+ Requires-Dist: tqdm
32
+ Requires-Dist: typing-extensions
33
+ Provides-Extra: doc
34
+ Requires-Dist: zensical; extra == "doc"
35
+ Requires-Dist: mkdocstrings-python; extra == "doc"
36
+ Provides-Extra: test
37
+ Requires-Dist: pytest; extra == "test"
38
+ Requires-Dist: pytest-cov; extra == "test"
39
+ Provides-Extra: vis
40
+ Requires-Dist: matplotlib; extra == "vis"
41
+ Requires-Dist: seaborn; extra == "vis"
42
+ Requires-Dist: matplotlib-venn; extra == "vis"
43
+
44
+ [![ci](https://github.com/cwindolf/dartsort/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cwindolf/dartsort/actions/)
45
+ [![github](https://img.shields.io/badge/github-repo-blue?logo=github)](https://github.com/cwindolf/dartsort/)
46
+ [![docs](https://img.shields.io/badge/documentation-AAAAAA)](https://dartsort.github.io)
47
+ [![pages](https://github.com/dartsort/dartsort.github.io/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/dartsort/dartsort.github.io/actions/workflows/pages/pages-build-deployment)
48
+ [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
49
+ [![Zenodo DOI](https://zenodo.org/badge/421108722.svg)](https://doi.org/10.5281/zenodo.16943074)
50
+ [![pypi: dartsort](https://img.shields.io/pypi/v/dartsort?label=pypi:%20dartsort)](https://pypi.org/p/dartsort)
51
+
52
+
53
+ # dartsort
54
+
55
+
56
+ *dartsort* is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
57
+ It is also a toolkit of modules for building spike sorters and other analyses of electrophysiology data.
58
+
59
+
60
+ ## :warning: work in progress :warning:
61
+
62
+ We do not currently recommend DARTsort for production spike sorting purposes.
63
+ Please feel free to open an issue or a discussion if you run into problems.
64
+
65
+
66
+ ## Installation
67
+
68
+ ### Installing into an existing environment
69
+
70
+ If you already have a Python environment with PyTorch working and you just want to install *dartsort* there, use
71
+
72
+ ```sh
73
+ $ pip install dartsort
74
+ ```
75
+
76
+ If you want to run the test suite or use `dartsort.vis`, you can install the optional dependencies with `pip install dartsort[test,vis]`.
77
+
78
+ ## Setting up a Python environment
79
+
80
+ If you need to set up Python or PyTorch, I find that a [`conda-forge`](https://conda-forge.org/)-based distribution is the most reliable at installing the GPU dependencies which PyTorch needs (note: `conda-forge` is different from the non-free Anaconda).
81
+
82
+ You can use `conda-forge` to install Python, `dartsort`, and its dependencies as follows:
83
+
84
+ - Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
85
+ - Create an environment with
86
+ ```sh
87
+ $ mamba env create -f environment.yml
88
+ ```
89
+ This will create an environment called `dartsort`, but you can change the name by adding `-n othername`.
90
+ - Activate the environment:
91
+ ```sh
92
+ $ mamba activate dartsort
93
+ ```
94
+ - Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
95
+
96
+
97
+ ## Usage
98
+
99
+ For more detailed documentation of the main function parameters and configuration options, see the [main API documentation](main_api.md).
100
+
101
+ ### As a Python function
102
+
103
+ *dartsort* can be run in Python with:
104
+
105
+ ```python
106
+ import dartsort
107
+
108
+ dartsort.dartsort(recording, output_dir)
109
+
110
+ # or, to set configuration options, something like...
111
+ dartsort_result = dartsort.dartsort(
112
+ recording,
113
+ output_dir,
114
+ cfg=dartsort.DARTsortUserConfig(
115
+ preprocessing="ibllike",
116
+ work_in_tmpdir=True,
117
+ copy_recording_to_tmpdir=True,
118
+ ),
119
+ )
120
+ ```
121
+
122
+ **Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
123
+ Some of them, like `preprocessing`, are not set by default and need your input!
124
+ (This will probably change.)
125
+
126
+ Here, `recording` is a [SpikeInterface][SpikeInterface] recording object (see their tutorial on [reading various recording formats](https://spikeinterface.readthedocs.io/en/stable/how_to/read_various_formats.html)).
127
+ `output_dir` is the folder where *dartsort* will save its output.
128
+ There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
129
+
130
+ Once you've run *dartsort*, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
131
+
132
+ ### Important configuration details
133
+
134
+ Before running *dartsort*, please be aware of the following important configuration options.
135
+
136
+ - `preprocessing`: *dartsort* won't touch your data by default (`preprocessing="none"`), leaving you free to implement your own preprocessing in SpikeInterface or otherwise. However, *dartsort* expects standardized input, and therefore it will explode if you don't set this flag and your data is in its original state (for instance, the raw `int16` data off the probe).
137
+ - For a cheap but sensible default, try `preprocessing="ibllikecmr"`, which applies a pipeline similar to that of [the IBL][iblsorting] but with global median common referencing instead of their spatial highpass filter. `preprocessing="ibllike"` will use their spatial highpass filter.
138
+ - `do_motion_estimation=True` by default, but you may like to disable it if you know that there is (say) less than 5 microns of total drift in your recording, or if you have handled this in your own preprocessing.
139
+ - `work_in_tmpdir` and `copy_recording_to_tmpdir` can be helpful in some cases where slow network drives are involved.
140
+
141
+ ### Outputs and exporting
142
+
143
+ The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
144
+ This object has all the spike train data attached (as arrays under property names `.times_samples` and `.times_seconds` for spike times in samples and seconds, `.labels` for unit labels, and many others; `print(sorting)` to see some more).
145
+
146
+ If you already ran *dartsort* and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
147
+
148
+ This object can also export itself to other formats:
149
+
150
+ - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
151
+ - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
152
+ - To export to Phy, we currently suggest bridging through SpikeInterface. Start with `sorting.to_numpy_sorting()` and follow the instructions [in SpikeInterface's documentation](https://spikeinterface.readthedocs.io/en/stable/modules/exporters.html#exporting-to-phy) for first creating a `SortingAnalyzer` and then exporting that to Phy.
153
+ - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
154
+ - For pandas, use `sorting.to_pandas()`.
155
+
156
+ *dartsort* also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
157
+
158
+ The data is saved to `output_dir` in the following files:
159
+ - `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
160
+ - `matching1.h5`: This HDF5 file contains spike features and other data from the last matching step. Amplitudes, localizations, and other features live in here; use `h5ls` on the command line to see what's in there. Be aware that the `labels` dataset in this HDF5 is not the same as what's saved in the `dartsort_sorting.npz`.
161
+ - `motion_info.pkl` is a pickled `MotionInfo` object.
162
+ - There may be a models/ folder containing PyTorch weights files with modeling quantities (for instance, featurization SVD bases, localization neural nets, Gaussian mixture model parameters). If you want to load these up, feel free to reach out for help.
163
+
164
+ ### Visualization
165
+
166
+ To make some basic visualizations of the sorting result with matplotlib, try:
167
+
168
+ ```python
169
+ import dartsort.vis as dartvis
170
+
171
+ # gather outputs from dartsort
172
+ dartsort_result = dartsort(recording, output_dir, ...)
173
+ sorting = dartsort_result["sorting"]
174
+ motion = dartsort_result["motion"]
175
+
176
+ # or, if you already ran it
177
+ sorting = dartsort.load(output_dir)
178
+ motion = dartsort.try_load_motion_info(output_dir)
179
+
180
+ dartvis.visualize_sorting(
181
+ recording,
182
+ sorting,
183
+ vis_save_dir,
184
+ motion=motion,
185
+ make_unit_summaries=False,
186
+ )
187
+ ```
188
+
189
+ Set `make_unit_summaries=True` to create a summary plot for each unit.
190
+
191
+ ### Command-line interface
192
+
193
+ Try running
194
+
195
+ ```sh
196
+ $ dartsort -h
197
+ ```
198
+
199
+ on your command line to see usage instructions; parameters can be configured on the command line or read from a TOML file.
200
+
201
+ ## Troubleshooting
202
+
203
+ Please let us know if you run into any issues.
204
+ If you feel that the issue is a software bug, feel free to open an issue or a discussion on GitHub.
205
+ If it's more of a data-related or methodology thing, feel free to use the email on my GitHub [profile](https://github.com/cwindolf).
206
+
207
+ ## References
208
+
209
+ - [SpikeInterface][SpikeInterface]
210
+ - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
211
+
212
+
213
+ [SpikeInterface]: https://spikeinterface.readthedocs.io
214
+ [iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
215
+ [Pynapple]: https://pynapple.org/
216
+ [dredge-pypi]: https://pypi.org/p/dredge-ephys/
217
+ [dredge-nm]: https://www.nature.com/articles/s41592-025-02614-5
218
+ [dredge-rdcb]: https://rdcu.be/ecqZf
@@ -0,0 +1,175 @@
1
+ [![ci](https://github.com/cwindolf/dartsort/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cwindolf/dartsort/actions/)
2
+ [![github](https://img.shields.io/badge/github-repo-blue?logo=github)](https://github.com/cwindolf/dartsort/)
3
+ [![docs](https://img.shields.io/badge/documentation-AAAAAA)](https://dartsort.github.io)
4
+ [![pages](https://github.com/dartsort/dartsort.github.io/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/dartsort/dartsort.github.io/actions/workflows/pages/pages-build-deployment)
5
+ [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
6
+ [![Zenodo DOI](https://zenodo.org/badge/421108722.svg)](https://doi.org/10.5281/zenodo.16943074)
7
+ [![pypi: dartsort](https://img.shields.io/pypi/v/dartsort?label=pypi:%20dartsort)](https://pypi.org/p/dartsort)
8
+
9
+
10
+ # dartsort
11
+
12
+
13
+ *dartsort* is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
14
+ It is also a toolkit of modules for building spike sorters and other analyses of electrophysiology data.
15
+
16
+
17
+ ## :warning: work in progress :warning:
18
+
19
+ We do not currently recommend DARTsort for production spike sorting purposes.
20
+ Please feel free to open an issue or a discussion if you run into problems.
21
+
22
+
23
+ ## Installation
24
+
25
+ ### Installing into an existing environment
26
+
27
+ If you already have a Python environment with PyTorch working and you just want to install *dartsort* there, use
28
+
29
+ ```sh
30
+ $ pip install dartsort
31
+ ```
32
+
33
+ If you want to run the test suite or use `dartsort.vis`, you can install the optional dependencies with `pip install dartsort[test,vis]`.
34
+
35
+ ## Setting up a Python environment
36
+
37
+ If you need to set up Python or PyTorch, I find that a [`conda-forge`](https://conda-forge.org/)-based distribution is the most reliable at installing the GPU dependencies which PyTorch needs (note: `conda-forge` is different from the non-free Anaconda).
38
+
39
+ You can use `conda-forge` to install Python, `dartsort`, and its dependencies as follows:
40
+
41
+ - Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
42
+ - Create an environment with
43
+ ```sh
44
+ $ mamba env create -f environment.yml
45
+ ```
46
+ This will create an environment called `dartsort`, but you can change the name by adding `-n othername`.
47
+ - Activate the environment:
48
+ ```sh
49
+ $ mamba activate dartsort
50
+ ```
51
+ - Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
52
+
53
+
54
+ ## Usage
55
+
56
+ For more detailed documentation of the main function parameters and configuration options, see the [main API documentation](main_api.md).
57
+
58
+ ### As a Python function
59
+
60
+ *dartsort* can be run in Python with:
61
+
62
+ ```python
63
+ import dartsort
64
+
65
+ dartsort.dartsort(recording, output_dir)
66
+
67
+ # or, to set configuration options, something like...
68
+ dartsort_result = dartsort.dartsort(
69
+ recording,
70
+ output_dir,
71
+ cfg=dartsort.DARTsortUserConfig(
72
+ preprocessing="ibllike",
73
+ work_in_tmpdir=True,
74
+ copy_recording_to_tmpdir=True,
75
+ ),
76
+ )
77
+ ```
78
+
79
+ **Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
80
+ Some of them, like `preprocessing`, are not set by default and need your input!
81
+ (This will probably change.)
82
+
83
+ Here, `recording` is a [SpikeInterface][SpikeInterface] recording object (see their tutorial on [reading various recording formats](https://spikeinterface.readthedocs.io/en/stable/how_to/read_various_formats.html)).
84
+ `output_dir` is the folder where *dartsort* will save its output.
85
+ There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
86
+
87
+ Once you've run *dartsort*, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
88
+
89
+ ### Important configuration details
90
+
91
+ Before running *dartsort*, please be aware of the following important configuration options.
92
+
93
+ - `preprocessing`: *dartsort* won't touch your data by default (`preprocessing="none"`), leaving you free to implement your own preprocessing in SpikeInterface or otherwise. However, *dartsort* expects standardized input, and therefore it will explode if you don't set this flag and your data is in its original state (for instance, the raw `int16` data off the probe).
94
+ - For a cheap but sensible default, try `preprocessing="ibllikecmr"`, which applies a pipeline similar to that of [the IBL][iblsorting] but with global median common referencing instead of their spatial highpass filter. `preprocessing="ibllike"` will use their spatial highpass filter.
95
+ - `do_motion_estimation=True` by default, but you may like to disable it if you know that there is (say) less than 5 microns of total drift in your recording, or if you have handled this in your own preprocessing.
96
+ - `work_in_tmpdir` and `copy_recording_to_tmpdir` can be helpful in some cases where slow network drives are involved.
97
+
98
+ ### Outputs and exporting
99
+
100
+ The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
101
+ This object has all the spike train data attached (as arrays under property names `.times_samples` and `.times_seconds` for spike times in samples and seconds, `.labels` for unit labels, and many others; `print(sorting)` to see some more).
102
+
103
+ If you already ran *dartsort* and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
104
+
105
+ This object can also export itself to other formats:
106
+
107
+ - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
108
+ - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
109
+ - To export to Phy, we currently suggest bridging through SpikeInterface. Start with `sorting.to_numpy_sorting()` and follow the instructions [in SpikeInterface's documentation](https://spikeinterface.readthedocs.io/en/stable/modules/exporters.html#exporting-to-phy) for first creating a `SortingAnalyzer` and then exporting that to Phy.
110
+ - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
111
+ - For pandas, use `sorting.to_pandas()`.
112
+
113
+ *dartsort* also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
114
+
115
+ The data is saved to `output_dir` in the following files:
116
+ - `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
117
+ - `matching1.h5`: This HDF5 file contains spike features and other data from the last matching step. Amplitudes, localizations, and other features live in here; use `h5ls` on the command line to see what's in there. Be aware that the `labels` dataset in this HDF5 is not the same as what's saved in the `dartsort_sorting.npz`.
118
+ - `motion_info.pkl` is a pickled `MotionInfo` object.
119
+ - There may be a models/ folder containing PyTorch weights files with modeling quantities (for instance, featurization SVD bases, localization neural nets, Gaussian mixture model parameters). If you want to load these up, feel free to reach out for help.
120
+
121
+ ### Visualization
122
+
123
+ To make some basic visualizations of the sorting result with matplotlib, try:
124
+
125
+ ```python
126
+ import dartsort.vis as dartvis
127
+
128
+ # gather outputs from dartsort
129
+ dartsort_result = dartsort(recording, output_dir, ...)
130
+ sorting = dartsort_result["sorting"]
131
+ motion = dartsort_result["motion"]
132
+
133
+ # or, if you already ran it
134
+ sorting = dartsort.load(output_dir)
135
+ motion = dartsort.try_load_motion_info(output_dir)
136
+
137
+ dartvis.visualize_sorting(
138
+ recording,
139
+ sorting,
140
+ vis_save_dir,
141
+ motion=motion,
142
+ make_unit_summaries=False,
143
+ )
144
+ ```
145
+
146
+ Set `make_unit_summaries=True` to create a summary plot for each unit.
147
+
148
+ ### Command-line interface
149
+
150
+ Try running
151
+
152
+ ```sh
153
+ $ dartsort -h
154
+ ```
155
+
156
+ on your command line to see usage instructions; parameters can be configured on the command line or read from a TOML file.
157
+
158
+ ## Troubleshooting
159
+
160
+ Please let us know if you run into any issues.
161
+ If you feel that the issue is a software bug, feel free to open an issue or a discussion on GitHub.
162
+ If it's more of a data-related or methodology thing, feel free to use the email on my GitHub [profile](https://github.com/cwindolf).
163
+
164
+ ## References
165
+
166
+ - [SpikeInterface][SpikeInterface]
167
+ - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
168
+
169
+
170
+ [SpikeInterface]: https://spikeinterface.readthedocs.io
171
+ [iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
172
+ [Pynapple]: https://pynapple.org/
173
+ [dredge-pypi]: https://pypi.org/p/dredge-ephys/
174
+ [dredge-nm]: https://www.nature.com/articles/s41592-025-02614-5
175
+ [dredge-rdcb]: https://rdcu.be/ecqZf
@@ -0,0 +1,175 @@
1
+ [![ci](https://github.com/cwindolf/dartsort/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cwindolf/dartsort/actions/)
2
+ [![github](https://img.shields.io/badge/github-repo-blue?logo=github)](https://github.com/cwindolf/dartsort/)
3
+ [![docs](https://img.shields.io/badge/documentation-AAAAAA)](https://dartsort.github.io)
4
+ [![pages](https://github.com/dartsort/dartsort.github.io/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/dartsort/dartsort.github.io/actions/workflows/pages/pages-build-deployment)
5
+ [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
6
+ [![Zenodo DOI](https://zenodo.org/badge/421108722.svg)](https://doi.org/10.5281/zenodo.16943074)
7
+ [![pypi: dartsort](https://img.shields.io/pypi/v/dartsort?label=pypi:%20dartsort)](https://pypi.org/p/dartsort)
8
+
9
+
10
+ # dartsort
11
+
12
+
13
+ *dartsort* is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
14
+ It is also a toolkit of modules for building spike sorters and other analyses of electrophysiology data.
15
+
16
+
17
+ ## :warning: work in progress :warning:
18
+
19
+ We do not currently recommend DARTsort for production spike sorting purposes.
20
+ Please feel free to open an issue or a discussion if you run into problems.
21
+
22
+
23
+ ## Installation
24
+
25
+ ### Installing into an existing environment
26
+
27
+ If you already have a Python environment with PyTorch working and you just want to install *dartsort* there, use
28
+
29
+ ```sh
30
+ $ pip install dartsort
31
+ ```
32
+
33
+ If you want to run the test suite or use `dartsort.vis`, you can install the optional dependencies with `pip install dartsort[test,vis]`.
34
+
35
+ ## Setting up a Python environment
36
+
37
+ If you need to set up Python or PyTorch, I find that a [`conda-forge`](https://conda-forge.org/)-based distribution is the most reliable at installing the GPU dependencies which PyTorch needs (note: `conda-forge` is different from the non-free Anaconda).
38
+
39
+ You can use `conda-forge` to install Python, `dartsort`, and its dependencies as follows:
40
+
41
+ - Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
42
+ - Create an environment with
43
+ ```sh
44
+ $ mamba env create -f environment.yml
45
+ ```
46
+ This will create an environment called `dartsort`, but you can change the name by adding `-n othername`.
47
+ - Activate the environment:
48
+ ```sh
49
+ $ mamba activate dartsort
50
+ ```
51
+ - Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
52
+
53
+
54
+ ## Usage
55
+
56
+ For more detailed documentation of the main function parameters and configuration options, see the [main API documentation](main_api.md).
57
+
58
+ ### As a Python function
59
+
60
+ *dartsort* can be run in Python with:
61
+
62
+ ```python
63
+ import dartsort
64
+
65
+ dartsort.dartsort(recording, output_dir)
66
+
67
+ # or, to set configuration options, something like...
68
+ dartsort_result = dartsort.dartsort(
69
+ recording,
70
+ output_dir,
71
+ cfg=dartsort.DARTsortUserConfig(
72
+ preprocessing="ibllike",
73
+ work_in_tmpdir=True,
74
+ copy_recording_to_tmpdir=True,
75
+ ),
76
+ )
77
+ ```
78
+
79
+ **Please** read the [important configuration details section](#important-configuration-details) below for information on the parameters of the `DARTsortUserConfig`.
80
+ Some of them, like `preprocessing`, are not set by default and need your input!
81
+ (This will probably change.)
82
+
83
+ Here, `recording` is a [SpikeInterface][SpikeInterface] recording object (see their tutorial on [reading various recording formats](https://spikeinterface.readthedocs.io/en/stable/how_to/read_various_formats.html)).
84
+ `output_dir` is the folder where *dartsort* will save its output.
85
+ There are more details on these and the rest of the arguments in the [main API documentation](main_api.md).
86
+
87
+ Once you've run *dartsort*, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
88
+
89
+ ### Important configuration details
90
+
91
+ Before running *dartsort*, please be aware of the following important configuration options.
92
+
93
+ - `preprocessing`: *dartsort* won't touch your data by default (`preprocessing="none"`), leaving you free to implement your own preprocessing in SpikeInterface or otherwise. However, *dartsort* expects standardized input, and therefore it will explode if you don't set this flag and your data is in its original state (for instance, the raw `int16` data off the probe).
94
+ - For a cheap but sensible default, try `preprocessing="ibllikecmr"`, which applies a pipeline similar to that of [the IBL][iblsorting] but with global median common referencing instead of their spatial highpass filter. `preprocessing="ibllike"` will use their spatial highpass filter.
95
+ - `do_motion_estimation=True` by default, but you may like to disable it if you know that there is (say) less than 5 microns of total drift in your recording, or if you have handled this in your own preprocessing.
96
+ - `work_in_tmpdir` and `copy_recording_to_tmpdir` can be helpful in some cases where slow network drives are involved.
97
+
98
+ ### Outputs and exporting
99
+
100
+ The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object: `sorting = dartsort_result["sorting"]`.
101
+ This object has all the spike train data attached (as arrays under property names `.times_samples` and `.times_seconds` for spike times in samples and seconds, `.labels` for unit labels, and many others; `print(sorting)` to see some more).
102
+
103
+ If you already ran *dartsort* and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
104
+
105
+ This object can also export itself to other formats:
106
+
107
+ - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
108
+ - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
109
+ - To export to Phy, we currently suggest bridging through SpikeInterface. Start with `sorting.to_numpy_sorting()` and follow the instructions [in SpikeInterface's documentation](https://spikeinterface.readthedocs.io/en/stable/modules/exporters.html#exporting-to-phy) for first creating a `SortingAnalyzer` and then exporting that to Phy.
110
+ - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
111
+ - For pandas, use `sorting.to_pandas()`.
112
+
113
+ *dartsort* also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
114
+
115
+ The data is saved to `output_dir` in the following files:
116
+ - `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
117
+ - `matching1.h5`: This HDF5 file contains spike features and other data from the last matching step. Amplitudes, localizations, and other features live in here; use `h5ls` on the command line to see what's in there. Be aware that the `labels` dataset in this HDF5 is not the same as what's saved in the `dartsort_sorting.npz`.
118
+ - `motion_info.pkl` is a pickled `MotionInfo` object.
119
+ - There may be a models/ folder containing PyTorch weights files with modeling quantities (for instance, featurization SVD bases, localization neural nets, Gaussian mixture model parameters). If you want to load these up, feel free to reach out for help.
120
+
121
+ ### Visualization
122
+
123
+ To make some basic visualizations of the sorting result with matplotlib, try:
124
+
125
+ ```python
126
+ import dartsort.vis as dartvis
127
+
128
+ # gather outputs from dartsort
129
+ dartsort_result = dartsort(recording, output_dir, ...)
130
+ sorting = dartsort_result["sorting"]
131
+ motion = dartsort_result["motion"]
132
+
133
+ # or, if you already ran it
134
+ sorting = dartsort.load(output_dir)
135
+ motion = dartsort.try_load_motion_info(output_dir)
136
+
137
+ dartvis.visualize_sorting(
138
+ recording,
139
+ sorting,
140
+ vis_save_dir,
141
+ motion=motion,
142
+ make_unit_summaries=False,
143
+ )
144
+ ```
145
+
146
+ Set `make_unit_summaries=True` to create a summary plot for each unit.
147
+
148
+ ### Command-line interface
149
+
150
+ Try running
151
+
152
+ ```sh
153
+ $ dartsort -h
154
+ ```
155
+
156
+ on your command line to see usage instructions; parameters can be configured on the command line or read from a TOML file.
157
+
158
+ ## Troubleshooting
159
+
160
+ Please let us know if you run into any issues.
161
+ If you feel that the issue is a software bug, feel free to open an issue or a discussion on GitHub.
162
+ If it's more of a data-related or methodology thing, feel free to use the email on my GitHub [profile](https://github.com/cwindolf).
163
+
164
+ ## References
165
+
166
+ - [SpikeInterface][SpikeInterface]
167
+ - DREDge [on PyPI][dredge-pypi] and the DREDge [paper][dredge-nm] ([PDF link][dredge-rdcb]).
168
+
169
+
170
+ [SpikeInterface]: https://spikeinterface.readthedocs.io
171
+ [iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
172
+ [Pynapple]: https://pynapple.org/
173
+ [dredge-pypi]: https://pypi.org/p/dredge-ephys/
174
+ [dredge-nm]: https://www.nature.com/articles/s41592-025-02614-5
175
+ [dredge-rdcb]: https://rdcu.be/ecqZf