DARTsort 0.3.5__py3-none-any.whl

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 (125) hide show
  1. dartsort/__init__.py +68 -0
  2. dartsort/cli.py +105 -0
  3. dartsort/clustering/__init__.py +3 -0
  4. dartsort/clustering/cluster_util.py +392 -0
  5. dartsort/clustering/clustering.py +765 -0
  6. dartsort/clustering/clustering_features.py +202 -0
  7. dartsort/clustering/density.py +1299 -0
  8. dartsort/clustering/forward_backward.py +219 -0
  9. dartsort/clustering/gmm/mixture.py +5790 -0
  10. dartsort/clustering/gmm/stable_features.py +993 -0
  11. dartsort/clustering/kmeans.py +448 -0
  12. dartsort/clustering/merge.py +501 -0
  13. dartsort/clustering/modes.py +214 -0
  14. dartsort/clustering/refine_util.py +191 -0
  15. dartsort/clustering/relocate.py +109 -0
  16. dartsort/clustering/split.py +1285 -0
  17. dartsort/config.py +288 -0
  18. dartsort/detect/__init__.py +2 -0
  19. dartsort/detect/detect.py +449 -0
  20. dartsort/detect/detect_filters.py +37 -0
  21. dartsort/evaluate/__init__.py +1 -0
  22. dartsort/evaluate/analysis.py +594 -0
  23. dartsort/evaluate/comparison.py +534 -0
  24. dartsort/evaluate/hybrid_util.py +599 -0
  25. dartsort/evaluate/noise_recording_tools.py +184 -0
  26. dartsort/evaluate/sim_template_tools.py +842 -0
  27. dartsort/evaluate/simkit.py +840 -0
  28. dartsort/evaluate/simlib.py +270 -0
  29. dartsort/localize/__init__.py +0 -0
  30. dartsort/localize/localize_torch.py +291 -0
  31. dartsort/localize/localize_util.py +313 -0
  32. dartsort/main.py +657 -0
  33. dartsort/peel/__init__.py +6 -0
  34. dartsort/peel/grab.py +208 -0
  35. dartsort/peel/matching.py +628 -0
  36. dartsort/peel/matching_util/__init__.py +3 -0
  37. dartsort/peel/matching_util/compressed_upsampled.py +718 -0
  38. dartsort/peel/matching_util/drifty.py +791 -0
  39. dartsort/peel/matching_util/matching_base.py +616 -0
  40. dartsort/peel/matching_util/pairwise.py +359 -0
  41. dartsort/peel/matching_util/pairwise_util.py +1317 -0
  42. dartsort/peel/peel_base.py +1000 -0
  43. dartsort/peel/running_template.py +1498 -0
  44. dartsort/peel/subtract.py +1123 -0
  45. dartsort/peel/threshold.py +471 -0
  46. dartsort/peel/universal.py +191 -0
  47. dartsort/pretrained/default_temporal_kernel.npy +0 -0
  48. dartsort/pretrained/detect_np1.pt +0 -0
  49. dartsort/pretrained/detect_np2.pt +0 -0
  50. dartsort/pretrained/glasbey1024.npz +0 -0
  51. dartsort/pretrained/offset_trained_denoiser.pt +0 -0
  52. dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
  53. dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
  54. dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
  55. dartsort/pretrained/single_chan_denoiser.pt +0 -0
  56. dartsort/templates/__init__.py +11 -0
  57. dartsort/templates/get_templates.py +771 -0
  58. dartsort/templates/postprocess_util.py +555 -0
  59. dartsort/templates/realignment.py +466 -0
  60. dartsort/templates/superres_util.py +204 -0
  61. dartsort/templates/template_util.py +518 -0
  62. dartsort/templates/templates.py +528 -0
  63. dartsort/transform/__init__.py +2 -0
  64. dartsort/transform/_multichan_denoiser_kit.py +650 -0
  65. dartsort/transform/all_transformers.py +58 -0
  66. dartsort/transform/amortized_localization.py +503 -0
  67. dartsort/transform/amplitudes.py +197 -0
  68. dartsort/transform/decollider.py +635 -0
  69. dartsort/transform/enforce_decrease.py +158 -0
  70. dartsort/transform/localize.py +86 -0
  71. dartsort/transform/matching_denoiser.py +44 -0
  72. dartsort/transform/pipeline.py +391 -0
  73. dartsort/transform/single_channel_denoiser.py +153 -0
  74. dartsort/transform/single_channel_templates.py +98 -0
  75. dartsort/transform/supervised_denoiser.py +486 -0
  76. dartsort/transform/temporal_pca.py +413 -0
  77. dartsort/transform/transform_base.py +255 -0
  78. dartsort/util/__init__.py +0 -0
  79. dartsort/util/cli_util.py +179 -0
  80. dartsort/util/data_util.py +1128 -0
  81. dartsort/util/drift_util.py +1054 -0
  82. dartsort/util/internal_config.py +1074 -0
  83. dartsort/util/interpolation_util.py +1012 -0
  84. dartsort/util/job_util.py +19 -0
  85. dartsort/util/logging_util.py +91 -0
  86. dartsort/util/main_util.py +235 -0
  87. dartsort/util/more_operators.py +269 -0
  88. dartsort/util/multiprocessing_util.py +211 -0
  89. dartsort/util/nn_util.py +461 -0
  90. dartsort/util/noise_util.py +1461 -0
  91. dartsort/util/peel_util.py +223 -0
  92. dartsort/util/py_util.py +213 -0
  93. dartsort/util/registration_util.py +128 -0
  94. dartsort/util/residual_util.py +30 -0
  95. dartsort/util/sparse_util.py +81 -0
  96. dartsort/util/spikeio.py +227 -0
  97. dartsort/util/spiketorch.py +1198 -0
  98. dartsort/util/testing_util/__init__.py +0 -0
  99. dartsort/util/testing_util/matching_debug_util.py +517 -0
  100. dartsort/util/testing_util/mixture_testing_util.py +291 -0
  101. dartsort/util/torch_optimization_util.py +156 -0
  102. dartsort/util/torch_util.py +75 -0
  103. dartsort/util/universal_util.py +269 -0
  104. dartsort/util/waveform_util.py +809 -0
  105. dartsort/vis/__init__.py +19 -0
  106. dartsort/vis/analysis_plots.py +392 -0
  107. dartsort/vis/colors.py +36 -0
  108. dartsort/vis/gt.py +392 -0
  109. dartsort/vis/layout.py +149 -0
  110. dartsort/vis/metrics_util.py +23 -0
  111. dartsort/vis/mixture.py +1489 -0
  112. dartsort/vis/over_time.py +514 -0
  113. dartsort/vis/recanim.py +429 -0
  114. dartsort/vis/scatterplots.py +779 -0
  115. dartsort/vis/sorting.py +163 -0
  116. dartsort/vis/unit.py +917 -0
  117. dartsort/vis/unit_comparison.py +1017 -0
  118. dartsort/vis/versus.py +300 -0
  119. dartsort/vis/vismain.py +537 -0
  120. dartsort/vis/waveforms.py +357 -0
  121. dartsort-0.3.5.dist-info/METADATA +93 -0
  122. dartsort-0.3.5.dist-info/RECORD +125 -0
  123. dartsort-0.3.5.dist-info/WHEEL +5 -0
  124. dartsort-0.3.5.dist-info/entry_points.txt +2 -0
  125. dartsort-0.3.5.dist-info/top_level.txt +1 -0
