DARTsort 0.5.1__tar.gz → 0.5.2__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 (222) hide show
  1. dartsort-0.5.2/PKG-INFO +206 -0
  2. dartsort-0.5.2/README.md +167 -0
  3. dartsort-0.5.2/environment.yml +24 -0
  4. {dartsort-0.5.1 → dartsort-0.5.2}/pyproject.toml +1 -3
  5. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/evaluate/noise_recording_tools.py +2 -2
  6. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/peel_base.py +3 -0
  7. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/peel_lib.py +2 -0
  8. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/reduction_template.py +3 -1
  9. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/subtract.py +4 -2
  10. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/templates/get_templates.py +0 -5
  11. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/templates/template_util.py +1 -1
  12. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/internal_config.py +2 -0
  13. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/colors.py +1 -1
  14. dartsort-0.5.2/src/dartsort.egg-info/PKG-INFO +206 -0
  15. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort.egg-info/requires.txt +0 -13
  16. dartsort-0.5.1/PKG-INFO +0 -88
  17. dartsort-0.5.1/README.md +0 -38
  18. dartsort-0.5.1/environment.yml +0 -19
  19. dartsort-0.5.1/src/dartsort.egg-info/PKG-INFO +0 -88
  20. {dartsort-0.5.1 → dartsort-0.5.2}/.github/workflows/ci.yml +0 -0
  21. {dartsort-0.5.1 → dartsort-0.5.2}/.github/workflows/ci_windows.yml +0 -0
  22. {dartsort-0.5.1 → dartsort-0.5.2}/.github/workflows/deploy.yml +0 -0
  23. {dartsort-0.5.1 → dartsort-0.5.2}/.gitignore +0 -0
  24. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/.keep +0 -0
  25. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/basic_integration_test.py +0 -0
  26. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/ci diag.py +0 -0
  27. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/dartsort_dredge_demo.ipynb +0 -0
  28. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/dartsort_dredge_demo.py +0 -0
  29. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/data test.py +0 -0
  30. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/dead reckoning.py +0 -0
  31. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/denoise np1.py +0 -0
  32. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/denoise np2.py +0 -0
  33. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/exploratory.py +0 -0
  34. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/geom debug.py +0 -0
  35. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/hdbscan_clustering_5min.py +0 -0
  36. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/hybrid 10.py +0 -0
  37. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/hybrid cluster.py +0 -0
  38. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/hybrid_11.py +0 -0
  39. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/initial training.py +0 -0
  40. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/make hybrid.py +0 -0
  41. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/mgh.py +0 -0
  42. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/np1 feats.py +0 -0
  43. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/np2 processing version c.py +0 -0
  44. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/paperfigs.py +0 -0
  45. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/pdists.py +0 -0
  46. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/postcheck.py +0 -0
  47. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/ptp vae.py +0 -0
  48. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/re clust.py +0 -0
  49. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/reg fig loop.py +0 -0
  50. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/reg_sim_exp.py +0 -0
  51. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/relocating.py +0 -0
  52. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/relocating_all.py +0 -0
  53. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/restats +0 -0
  54. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/sortStinger1.py +0 -0
  55. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/sortStinger3.py +0 -0
  56. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/sortStinger4.py +0 -0
  57. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/sortStinger5.py +0 -0
  58. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/sortStinger6.py +0 -0
  59. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/spike farm.py +0 -0
  60. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/ss_ensemble_sim.py +0 -0
  61. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/ss_ensemble_sim_drift.py +0 -0
  62. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/ss_sim.py +0 -0
  63. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/stan diagnostics.py +0 -0
  64. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/storytelling c.py +0 -0
  65. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/storytelling.py +0 -0
  66. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/subtract_with_phaseshift_denoiser.py +0 -0
  67. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/debug_matching.py +0 -0
  68. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/test_agreement.py +0 -0
  69. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/test_amplitude_scaling.py +0 -0
  70. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/test_batch_optim.py +0 -0
  71. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/test_ibme.py +0 -0
  72. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/test_mm_initialization.py +0 -0
  73. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/test_normxcorr1d.py +0 -0
  74. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/test_reassignment.py +0 -0
  75. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/tests/test_relocation.py +0 -0
  76. {dartsort-0.5.1 → dartsort-0.5.2}/notebook/thomas.py +0 -0
  77. {dartsort-0.5.1 → dartsort-0.5.2}/setup.cfg +0 -0
  78. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/__init__.py +0 -0
  79. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/cli.py +0 -0
  80. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/__init__.py +0 -0
  81. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/agglomerate.py +0 -0
  82. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/cluster_util.py +0 -0
  83. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/clustering.py +0 -0
  84. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/clustering_features.py +0 -0
  85. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/density.py +0 -0
  86. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/forward_backward.py +0 -0
  87. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/kmeans.py +0 -0
  88. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/merge.py +0 -0
  89. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/mixture.py +0 -0
  90. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/modes.py +0 -0
  91. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/clustering/refine_util.py +0 -0
  92. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/config.py +0 -0
  93. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/detect/__init__.py +0 -0
  94. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/detect/detect.py +0 -0
  95. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/detect/detect_filters.py +0 -0
  96. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/evaluate/__init__.py +0 -0
  97. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/evaluate/analysis.py +0 -0
  98. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/evaluate/comparison.py +0 -0
  99. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/evaluate/hybrid_util.py +0 -0
  100. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/evaluate/sim_template_tools.py +0 -0
  101. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/evaluate/simkit.py +0 -0
  102. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/evaluate/simlib.py +0 -0
  103. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/localize/__init__.py +0 -0
  104. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/localize/localize_torch.py +0 -0
  105. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/localize/localize_util.py +0 -0
  106. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/main.py +0 -0
  107. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/__init__.py +0 -0
  108. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/grab.py +0 -0
  109. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/matching.py +0 -0
  110. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/matching_util/__init__.py +0 -0
  111. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/matching_util/compressed_upsampled.py +0 -0
  112. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/matching_util/drifty.py +0 -0
  113. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/matching_util/matching_base.py +0 -0
  114. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/matching_util/pairwise.py +0 -0
  115. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
  116. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/shaver.py +0 -0
  117. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/peel/threshold.py +0 -0
  118. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
  119. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/detect_np1.pt +0 -0
  120. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/detect_np2.pt +0 -0
  121. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/glasbey1024.npz +0 -0
  122. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
  123. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
  124. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
  125. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
  126. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
  127. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/templates/__init__.py +0 -0
  128. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/templates/postprocess_util.py +0 -0
  129. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/templates/realignment.py +0 -0
  130. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/templates/templates.py +0 -0
  131. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/templates/templib.py +0 -0
  132. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/__init__.py +0 -0
  133. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/_multichan_denoiser_kit.py +0 -0
  134. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/all_transformers.py +0 -0
  135. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/amortized_localization.py +0 -0
  136. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/amplitudes.py +0 -0
  137. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/decollider.py +0 -0
  138. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/denoising_scorer.py +0 -0
  139. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/enforce_decrease.py +0 -0
  140. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/fixed_prop.py +0 -0
  141. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/interp.py +0 -0
  142. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/localize.py +0 -0
  143. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/matching_denoiser.py +0 -0
  144. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/mixture_classifier.py +0 -0
  145. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/pipeline.py +0 -0
  146. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/reduction.py +0 -0
  147. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/single_channel_denoiser.py +0 -0
  148. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/supervised_denoiser.py +0 -0
  149. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/temporal_pca.py +0 -0
  150. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/transform_base.py +0 -0
  151. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/transform/whiten.py +0 -0
  152. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/__init__.py +0 -0
  153. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/cli_util.py +0 -0
  154. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/data_util.py +0 -0
  155. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/drift_util.py +0 -0
  156. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/interpolation_util.py +0 -0
  157. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/job_util.py +0 -0
  158. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/logging_util.py +0 -0
  159. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/main_util.py +0 -0
  160. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/more_operators.py +0 -0
  161. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/motion.py +0 -0
  162. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/multiprocessing_util.py +0 -0
  163. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/nn_util.py +0 -0
  164. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/noise_util.py +0 -0
  165. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/peel_util.py +0 -0
  166. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/preprocess_util.py +0 -0
  167. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/py_util.py +0 -0
  168. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/registration_util.py +0 -0
  169. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/residual_util.py +0 -0
  170. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/sparse_util.py +0 -0
  171. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/spikeio.py +0 -0
  172. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/spiketorch.py +0 -0
  173. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/testing_util/__init__.py +0 -0
  174. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/testing_util/matching_debug_util.py +0 -0
  175. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -0
  176. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/torch_optimization_util.py +0 -0
  177. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/torch_util.py +0 -0
  178. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/util/waveform_util.py +0 -0
  179. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/__init__.py +0 -0
  180. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/analysis_plots.py +0 -0
  181. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/gt.py +0 -0
  182. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/layout.py +0 -0
  183. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/metrics_util.py +0 -0
  184. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/mixture.py +0 -0
  185. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/recanim.py +0 -0
  186. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/scatterplots.py +0 -0
  187. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/sorting.py +0 -0
  188. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/unit.py +0 -0
  189. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/unit_comparison.py +0 -0
  190. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/versus.py +0 -0
  191. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/vismain.py +0 -0
  192. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort/vis/waveforms.py +0 -0
  193. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort.egg-info/SOURCES.txt +0 -0
  194. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort.egg-info/dependency_links.txt +0 -0
  195. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort.egg-info/entry_points.txt +0 -0
  196. {dartsort-0.5.1 → dartsort-0.5.2}/src/dartsort.egg-info/top_level.txt +0 -0
  197. {dartsort-0.5.1 → dartsort-0.5.2}/tests/conftest.py +0 -0
  198. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_alignment.py +0 -0
  199. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_clustering.py +0 -0
  200. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_config.py +0 -0
  201. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_dartsort.py +0 -0
  202. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_data_util.py +0 -0
  203. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_detect.py +0 -0
  204. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_drift_util.py +0 -0
  205. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_drifty_matching.py +0 -0
  206. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_enforce_decrease.py +0 -0
  207. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_grab_and_featurize.py +0 -0
  208. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_kmeans.py +0 -0
  209. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_linalg.py +0 -0
  210. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_localize_torch.py +0 -0
  211. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_matching.py +0 -0
  212. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_mixture_classifier.py +0 -0
  213. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_modeling.py +0 -0
  214. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_simkit.py +0 -0
  215. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_spiketorch.py +0 -0
  216. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_subtract.py +0 -0
  217. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_templates.py +0 -0
  218. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_threshold.py +0 -0
  219. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_torch_optimization_util.py +0 -0
  220. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_transform.py +0 -0
  221. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_util.py +0 -0
  222. {dartsort-0.5.1 → dartsort-0.5.2}/tests/test_waveform_util.py +0 -0
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.4
2
+ Name: dartsort
3
+ Version: 0.5.2
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
+ Provides-Extra: test
33
+ Requires-Dist: pytest; extra == "test"
34
+ Requires-Dist: pytest-cov; extra == "test"
35
+ Provides-Extra: vis
36
+ Requires-Dist: matplotlib; extra == "vis"
37
+ Requires-Dist: seaborn; extra == "vis"
38
+ Requires-Dist: matplotlib-venn; extra == "vis"
39
+
40
+ [![ci](https://github.com/cwindolf/dartsort/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cwindolf/dartsort/actions/)
41
+ [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
42
+ [![Zenodo DOI](https://zenodo.org/badge/421108722.svg)](https://doi.org/10.5281/zenodo.16943074)
43
+ [![pypi: dartsort](https://img.shields.io/pypi/v/dartsort?label=pypi:%20dartsort)](https://pypi.org/p/dartsort)
44
+
45
+
46
+ # dartsort
47
+
48
+
49
+ *dartsort* is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
50
+ It is also a toolkit of modules for building spike sorters or other analyses of electrophysiology data.
51
+
52
+
53
+ ## :warning: work in progress :warning:
54
+
55
+ We do not currently recommend DARTsort for production spike sorting purposes.
56
+ Please feel free to open an issue or a discussion if you run into problems.
57
+
58
+
59
+ ## Installation
60
+
61
+ ### Installing into an existing environment
62
+
63
+ If you already have a Python environment with PyTorch working and you just want to get *dartsort* there, use
64
+
65
+ ```sh
66
+ $ pip install dartsort
67
+ ```
68
+
69
+ If you want to run the test suite or use `dartsort.vis`, you can install the optional dependencies with `pip install dartsort[test,vis]`.
70
+
71
+ If you need a Python environment, expand the next section.
72
+
73
+ <details>
74
+
75
+ <summary><h3>Setting up a Python environment</h3></summary>
76
+
77
+ Otherwise, there are a few ways to get Python and PyTorch set up, including new tools like `uv`, but I find that a [`conda-forge`](https://conda-forge.org/)-based distribution is still the most reliable at installing the GPU dependencies which PyTorch needs (note: `conda-forge` is different from the non-free Anaconda).
78
+
79
+ You can use `conda-forge` to install Python, `dartsort`, and its dependencies as follows:
80
+ - Follow the `conda-forge` installation instructions for your platform at [https://conda-forge.org/download/](https://conda-forge.org/download/)
81
+ - Create an environment with
82
+ ```sh
83
+ $ mamba env create -f environment.yml
84
+ ```
85
+ This will create an environment called `dartsort`, but you can change the name by adding `-n othername`.
86
+ - Activate the environment:
87
+ ```sh
88
+ $ mamba activate dartsort
89
+ ```
90
+ - Install `dartsort` and the rest of its dependencies by running the pip command [above](#installing-into-an-existing-environment)
91
+
92
+ </details>
93
+
94
+
95
+ ## Usage
96
+
97
+ ### As a Python function
98
+
99
+ *dartsort* can be run from inside Python with:
100
+
101
+ ```python
102
+ import dartsort
103
+
104
+ dartsort.dartsort(recording, output_dir)
105
+
106
+ # or, to set configuration options, something like...
107
+ dartsort_result = dartsort.dartsort(
108
+ recording,
109
+ output_dir,
110
+ cfg=dartsort.DARTsortUserConfig(
111
+ preprocessing="ibllike",
112
+ work_in_tmpdir=True,
113
+ copy_recording_to_tmpdir=True,
114
+ ),
115
+ )
116
+ ```
117
+
118
+ **Please** read the [important configuration details section](#important-configuration-details) below.
119
+ Some of them, like preprocessing, are not set by default and need your input! (This could change.)
120
+
121
+ Here, `recording` is a [SpikeInterface](SpikeInterface) recording object.
122
+ SpikeInterface can read every electrophysiology data format that I've encountered and many I haven't; see
123
+
124
+ `output_dir` is the folder where *dartsort* will save its output.
125
+
126
+ Once you've run *dartsort*, you might want to check out [the outputs and exporting](#outputs-and-exporting) section below.
127
+
128
+ ### Important configuration details
129
+
130
+ Before running *dartsort*, please be aware of the following important configuration options.
131
+
132
+ - `preprocessing`: *dartsort* won't touch your data by default (`preprocessing="none"`), leaving you free to implement your own preprocessing in SpikeInterface or otherwise, and therefore *dartsort* will explode if you don't set this flag and leave your data in its original raw state (for instance, the raw `int16` data off the probe).
133
+ - 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.
134
+ - `do_motion_estimation=True` by default, and you may like to disable it if you know for a fact that there is (say) less than 5 microns of total drift in your recording, or if you have handled this in your own preprocessing (which is discouraged, since *dartsort* has its own approach.)
135
+ - `work_in_tmpdir` and `copy_recording_to_tmpdir` can be helpful in some cases where slow network drives are involved.
136
+
137
+ ### Outputs and exporting
138
+
139
+ The `dartsort_result = dartsort(...)` function returns a dictionary `dartsort_result` containing a `DARTsortSorting` object under the key `sorting = dartsort_result["sorting"]`.
140
+ 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).
141
+
142
+ If you already ran *dartsort* and want to load the output spike trains, use `dartsort.load(output_dir)` to get the `DARTsortSorting` object.
143
+
144
+ This object can also export itself to other formats:
145
+ - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
146
+ - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
147
+ - 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.
148
+ - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
149
+ - For pandas, use `sorting.to_pandas()`.
150
+
151
+ *dartsort* also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
152
+
153
+ The data is saved to `output_dir` in the following files:
154
+ - `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
155
+ - `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`.
156
+ - `motion_info.pkl` is a pickled `MotionInfo` object.
157
+ - 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.
158
+
159
+ ### Visualization
160
+
161
+ To make some basic visualizations of the sorting result with matplotlib, try:
162
+
163
+ ```python
164
+ import dartsort.vis as dartvis
165
+
166
+ # gather outputs from dartsort
167
+ dartsort_result = dartsort(recording, output_dir, ...)
168
+ sorting = dartsort_result["sorting"]
169
+ motion = dartsort_result["motion"]
170
+
171
+ # or, if you already ran it
172
+ sorting = dartsort.load(output_dir)
173
+ motion = dartsort.try_load_motion_info(output_dir)
174
+
175
+ dartvis.visualize_sorting(
176
+ recording,
177
+ sorting,
178
+ vis_save_dir,
179
+ motion=motion,
180
+ make_unit_summaries=False,
181
+ )
182
+ ```
183
+
184
+ Set `make_unit_summaries=True` to create a summary plot for each unit.
185
+
186
+ ### Command-line interface
187
+
188
+ Try running
189
+
190
+ ```sh
191
+ $ dartsort -h
192
+ ```
193
+
194
+ on your command line to see usage instructions; parameters can be configured on the command line or read from a TOML file.
195
+
196
+ ## Troubleshooting
197
+
198
+ Please let us know if you run into any issues.
199
+ If you feel that the issue is a software bug, feel free to open an issue or a discussion on GitHub.
200
+ 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).
201
+
202
+
203
+
204
+ [SpikeInterface]: https://spikeinterface.readthedocs.io
205
+ [iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
206
+ [Pynapple]: https://pynapple.org/
@@ -0,0 +1,167 @@
1
+ [![ci](https://github.com/cwindolf/dartsort/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cwindolf/dartsort/actions/)
2
+ [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
3
+ [![Zenodo DOI](https://zenodo.org/badge/421108722.svg)](https://doi.org/10.5281/zenodo.16943074)
4
+ [![pypi: dartsort](https://img.shields.io/pypi/v/dartsort?label=pypi:%20dartsort)](https://pypi.org/p/dartsort)
5
+
6
+
7
+ # dartsort
8
+
9
+
10
+ *dartsort* is a modular spike sorter built around a statistical clustering model and a new approach to probe motion.
11
+ It is also a toolkit of modules for building spike sorters or other analyses of electrophysiology data.
12
+
13
+
14
+ ## :warning: work in progress :warning:
15
+
16
+ We do not currently recommend DARTsort for production spike sorting purposes.
17
+ Please feel free to open an issue or a discussion if you run into problems.
18
+
19
+
20
+ ## Installation
21
+
22
+ ### Installing into an existing environment
23
+
24
+ If you already have a Python environment with PyTorch working and you just want to get *dartsort* there, use
25
+
26
+ ```sh
27
+ $ pip install dartsort
28
+ ```
29
+
30
+ If you want to run the test suite or use `dartsort.vis`, you can install the optional dependencies with `pip install dartsort[test,vis]`.
31
+
32
+ If you need a Python environment, expand the next section.
33
+
34
+ <details>
35
+
36
+ <summary><h3>Setting up a Python environment</h3></summary>
37
+
38
+ Otherwise, there are a few ways to get Python and PyTorch set up, including new tools like `uv`, but I find that a [`conda-forge`](https://conda-forge.org/)-based distribution is still the most reliable at installing the GPU dependencies which PyTorch needs (note: `conda-forge` is different from the non-free Anaconda).
39
+
40
+ You can use `conda-forge` to install Python, `dartsort`, and its dependencies as follows:
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
+ </details>
54
+
55
+
56
+ ## Usage
57
+
58
+ ### As a Python function
59
+
60
+ *dartsort* can be run from inside 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.
80
+ Some of them, like preprocessing, are not set by default and need your input! (This could change.)
81
+
82
+ Here, `recording` is a [SpikeInterface](SpikeInterface) recording object.
83
+ SpikeInterface can read every electrophysiology data format that I've encountered and many I haven't; see
84
+
85
+ `output_dir` is the folder where *dartsort* will save its output.
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, and therefore *dartsort* will explode if you don't set this flag and leave your data in its original raw 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, and you may like to disable it if you know for a fact that there is (say) less than 5 microns of total drift in your recording, or if you have handled this in your own preprocessing (which is discouraged, since *dartsort* has its own approach.)
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 under the key `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
+ - For a SpikeInterface `NumpySorting` object, use `sorting.to_numpy_sorting()`
107
+ - For a [Pynapple][Pynapple] `TsGroup`, use `sorting.to_tsgroup()`
108
+ - 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.
109
+ - For a simple dictionary of numpy arrays, use `dict = sorting.spike_feature_dict`.
110
+ - For pandas, use `sorting.to_pandas()`.
111
+
112
+ *dartsort* also saves motion information, returned as `dartsort_result["motion"]` or loaded after the fact as `dartsort.try_load_motion_info(output_dir)`.
113
+
114
+ The data is saved to `output_dir` in the following files:
115
+ - `dartsort_sorting.npz`: This NPZ file contains the final spike train under the keys `times_samples`, `channels`, and `labels`.
116
+ - `matching1.h5`: This HDF5 file contains spike features and other data from the last matching step. Amplitudes, localizations, and other features live in here; use `h5ls` on the command line to see what's in there. Be aware that the `labels` dataset in this HDF5 is not the same as what's saved in the `dartsort_sorting.npz`.
117
+ - `motion_info.pkl` is a pickled `MotionInfo` object.
118
+ - There may be a models/ folder containing PyTorch weights files with modeling quantities (for instance, featurization SVD bases, localization neural nets, Gaussian mixture model parameters). If you want to load these up, feel free to reach out for help.
119
+
120
+ ### Visualization
121
+
122
+ To make some basic visualizations of the sorting result with matplotlib, try:
123
+
124
+ ```python
125
+ import dartsort.vis as dartvis
126
+
127
+ # gather outputs from dartsort
128
+ dartsort_result = dartsort(recording, output_dir, ...)
129
+ sorting = dartsort_result["sorting"]
130
+ motion = dartsort_result["motion"]
131
+
132
+ # or, if you already ran it
133
+ sorting = dartsort.load(output_dir)
134
+ motion = dartsort.try_load_motion_info(output_dir)
135
+
136
+ dartvis.visualize_sorting(
137
+ recording,
138
+ sorting,
139
+ vis_save_dir,
140
+ motion=motion,
141
+ make_unit_summaries=False,
142
+ )
143
+ ```
144
+
145
+ Set `make_unit_summaries=True` to create a summary plot for each unit.
146
+
147
+ ### Command-line interface
148
+
149
+ Try running
150
+
151
+ ```sh
152
+ $ dartsort -h
153
+ ```
154
+
155
+ on your command line to see usage instructions; parameters can be configured on the command line or read from a TOML file.
156
+
157
+ ## Troubleshooting
158
+
159
+ Please let us know if you run into any issues.
160
+ If you feel that the issue is a software bug, feel free to open an issue or a discussion on GitHub.
161
+ 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).
162
+
163
+
164
+
165
+ [SpikeInterface]: https://spikeinterface.readthedocs.io
166
+ [iblsorting]: https://figshare.com/articles/online_resource/Spike_sorting_pipeline_for_the_International_Brain_Laboratory/19705522
167
+ [Pynapple]: https://pynapple.org/
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: dartsort
3
+ channels:
4
+ - conda-forge
5
+ dependencies:
6
+ - python=3.14
7
+ - h5py
8
+ - ipykernel
9
+ - ipython
10
+ - ipywidgets
11
+ - kdepy
12
+ - linear_operator
13
+ - matplotlib
14
+ - numba
15
+ - numpy>=2.0
16
+ - opt-einsum
17
+ - pandas
18
+ - pip
19
+ - pydantic
20
+ - pytest
21
+ - pytorch>=2.0
22
+ - scipy>=1.13
23
+ - scikit-learn
24
+ - tqdm
@@ -37,10 +37,8 @@ dependencies = [
37
37
  ]
38
38
 
39
39
  [project.optional-dependencies]
40
- vis = ["matplotlib", "seaborn", "matplotlib-venn"]
41
- gpu = ["cupy"]
42
- full = ["matplotlib", "seaborn", "pytest", "matplotlib-venn", "pytest-cov", "ipywidgets", "ipykernel", "black"]
43
40
  test = ["pytest", "pytest-cov"]
41
+ vis = ["matplotlib", "seaborn", "matplotlib-venn"]
44
42
 
45
43
  [project.urls]
46
44
  "Homepage" = "https://github.com/cwindolf/dartsort"
@@ -1,5 +1,5 @@
1
- from pathlib import Path
2
1
  import tempfile
2
+ from pathlib import Path
3
3
 
4
4
  import numpy as np
5
5
  from spikeinterface.core import BaseRecording, BaseRecordingSegment, read_binary_folder
@@ -10,7 +10,7 @@ from spikeinterface.preprocessing.basepreprocessor import (
10
10
  )
11
11
 
12
12
  from ..util.noise_util import StationaryFactorizedNoise
13
- from .simlib import default_temporal_kernel_npy, rbf_kernel_sqrt, generate_geom
13
+ from .simlib import default_temporal_kernel_npy, generate_geom, rbf_kernel_sqrt
14
14
 
15
15
 
16
16
  def get_background_recording(
@@ -698,6 +698,9 @@ class BasePeeler(BModule):
698
698
  sampling_frequency=self.recording.sampling_frequency,
699
699
  )
700
700
 
701
+ if tmp_dir is None:
702
+ tmp_dir = computation_cfg.tmpdir_parent
703
+
701
704
  with tempfile.TemporaryDirectory(dir=tmp_dir) as temp_dir:
702
705
  temp_hdf5_filename = Path(temp_dir) / "peeler_fit.h5"
703
706
  waveforms = fixed_properties = None
@@ -886,6 +886,8 @@ def threshold_to_fit(
886
886
  else:
887
887
  n_resid_snips = None
888
888
 
889
+ if tmp_dir is None:
890
+ tmp_dir = computation_cfg.tmpdir_parent
889
891
  with TemporaryDirectory(dir=tmp_dir) as temp_dir:
890
892
  temp_hdf5_filename = Path(temp_dir) / "subtraction_denoiser0_fit.h5"
891
893
  try:
@@ -87,7 +87,9 @@ class ReductionTemplateData(TemplateData):
87
87
  n_jobs_small=computation_cfg.n_jobs_small,
88
88
  )
89
89
  with TemporaryDirectory(
90
- prefix="dartsorttemplates", ignore_cleanup_errors=True
90
+ prefix="dartsorttemplates",
91
+ ignore_cleanup_errors=True,
92
+ dir=computation_cfg.tmpdir_parent,
91
93
  ) as tdir:
92
94
  tdir = resolve_path(tdir)
93
95
  h5p = tdir / "tmp.h5"
@@ -1,7 +1,7 @@
1
1
  import gc
2
- import tempfile
3
2
  from dataclasses import replace
4
3
  from pathlib import Path
4
+ from tempfile import TemporaryDirectory
5
5
 
6
6
  import numpy as np
7
7
  import torch
@@ -396,7 +396,9 @@ class SubtractionPeeler(BasePeeler):
396
396
  self.featurization_pipeline = WaveformPipeline([])
397
397
 
398
398
  # run mini subtraction
399
- with tempfile.TemporaryDirectory(dir=tmp_dir) as temp_dir:
399
+ if tmp_dir is None:
400
+ tmp_dir = computation_cfg.tmpdir_parent
401
+ with TemporaryDirectory(dir=tmp_dir) as temp_dir:
400
402
  temp_hdf5_filename = Path(temp_dir) / f"subtraction_{which[:-1]}_fit.h5"
401
403
  try:
402
404
  self.run_subsampled_peeling(
@@ -183,11 +183,6 @@ def get_templates(
183
183
  If True and output_hdf5_filename is supplied, waveforms extracted
184
184
  for template computation are retained in the output hdf5. Else,
185
185
  deleted to save disk space.
186
- scratch_dir : str or Path
187
- This is where a temporary directory will be made for intermediate
188
- computations, if output_hdf5_filename is None. If it's left blank,
189
- the tempfile default directory is used. If output_hdf5_file is not
190
- None, that hdf5 file is used and this argument is ignored.
191
186
 
192
187
  Returns
193
188
  -------
@@ -394,7 +394,7 @@ def temporally_upsample_templates(
394
394
  n, t, c = templates.shape
395
395
  tp = np.arange(t).astype(float)
396
396
  erp = interp1d(tp, templates, axis=1, bounds_error=True, kind=kind)
397
- tup = np.arange(t, step=1.0 / temporal_upsampling_factor) # type: ignore
397
+ tup = np.arange(t, step=1.0 / temporal_upsampling_factor) # type: ignore # ty: ignore[x]
398
398
  tup.clip(0, t - 1, out=tup)
399
399
  upsampled_templates = erp(tup)
400
400
  upsampled_templates = upsampled_templates.reshape(
@@ -800,6 +800,7 @@ class ComputationConfig:
800
800
  n_jobs_small_gpu: int = 4
801
801
  executor: str = "threading_unless_multigpu"
802
802
  device: str | None = argfield(default=None, arg_type=str)
803
+ tmpdir_parent: str | None = None
803
804
 
804
805
  @classmethod
805
806
  def from_n_jobs(cls, n_jobs, n_jobs_small=8):
@@ -1218,6 +1219,7 @@ def to_internal_config(cfg) -> DARTsortInternalConfig:
1218
1219
  n_jobs_gpu=cfg.n_jobs_gpu,
1219
1220
  device=cfg.device,
1220
1221
  executor=cfg.executor,
1222
+ tmpdir_parent=cfg.tmpdir_parent,
1221
1223
  )
1222
1224
 
1223
1225
  # final aggregation
@@ -6,7 +6,7 @@ try:
6
6
  from importlib.resources import files
7
7
  except ImportError:
8
8
  try:
9
- from importlib_resources import files
9
+ from importlib_resources import files # type: ignore # ty: ignore[x]
10
10
  except ImportError:
11
11
  raise ValueError("Need python>=3.10 or pip install importlib_resources.")
12
12