@@ -0,0 +1,357 @@
1
+ import matplotlib.pyplot as plt
2
+ from matplotlib.collections import LineCollection
3
+ from matplotlib.colors import to_rgba
4
+ from matplotlib.patches import Rectangle
5
+ import numpy as np
6
+ import torch
7
+
8
+ from .colors import glasbey1024
9
+
10
+
11
+ def geomplot(
12
+ waveforms,
13
+ *,
14
+ max_channel=None,
15
+ max_channels=None,
16
+ channel_index=None,
17
+ channels=None,
18
+ geom=None,
19
+ ax=None,
20
+ z_extension=1.0,
21
+ x_extension=0.8,
22
+ show_zero=True,
23
+ show_trough=True,
24
+ trough_offset=42,
25
+ show_zero_kwargs=None,
26
+ max_abs_amp=None,
27
+ show_chan_label=False,
28
+ annotate_z=True,
29
+ chan_labels=None,
30
+ xlim_factor=1,
31
+ subar=False,
32
+ msbar=False,
33
+ bar_color="k",
34
+ bar_background="w",
35
+ zlim: str | None = "tight",
36
+ c=None,
37
+ color=None,
38
+ colors=None,
39
+ return_chans=False,
40
+ linestyles=None,
41
+ linewidths=None,
42
+ randomize=False,
43
+ random_seed=0,
44
+ **plot_kwargs,
45
+ ):
46
+ """Plot waveforms according to geometry using channel index"""
47
+ assert geom is not None
48
+ ax = ax or plt.gca()
49
+
50
+ # args to numpy if necessary
51
+ if torch.is_tensor(waveforms):
52
+ waveforms = waveforms.numpy(force=True)
53
+ if torch.is_tensor(max_channels):
54
+ max_channels = max_channels.numpy(force=True)
55
+ if torch.is_tensor(channels):
56
+ channels = channels.numpy(force=True)
57
+ if torch.is_tensor(geom):
58
+ geom = geom.numpy(force=True)
59
+ if torch.is_tensor(c):
60
+ c = c.numpy(force=True)
61
+ if max_channel is not None:
62
+ max_channels = np.array([max_channel])
63
+ max_channels = np.broadcast_to(max_channels, (len(waveforms),))
64
+
65
+ # randomize if asked to
66
+ if randomize:
67
+ rg = np.random.default_rng(random_seed)
68
+ o = rg.permutation(len(waveforms))
69
+ if waveforms is not None:
70
+ waveforms = waveforms[o]
71
+ if max_channels is not None:
72
+ max_channels = max_channels[o]
73
+ if channels is not None:
74
+ channels = channels[o]
75
+ if c is not None and hasattr(c, "__len__") and len(c) == len(o):
76
+ c = c[o]
77
+ if colors is not None and len(colors) == len(o):
78
+ colors = colors[o]
79
+
80
+ # -- validate shapes
81
+ if waveforms.ndim == 2:
82
+ waveforms = waveforms[None]
83
+ assert waveforms.ndim == 3
84
+ if c is not None and (hasattr(c, "__len__") and len(c) > 1):
85
+ assert len(c) == len(waveforms)
86
+ if channels is None:
87
+ if max_channels is None and channel_index is None:
88
+ max_channels = np.zeros(waveforms.shape[0], dtype=int)
89
+ channel_index = (
90
+ np.arange(geom.shape[0])[None, :]
91
+ * np.ones(geom.shape[0], dtype=int)[:, None]
92
+ )
93
+ max_channels = np.atleast_1d(max_channels)
94
+ n_channels, C = channel_index.shape
95
+ assert geom.shape == (n_channels, 2)
96
+ T = waveforms.shape[1]
97
+ if waveforms.shape != (*max_channels.shape, T, C):
98
+ raise ValueError(
99
+ f"Bad shapes: {waveforms.shape=}, {max_channels.shape=}, {C=}"
100
+ )
101
+ channels = channel_index[max_channels]
102
+ else:
103
+ n_channels = geom[np.isfinite(geom).all(1)].shape[0]
104
+ T = waveforms.shape[1]
105
+ assert channels.shape[0] == waveforms.shape[0]
106
+ assert channels.shape[1] == waveforms.shape[-1]
107
+
108
+ # -- figure out units for plotting
109
+ valid = np.isfinite(geom).all(1)
110
+ z_uniq, z_ix = np.unique(geom[valid, 1], return_inverse=True)
111
+ for i in z_ix:
112
+ x_uniq = np.unique(geom[valid][z_ix == i, 0])
113
+ if x_uniq.size > 1:
114
+ break
115
+ else:
116
+ x_uniq = np.unique(geom[valid, 0])
117
+ inter_chan_x = 1
118
+ if x_uniq.size > 1:
119
+ inter_chan_x = x_uniq[1] - x_uniq[0]
120
+ inter_chan_z = z_uniq[1] - z_uniq[0]
121
+ max_abs_amp = max_abs_amp or np.nanmax(np.abs(waveforms))
122
+ geom_scales = [
123
+ T / inter_chan_x / x_extension,
124
+ max_abs_amp / inter_chan_z / z_extension,
125
+ ]
126
+ geom_plot = geom[valid] * geom_scales
127
+ t_domain = np.linspace(-T // 2, T // 2, num=T)
128
+
129
+ # -- and, plot
130
+ draw = []
131
+ draw_colors = []
132
+ unique_chans = set()
133
+ xmin, xmax = np.inf, -np.inf
134
+ if linestyles is not None:
135
+ ls = []
136
+ plot_kwargs["linestyles"] = ls
137
+ if linewidths is not None:
138
+ lw = []
139
+ plot_kwargs["linewidths"] = lw
140
+ for j, (wf, chans) in enumerate(zip(waveforms, channels)):
141
+ for i, cc in enumerate(chans):
142
+ if cc == n_channels:
143
+ continue
144
+
145
+ draw.append(np.c_[geom_plot[cc, 0] + t_domain, geom_plot[cc, 1] + wf[:, i]])
146
+ xmin = min(geom_plot[cc, 0] + t_domain.min(), xmin)
147
+ xmax = max(geom_plot[cc, 0] + t_domain.max(), xmax)
148
+ unique_chans.add(cc)
149
+ if colors is not None:
150
+ draw_colors.append(to_rgba(colors[j]))
151
+ elif color is not None:
152
+ draw_colors.append(to_rgba(color))
153
+ elif c is not None:
154
+ cj = c[j] if (hasattr(c, "__len__") and len(c) > 1) else c
155
+ draw_colors.append(to_rgba(cj))
156
+ if linestyles is not None:
157
+ ls.append(linestyles[j])
158
+ if linewidths is not None:
159
+ lw.append(linewidths[j])
160
+ dx = xmax - xmin
161
+ xpad = dx / 2 - xlim_factor * dx / 2
162
+ ax.set_xlim([xmin + xpad, xmax - xpad])
163
+
164
+ ann_offset = np.array([0, 0.33 * inter_chan_z]) * geom_scales
165
+ chan_labels = (
166
+ chan_labels if chan_labels is not None else list(map(str, range(len(geom))))
167
+ )
168
+ for c in unique_chans:
169
+ if show_zero_kwargs is None:
170
+ show_zero_kwargs = dict(color="gray", lw=0.8, linestyle="--")
171
+ if show_zero:
172
+ ax.axhline(geom_plot[c, 1], **show_zero_kwargs)
173
+ if show_chan_label:
174
+ ax.annotate(chan_labels[c], geom_plot[c] + ann_offset, size=6, color="gray")
175
+ if show_trough:
176
+ ax.axvline(geom_plot[c, 0] + t_domain[trough_offset], **show_zero_kwargs)
177
+ lines = LineCollection(
178
+ np.array(draw),
179
+ colors=np.array(draw_colors) if draw_colors else None,
180
+ **plot_kwargs,
181
+ )
182
+ lines = ax.add_collection(lines)
183
+ if annotate_z:
184
+ unique_z = np.unique(geom[:, 1][list(unique_chans)])
185
+ unique_zp = np.unique(geom_plot[:, 1][list(unique_chans)])
186
+ for z, zp in zip(unique_z, unique_zp):
187
+ ax.text(
188
+ xmin,
189
+ zp,
190
+ f"{z:f}".rstrip("0").rstrip("."),
191
+ size=6,
192
+ color="gray",
193
+ clip_on=True,
194
+ )
195
+
196
+ if subar:
197
+ if isinstance(subar, bool):
198
+ # auto su if True, but you can pass int/float too.
199
+ subars = (1, 2, 5, 10, 20, 30, 50)
200
+ for j in range(len(subars)):
201
+ if subars[j] > 1.2 * max_abs_amp:
202
+ break
203
+ subar = subars[max(0, j - 1)]
204
+ min_z = min(geom_plot[c, 1] for c in unique_chans)
205
+ if msbar:
206
+ min_z += max_abs_amp
207
+ if bar_background:
208
+ ax.add_patch(
209
+ Rectangle(
210
+ [
211
+ xmax - T // 4 - 2,
212
+ min_z - max_abs_amp / 2 - subar / 10,
213
+ ],
214
+ 4 + 7 + 2 + T // 8,
215
+ subar + subar / 5,
216
+ fc=bar_background,
217
+ zorder=11,
218
+ alpha=0.8,
219
+ )
220
+ )
221
+ ax.add_patch(
222
+ Rectangle(
223
+ [
224
+ xmax - T // 4,
225
+ min_z - max_abs_amp / 2,
226
+ ],
227
+ 4,
228
+ subar,
229
+ fc=bar_color,
230
+ zorder=12,
231
+ )
232
+ )
233
+ ax.text(
234
+ xmax - T // 4 + 5,
235
+ min_z - max_abs_amp / 2 + subar / 2,
236
+ f"{subar} s.u.",
237
+ transform=ax.transData,
238
+ fontsize=5,
239
+ ha="left",
240
+ va="center",
241
+ rotation=-90,
242
+ color=bar_color,
243
+ zorder=12,
244
+ )
245
+
246
+ if msbar:
247
+ min_z = min(geom_plot[c, 1] for c in unique_chans)
248
+ ax.plot(
249
+ [
250
+ geom_plot[:, 0].max() - 30,
251
+ geom_plot[:, 0].max(),
252
+ ],
253
+ 2 * [min_z - max_abs_amp],
254
+ color=bar_color,
255
+ lw=2,
256
+ zorder=890,
257
+ )
258
+ ax.text(
259
+ geom_plot[:, 0].max() - 15,
260
+ min_z - max_abs_amp + max_abs_amp / 10,
261
+ "1ms",
262
+ transform=ax.transData,
263
+ fontsize=5,
264
+ ha="center",
265
+ va="bottom",
266
+ color=bar_color,
267
+ )
268
+
269
+ if zlim is None:
270
+ ax.autoscale_view()
271
+ elif zlim == "auto":
272
+ min_z = min(geom_plot[c, 1] for c in unique_chans)
273
+ max_z = max(geom_plot[c, 1] for c in unique_chans)
274
+ if np.isfinite([min_z, max_z]).all():
275
+ ax.set_ylim([min_z - 2 * max_abs_amp, max_z + 2 * max_abs_amp])
276
+ elif zlim == "tight":
277
+ min_z = min(geom_plot[c, 1] for c in unique_chans)
278
+ max_z = max(geom_plot[c, 1] for c in unique_chans)
279
+ if np.isfinite([min_z, max_z]).all():
280
+ ax.set_ylim([min_z - max_abs_amp, max_z + max_abs_amp])
281
+ elif isinstance(zlim, float):
282
+ min_z = min(geom_plot[c, 1] for c in unique_chans)
283
+ max_z = max(geom_plot[c, 1] for c in unique_chans)
284
+ if np.isfinite([min_z, max_z]).all():
285
+ ax.set_ylim([min_z - max_abs_amp * zlim, max_z + max_abs_amp * zlim])
286
+ elif zlim is False:
287
+ pass
288
+
289
+ if return_chans:
290
+ return lines, unique_chans
291
+
292
+ return lines
293
+
294
+
295
+ def geomplot_templates(
296
+ axis,
297
+ unit_ids,
298
+ unit_templates,
299
+ channel_index,
300
+ registered_geom,
301
+ title="",
302
+ main_channel=None,
303
+ linestyles=None,
304
+ legend_loc="best",
305
+ color_reroll_seed=None,
306
+ color_flat=False,
307
+ ):
308
+ unit_ids = np.asarray(unit_ids)
309
+ carr = np.asarray(glasbey1024)
310
+ if color_reroll_seed is not None:
311
+ rg = np.random.default_rng(color_reroll_seed)
312
+ carr = carr[rg.permutation(len(carr))]
313
+ if color_flat:
314
+ colors = carr[np.arange(len(unit_ids))]
315
+ else:
316
+ colors = carr[unit_ids % len(glasbey1024)]
317
+ if main_channel is None:
318
+ chan = np.ptp(unit_templates[0], 0).argmax()
319
+ else:
320
+ chan = main_channel
321
+ channels = channel_index[chan]
322
+ unit_templates = np.pad(
323
+ unit_templates,
324
+ [(0, 0), (0, 0), (0, 1)],
325
+ constant_values=np.nan,
326
+ )
327
+ unit_templates = unit_templates[:, :, channels]
328
+ maxamp = np.nanmax(np.abs(unit_templates))
329
+
330
+ if linestyles is None:
331
+ linestyles = '-' * len(unit_ids)
332
+
333
+ labels = []
334
+ handles = []
335
+ for uid, color, template, ls in reversed(list(zip(unit_ids, colors, unit_templates, linestyles))):
336
+ lines = geomplot(
337
+ template[None],
338
+ max_channels=[chan],
339
+ channel_index=channel_index,
340
+ geom=registered_geom,
341
+ ax=axis,
342
+ show_zero=False,
343
+ max_abs_amp=maxamp,
344
+ subar=True,
345
+ bar_color="k",
346
+ bar_background="w",
347
+ zlim="tight",
348
+ color=color,
349
+ linestyle=ls,
350
+ )
351
+ labels.append(str(uid))
352
+ handles.append(lines)
353
+ axis.legend(handles=handles, labels=labels, fancybox=False, loc=legend_loc)
354
+ axis.set_xticks([])
355
+ axis.set_yticks([])
356
+ if title:
357
+ axis.set_title(title)
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: DARTsort
3
+ Version: 0.3.5
4
+ Summary: DARTsort
5
+ Author-email: Charlie Windolf <ciw2107@columbia.edu>
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: cupy
14
+ Requires-Dist: h5py
15
+ Requires-Dist: linear_operator
16
+ Requires-Dist: numba
17
+ Requires-Dist: numpy>=1.20; python_version < "3.13"
18
+ Requires-Dist: numpy>=2.0.0; python_version >= "3.13"
19
+ Requires-Dist: opt-einsum
20
+ Requires-Dist: pandas
21
+ Requires-Dist: packaging
22
+ Requires-Dist: probeinterface
23
+ Requires-Dist: pydantic
24
+ Requires-Dist: scipy>=1.13
25
+ Requires-Dist: scikit-learn
26
+ Requires-Dist: spikeinterface>=0.101.2
27
+ Requires-Dist: torch>=2.0
28
+ Requires-Dist: tqdm
29
+ Provides-Extra: vis
30
+ Requires-Dist: matplotlib; extra == "vis"
31
+ Requires-Dist: seaborn; extra == "vis"
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: pytest-cov; extra == "dev"
35
+ Provides-Extra: full
36
+ Requires-Dist: matplotlib; extra == "full"
37
+ Requires-Dist: seaborn; extra == "full"
38
+ Requires-Dist: pytest; extra == "full"
39
+ Requires-Dist: pytest-cov; extra == "full"
40
+ Requires-Dist: ipywidgets; extra == "full"
41
+ Requires-Dist: ipykernel; extra == "full"
42
+ Requires-Dist: black; extra == "full"
43
+
44
+ [![badge](https://github.com/cwindolf/dartsort/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cwindolf/dartsort/actions/)
45
+ [![coveralls](https://coveralls.io/repos/github/cwindolf/dartsort/badge.svg?branch=main)](https://coveralls.io/github/cwindolf/dartsort)
46
+
47
+ # dartsort
48
+
49
+ ## :warning: Work in progress code repository
50
+
51
+ We do not currently recommend DARTsort for production spike sorting purposes. We are in the process of implementing a robust and documented pipeline in [`src/dartsort`](src/dartsort), and we will update this page accordingly.
52
+
53
+ A workflow described in our preprint (https://www.biorxiv.org/content/10.1101/2023.08.11.553023v1) is in [uhd_pipeline.py](scripts/uhd_pipeline.py), which is implemented using the legacy code in [`src/spike_psvae`](src/spike_psvae).
54
+
55
+
56
+ ## Suggested install steps
57
+
58
+ If you don't already have Python and PyTorch 2 installed, we recommend doing this with the Miniforge distribution of `conda`. You can find info and installers for your platform [at Miniforge's GitHub repository](https://github.com/conda-forge/miniforge). After installing Miniforge, `conda` will be available on your computer for installing Python packages, as well as the newer and faster conda replacement tool `mamba`. We recommend using `mamba` instead of `conda` below, since the installation tends to be a lot faster with `mamba`.
59
+
60
+ To install DARTsort, first clone this GitHub repository.
61
+
62
+ After cloning the repository, create and activate the `mamba`/`conda` environment from the configuration file provided as follows:
63
+
64
+ ```bash
65
+ $ mamba env create -f environment.yml
66
+ $ mamba activate dartsort
67
+ ```
68
+
69
+ Next, visit https://pytorch.org/get-started/locally/ and follow the `PyTorch` install instructions for your specific OS and hardware needs.
70
+ We also need to install `linear_operator` from the `gpytorch` channel.
71
+ For example, on a Linux workstation or cluster with NVIDIA GPUs available, one might use (dropping in `mamba` for `conda` commands):
72
+
73
+ ```bash
74
+ # Example -- see https://pytorch.org/get-started/locally/ to find your platform's command.
75
+ (dartsort) $ mamba install pytorch torchvision torchaudio pytorch-cuda=11.8 linear_operator -c pytorch -c nvidia -c gpytorch
76
+ ```
77
+
78
+ Finally, install the remaining `pip` dependencies and `dartsort` itself:
79
+
80
+ ```bash
81
+ (dartsort) $ pip install -r requirements-full.txt
82
+ (dartsort) $ pip install -e .
83
+ ```
84
+
85
+ To enable DARTsort's default motion correction algorithm [DREDge](https://www.biorxiv.org/content/10.1101/2023.10.24.563768), clone [its GitHub repository](https://github.com/evarol/dredge), and then `cd dredge/` and install the DREDge package with `pip install -e .`.
86
+
87
+ Soon we will have a package on PyPI so that these last steps will be just a `pip install dartsort`.
88
+
89
+ To make sure everything is working:
90
+
91
+ ```bash
92
+ $ (dartsort) pytest tests/*
93
+ ```
@@ -0,0 +1,125 @@
1
+ dartsort/__init__.py,sha256=YX92dyjRtWw1Ij1UDrUONwsAmpuB9oGYhSFOuh3ToE4,1689
2
+ dartsort/cli.py,sha256=s9lhxid6O9lkrH6q_YHqWmyGNU2P5JeQK-Ezwb2AyEo,3328
3
+ dartsort/config.py,sha256=nsEul1fqCBp7zg6tPiV3Ke7i9JhEyUu77eF5-dPLIv4,11206
4
+ dartsort/main.py,sha256=kIAwH5-opusITxGEDPNJBH1H3Nowo5nl3UdcJiaJ_u8,22867
5
+ dartsort/clustering/__init__.py,sha256=kAeBigizIDS9_Sc8ctDzIzOUMjA8z2I6A-kdLb3zias,250
6
+ dartsort/clustering/cluster_util.py,sha256=rWBq25zRF--yY8VcpXRPmZqaDpt_pkB9ILWUNhAYpr0,12980
7
+ dartsort/clustering/clustering.py,sha256=eI8jbuCttppjHZkM0xyqaJo3uM4NZkN5EQv96SdmAlA,25308
8
+ dartsort/clustering/clustering_features.py,sha256=eQA-HY6EeL7iVd_Zcn9fcbsxwD6fGUQDFslAt5cY4_s,6806
9
+ dartsort/clustering/density.py,sha256=sA-bfaXQmZ_XaKLm2imY8gV9yoE72BuksglOjIS8vPA,43039
10
+ dartsort/clustering/forward_backward.py,sha256=oDocF8sx8y6xZ5p_JNJ7NYXIRR-FJUGL4wGMT4Y7dlE,8609
11
+ dartsort/clustering/kmeans.py,sha256=ucOlwdS_Xbr7l8WVxbNZrX8V43J_6VkGByR8bt1mEkI,14204
12
+ dartsort/clustering/merge.py,sha256=v06GfJt3N-jJKPHYmaRglOzq51Kc1t55WW570ujLsAM,17774
13
+ dartsort/clustering/modes.py,sha256=RP8CrO_ZQEp--gp4_M7VvObOzw9Z9OG5j6O7Jy2X-Uc,7396
14
+ dartsort/clustering/refine_util.py,sha256=RI-NgyvmV_wzrxVznSd6abcAUjgkO8Hm2PTgcZ80kfM,6625
15
+ dartsort/clustering/relocate.py,sha256=uw0M82VyJcNF-AIhx2lfeVMd3YHG5AAEaX-34QD8v0w,3407
16
+ dartsort/clustering/split.py,sha256=U-h1QxSpvooMhe-q9Wu10lyQ9wOqw0RvsY2VMfjO7DQ,50767
17
+ dartsort/clustering/gmm/mixture.py,sha256=MF4a9dvrrV5gdAdbZNzjOH2WuCw5g91SVzhZZWmm-14,210561
18
+ dartsort/clustering/gmm/stable_features.py,sha256=Iu53H5av342pmC3df1vSXY8cvKnQXpYgE8BzPQR7-2I,38123
19
+ dartsort/detect/__init__.py,sha256=gVobIkjrOxISrCCUIxZw0nZ2rpX_NwwruguW0d35IOU,132
20
+ dartsort/detect/detect.py,sha256=bEY7grhtBVihQcXvaPx9nqmekhE2l0EgMoYjCVVYdlA,14933
21
+ dartsort/detect/detect_filters.py,sha256=oHQDmCUqtkYsvePt0sAbDVQJOS5295ORBA6TozS6zGc,1143
22
+ dartsort/evaluate/__init__.py,sha256=tOfT8u3YqWghkKlpbrvCqPH9yX633Sg7ZhrysXAEQEY,37
23
+ dartsort/evaluate/analysis.py,sha256=h8VwOIU0aSoOiBKa0E8q-Q5xJdU2BpgkE87lHnHUIco,21778
24
+ dartsort/evaluate/comparison.py,sha256=MMoSRySr0zmnswbw1GzsG6H2q-cooXOjzXDBXvsCqZY,20268
25
+ dartsort/evaluate/hybrid_util.py,sha256=mEHOZTagRP20gpDrSv113XoHDB6TDuY_RAYiEbAAHkI,19713
26
+ dartsort/evaluate/noise_recording_tools.py,sha256=B94uAANguyDh-4xZOAFr9xbiX7irrU2MQR6_aDPLmlg,6588
27
+ dartsort/evaluate/sim_template_tools.py,sha256=-R6qA8rOkY5XB6mbcNjxWOC_4UNVzZqxU_jBUq9kSe4,28400
28
+ dartsort/evaluate/simkit.py,sha256=8FuwsdxIKx-ol8XR_7QVK7BiLFDAJFr_IDcT065FiQY,31716
29
+ dartsort/evaluate/simlib.py,sha256=q2d1Cn4oKU872FTkb-Tg9Qrk42r6z32Tw2_fiJdb9ig,8894
30
+ dartsort/localize/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ dartsort/localize/localize_torch.py,sha256=sFFoq7kfuwneBDK_1jIbK-oCfWijmcSjfmxeFojRBM8,10588
32
+ dartsort/localize/localize_util.py,sha256=THpFFSn4veNXQ3iH9ZRnLhAc_KPuNhNX5Q2-fZ-ioLc,9602
33
+ dartsort/peel/__init__.py,sha256=0ABV1LjM7m9oLku-ProBagWu9OtIhfuGd3xQWkRcW54,281
34
+ dartsort/peel/grab.py,sha256=i-z-Hv_XMHsdcxrWYKg9tVMvc1R9GpG8qDwcMWHo6KI,7054
35
+ dartsort/peel/matching.py,sha256=RLqbZ5WPBUC_MKkkGhX6DgRpgcwTJmXzPPSmF5nHiSs,24441
36
+ dartsort/peel/peel_base.py,sha256=cV4kvofZAKun1joI5Kb9Yr_UsAVZ6xqeWFZy1Uv-Faw,37889
37
+ dartsort/peel/running_template.py,sha256=D5vaUJ0fwGsi4u8N0JOOVdYmRIj4gRxHXTXs7BQ0tlw,53441
38
+ dartsort/peel/subtract.py,sha256=Jgmi5xoO2ofM9HAVkPk6TmxSMUvSkVAVy_-msFwPC4k,44445
39
+ dartsort/peel/threshold.py,sha256=YPUrBoQzzlwJRDz2sO-BrjfoCRqPqbI-BC1lq5Q_cXQ,17214
40
+ dartsort/peel/universal.py,sha256=UjVpsHYIAEF_HK7Uem4DLpZnWZm1kjQ9-C1Ddg8Xgu4,7866
41
+ dartsort/peel/matching_util/__init__.py,sha256=_8HjNRDgEEqMra43JFw-k_fRtfjwJXSRjzwCZoQ0wB8,87
42
+ dartsort/peel/matching_util/compressed_upsampled.py,sha256=ZulnsizaBp1q05M8lfuTaNQYvhAGEwaGRlWmlMOdNig,28898
43
+ dartsort/peel/matching_util/drifty.py,sha256=UEQEOmDcj_OEc4U4--OLjpmI5Pr7lzk0u1UXWZL7i9c,28271
44
+ dartsort/peel/matching_util/matching_base.py,sha256=upeoS8gkR630-CvzFDH_KirI_gJTey4EewjiF5VlLAI,19224
45
+ dartsort/peel/matching_util/pairwise.py,sha256=ou0bJIRKcW6l3Ywpwack6RXMk0x3MyBGlZp43Gr-sFQ,14115
46
+ dartsort/peel/matching_util/pairwise_util.py,sha256=mlKx_UGNNB2F99gkyXa7YtUAai96EeLhw_UwdBQEGJc,47677
47
+ dartsort/pretrained/default_temporal_kernel.npy,sha256=ofu2YIyXzkG8P3X0DqVDUhUSURuvBVUFjgaNRtgoKDU,380
48
+ dartsort/pretrained/detect_np1.pt,sha256=2D3wMm0jOgFleqdnbM_ODhLm85O5mDthERG2poCuqSo,10125
49
+ dartsort/pretrained/detect_np2.pt,sha256=eK2iGc4GP-VMB_htI14vJuzw_XxCH1JipPXTi807ADI,10253
50
+ dartsort/pretrained/glasbey1024.npz,sha256=MY3mfqOulwn7JcCMh72W7GeHkjbb09z0QwTSeH8HF5E,7117
51
+ dartsort/pretrained/offset_trained_denoiser.pt,sha256=oCPRpeTaiH5RtzUWxHBXiYWSMRs-oVAA7Id-KGVVv1k,422807
52
+ dartsort/pretrained/offset_trained_denoiser_added_temp.pt,sha256=dnU0H3ySGf-ME2ox7-kl_g5AU0PH1O190j0addYGCT0,422807
53
+ dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt,sha256=esUDfRv_iN3rzsyaEHNz5nPjjxCSAyV2cAHK6aAmLEY,422807
54
+ dartsort/pretrained/original_single_chan_denoiser.pt,sha256=299yPKVMgS183UMYB8uSOQ_3IHTK50gnHAS34fWlWGk,425063
55
+ dartsort/pretrained/single_chan_denoiser.pt,sha256=esUDfRv_iN3rzsyaEHNz5nPjjxCSAyV2cAHK6aAmLEY,422807
56
+ dartsort/templates/__init__.py,sha256=nQCw-Yv_jffxPSceL6IT2IfVvFZyxGPP68kljL_7iN8,404
57
+ dartsort/templates/get_templates.py,sha256=gjMfSqVgisgTHAdFKJxMob7TWuLaPCFNm430Ui-ms28,25728
58
+ dartsort/templates/postprocess_util.py,sha256=DBN2ngw3e8EqqpG9FpH_s5CvtPym4PypQIqfrdHUZ9A,19702
59
+ dartsort/templates/realignment.py,sha256=Dc3SrOQ2hJiXQVCBjRUQwmMm6o_ylyMmNWk3CWic3G0,15743
60
+ dartsort/templates/superres_util.py,sha256=2elGbzNNydW2evyrZ2oyBtk3FTJbP4aEjDWQuQumKz8,6842
61
+ dartsort/templates/template_util.py,sha256=oo2XRX9i6ws_eybfxUlxno9LCNOzoUl9iJKCdFUIN50,19051
62
+ dartsort/templates/templates.py,sha256=xiqpsAZspW4plyYhpWe_I1YU44Iz-33Xz3Dgtavx0dQ,18434
63
+ dartsort/transform/__init__.py,sha256=Iz-ZSisELqlyv3mEM-cp2o60OxCVORv0KbsIPiQ5kSU,71
64
+ dartsort/transform/_multichan_denoiser_kit.py,sha256=cY4v7ERYk5IJrlJ2ajEHinJ4vRwTeqnRlmFs1S088wA,19791
65
+ dartsort/transform/all_transformers.py,sha256=SGriOBMISjvXHTNgNJ66Q4Z1anwsX23lCnlQ2Xnujks,1612
66
+ dartsort/transform/amortized_localization.py,sha256=2I_iFGcFdq_Ps5BMc7Fvl_jE2Ft90ZcTEbffFho3zWw,20117
67
+ dartsort/transform/amplitudes.py,sha256=xN1yg7uIKDooCj_95N9YMhj5aZO-0mE4hSZHcfxdUpg,6664
68
+ dartsort/transform/decollider.py,sha256=8S6x_-2DvsMTvHeGlYPo5czyH63wodSWXM9fObh9vys,23607
69
+ dartsort/transform/enforce_decrease.py,sha256=z5A9yYMSpvcUKOXzp9_QtEgFzsU4hCA8sGdRDfvoTOE,5862
70
+ dartsort/transform/localize.py,sha256=Fr5mraWJ68IAzoDnB6P9I53IDOREiS1nnWoqd_0qYDY,2798
71
+ dartsort/transform/matching_denoiser.py,sha256=fNREFUx578Rm_XcUuarXitc6Zy-VcEHTx06lQt2hqoE,1793
72
+ dartsort/transform/pipeline.py,sha256=Xh7d5cKD-hXM5zVqA9NQvnRaVG44Rm9o6SCyD72zmFU,14108
73
+ dartsort/transform/single_channel_denoiser.py,sha256=pknEM8Gwi81twHtD5aVImDOPcgth02MVwIM4tIF2-jQ,4735
74
+ dartsort/transform/single_channel_templates.py,sha256=tNH91SUB8IDs_-zvf1vn3BJJ45GIUUI8BlAFR0oTYpY,3636
75
+ dartsort/transform/supervised_denoiser.py,sha256=MFJaGtEvglsre2i6zFPQUWb2VYnp8HKaBHj5rlsYBUQ,19048
76
+ dartsort/transform/temporal_pca.py,sha256=9FNqCGYmHYLu3m70Qo1UDQNIqRPNbOpnspkbCY-Fx-8,14599
77
+ dartsort/transform/transform_base.py,sha256=iKEKY6NxHG7Gjeq2ZrYyxNj_4_9Cnfuc6yD6xHemtfs,7961
78
+ dartsort/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
+ dartsort/util/cli_util.py,sha256=L5OyiutwMSwo-qFKZeziQgTbkXDTeMt2E00GBKyt7PU,5745
80
+ dartsort/util/data_util.py,sha256=VxYoBI25d6VOingdjnQzCDh90VNJFqxgVjA04g7sETw,41294
81
+ dartsort/util/drift_util.py,sha256=xdLI4MQ2jQGET9thwmz0uwh_E_MCE7-5CdEMyT_PCko,37442
82
+ dartsort/util/internal_config.py,sha256=F5nZkDhvtmDMQZ1T9CgzSRvngmLgiQXE9oNkZitM6n0,38672
83
+ dartsort/util/interpolation_util.py,sha256=Az0wj8MLhIm9m66KZ4wbdQ9_URH8dpXtAJVNWp47KHg,34870
84
+ dartsort/util/job_util.py,sha256=8UdFmgbsm2l_1LML66cgKokPPrV4hLSOiDCHOCH-YNE,551
85
+ dartsort/util/logging_util.py,sha256=xN42UeH8FNDEGaXm0ttsl_-24nXvxgwmbBpXdu8CF6E,2539
86
+ dartsort/util/main_util.py,sha256=LX1991r5g2O5mB9HAa72vJatTLCHMUqrmiYtkhvsrN8,8274
87
+ dartsort/util/more_operators.py,sha256=A1y5JyLqgn8VedPh6Dq35NHvMdCWdDZes6rnCrPzDNo,9609
88
+ dartsort/util/multiprocessing_util.py,sha256=fN34C-xwltm080OJGOgU646iAsX-B6B9xw90hxiMkXg,5834
89
+ dartsort/util/nn_util.py,sha256=zulJrLzASm7XBgerQ0FNkVKpzrS5L41_SpRz-y5NiTM,14118
90
+ dartsort/util/noise_util.py,sha256=ZC9swbl_pXRR8kGiwuwBQ-2qMQfgN1phzmf3Yptf7EM,56081
91
+ dartsort/util/peel_util.py,sha256=oHLgAb5Vc1GWmHZkAbRRXenLwHafvKcSFrdpjgP8k4Q,6968
92
+ dartsort/util/py_util.py,sha256=mNVbTJV5FZ7Bc2s_37Jmg8IgYCuqbdfH4zFy_NrN5YE,5759
93
+ dartsort/util/registration_util.py,sha256=FXM3UsuJqKrrIBKYX84RZa__2SgVsUAoB2QbQ1zNWcg,3834
94
+ dartsort/util/residual_util.py,sha256=pH6gLN0g8KhdQftr6tiQRvhP8JdHbmbGGWVzrh1hUNk,1056
95
+ dartsort/util/sparse_util.py,sha256=Bx86kz-oOCbuHmc-Y7nDLbvgMudWAl8YSWwEd19_I-o,2269
96
+ dartsort/util/spikeio.py,sha256=JTPNIdVps0W13862aSZAPEt0kDpSvpGA6VPnhX3Xayg,7226
97
+ dartsort/util/spiketorch.py,sha256=FdaPCR4S3oGN2H8nIj_S9p5ANE4Mwoqa9JRXhlIwkx4,35608
98
+ dartsort/util/torch_optimization_util.py,sha256=rEcYU5pgCbWElVitJHMaF2oF_vK_xz0EsPCe84jvXa0,5396
99
+ dartsort/util/torch_util.py,sha256=Y07fh8EFToG0BV0y0qe_akuu1ZFWY_g_RhdleiU4sP0,2262
100
+ dartsort/util/universal_util.py,sha256=f9Gayib81ZN9Kp0A3odxa6hX5hF_sD6a8bEX_8Ejw-k,8797
101
+ dartsort/util/waveform_util.py,sha256=8n3w-q7vQyk0WuBozjX9HmDRmP4vAbzqzl5yT6t50mg,26766
102
+ dartsort/util/testing_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
+ dartsort/util/testing_util/matching_debug_util.py,sha256=9dbPKZDox9wQHjrswkyAXn-PorXsYLKkbE_esyzDNlI,18048
104
+ dartsort/util/testing_util/mixture_testing_util.py,sha256=Q68_XK25HxDxYpjaWH7OZPrSfPttgQH01d7Sh6Va56c,9264
105
+ dartsort/vis/__init__.py,sha256=iTGP0Li6pt9-8qydmKgCKU0oKIaTkeKPbUi7GA93BaI,487
106
+ dartsort/vis/analysis_plots.py,sha256=yXbJIDT4T-vjHjumoLDUz8TeI7571Hlpw_nLj0VrDj8,11976
107
+ dartsort/vis/colors.py,sha256=BNZ7WcKYqpepz1rAPoC97JG3HXgzqnbJheHCFy5NuWQ,988
108
+ dartsort/vis/gt.py,sha256=DmJNWhCMf5FX-dBRb52UqwjG8mvjAIb-bLQ4T9pxAuE,12236
109
+ dartsort/vis/layout.py,sha256=1_EXeGBzdtYwSIyGt6UyB_evRBO8deqiwhJpMyy2HGw,4800
110
+ dartsort/vis/metrics_util.py,sha256=uasBbHyguZuWIl-_oLPFLxbDWbrVtQtkQSn6nG-5n0E,700
111
+ dartsort/vis/mixture.py,sha256=fnvwDdjMwM8LJYOM70wdfcfwg5b76HVWKiM6sh31N8c,49732
112
+ dartsort/vis/over_time.py,sha256=LHteYiflOWy1VOQ8qJkIHwRTUkYSh8y1DrrRhCQUeUA,16257
113
+ dartsort/vis/recanim.py,sha256=V6E9M34A25wxczHHT6z4POT7fJoGmD2Kdq6dZP22zhs,14434
114
+ dartsort/vis/scatterplots.py,sha256=-0bNguyqzM8lTo496L4Y-5SG9mygyHZrOQppftTICc8,24436
115
+ dartsort/vis/sorting.py,sha256=kEqqIMUkOsksGlYNzunugjL4Gs1aUCKRDEb2e-vdoG0,4490
116
+ dartsort/vis/unit.py,sha256=A8pm3mycE3TtpLZLjrrS1HtkxpwdeQwuPZVNsPQW5Z8,28129
117
+ dartsort/vis/unit_comparison.py,sha256=tJ5KXC-w3U8IIARKpSTVvWiDxosbwd2ewbRpKsywoUc,35699
118
+ dartsort/vis/versus.py,sha256=DU_JpPag19uM3vTsyPRVXhIHSrmIxft4P1ZBi5jUvPk,10120
119
+ dartsort/vis/vismain.py,sha256=g3rDtRv55JzSHEwRJgGANHtlAvlaYcMSUmqMyR1POHY,18027
120
+ dartsort/vis/waveforms.py,sha256=0X5LLikAf2u8yi2uSdIjC4vkgO74ZjImf9qxHEDohDc,11358
121
+ dartsort-0.3.5.dist-info/METADATA,sha256=0eua52JWcuJ47BKv2KMXRaK1k_1JaCkGDsckZcucTos,4263
122
+ dartsort-0.3.5.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
123
+ dartsort-0.3.5.dist-info/entry_points.txt,sha256=JtQMccq1-GIVSQ_wBqXt54fd7SO4EEHb3BZLxt0-snA,55
124
+ dartsort-0.3.5.dist-info/top_level.txt,sha256=357pmwl-ljvdYIW51fPg0lKWxc2DWfx7qNKhIt60eUU,9
125
+ dartsort-0.3.5.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ dartsort = dartsort.cli:dartsort_cli
@@ -0,0 +1 @@
1
+ dartsort