DARTsort 0.4.0__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.
- {dartsort-0.4.0 → dartsort-0.5.2}/.github/workflows/ci.yml +6 -6
- {dartsort-0.4.0 → dartsort-0.5.2}/.github/workflows/ci_windows.yml +6 -5
- dartsort-0.5.2/PKG-INFO +206 -0
- dartsort-0.5.2/README.md +167 -0
- dartsort-0.5.2/environment.yml +24 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/pyproject.toml +16 -7
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/__init__.py +12 -4
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/cli.py +7 -4
- dartsort-0.5.2/src/dartsort/clustering/__init__.py +2 -0
- dartsort-0.5.2/src/dartsort/clustering/agglomerate.py +627 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/clustering/cluster_util.py +167 -25
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/clustering/clustering.py +170 -51
- dartsort-0.5.2/src/dartsort/clustering/clustering_features.py +308 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/clustering/density.py +14 -27
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/clustering/forward_backward.py +2 -7
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/clustering/kmeans.py +8 -17
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/clustering/merge.py +23 -105
- {dartsort-0.4.0/src/dartsort/clustering/gmm → dartsort-0.5.2/src/dartsort/clustering}/mixture.py +657 -338
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/clustering/modes.py +8 -10
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/clustering/refine_util.py +31 -30
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/config.py +121 -41
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/detect/detect.py +1 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/detect/detect_filters.py +0 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/evaluate/analysis.py +119 -39
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/evaluate/comparison.py +97 -14
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/evaluate/hybrid_util.py +64 -18
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/evaluate/noise_recording_tools.py +14 -11
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/evaluate/sim_template_tools.py +3 -5
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/evaluate/simkit.py +31 -24
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/evaluate/simlib.py +9 -8
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/localize/localize_util.py +8 -8
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/main.py +209 -103
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/__init__.py +2 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/grab.py +13 -15
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/matching.py +34 -32
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/matching_util/compressed_upsampled.py +3 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/matching_util/drifty.py +135 -103
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/matching_util/matching_base.py +5 -4
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/matching_util/pairwise.py +6 -6
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/matching_util/pairwise_util.py +13 -13
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/peel_base.py +404 -152
- dartsort-0.5.2/src/dartsort/peel/peel_lib.py +929 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/reduction_template.py +83 -17
- dartsort-0.5.2/src/dartsort/peel/shaver.py +170 -0
- dartsort-0.5.2/src/dartsort/peel/subtract.py +484 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/threshold.py +29 -227
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/templates/get_templates.py +12 -47
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/templates/postprocess_util.py +55 -32
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/templates/realignment.py +9 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/templates/template_util.py +26 -6
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/templates/templates.py +12 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/templates/templib.py +15 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/_multichan_denoiser_kit.py +145 -77
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/all_transformers.py +24 -17
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/amortized_localization.py +86 -94
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/amplitudes.py +16 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/decollider.py +257 -168
- dartsort-0.5.2/src/dartsort/transform/denoising_scorer.py +33 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/enforce_decrease.py +2 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/fixed_prop.py +2 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/interp.py +17 -8
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/localize.py +3 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/matching_denoiser.py +18 -3
- dartsort-0.5.2/src/dartsort/transform/mixture_classifier.py +448 -0
- dartsort-0.5.2/src/dartsort/transform/pipeline.py +652 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/reduction.py +15 -17
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/single_channel_denoiser.py +3 -2
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/supervised_denoiser.py +9 -8
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/temporal_pca.py +98 -37
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/transform_base.py +116 -47
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/whiten.py +5 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/cli_util.py +10 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/data_util.py +385 -124
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/drift_util.py +1 -2
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/internal_config.py +629 -441
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/interpolation_util.py +75 -259
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/job_util.py +1 -1
- dartsort-0.5.2/src/dartsort/util/logging_util.py +250 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/main_util.py +127 -5
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/more_operators.py +13 -12
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/motion.py +153 -12
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/multiprocessing_util.py +21 -14
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/nn_util.py +5 -4
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/noise_util.py +159 -73
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/peel_util.py +75 -98
- dartsort-0.5.2/src/dartsort/util/preprocess_util.py +90 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/py_util.py +39 -19
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/registration_util.py +5 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/sparse_util.py +5 -9
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/spiketorch.py +347 -100
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/testing_util/matching_debug_util.py +16 -10
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/testing_util/mixture_testing_util.py +9 -22
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/torch_util.py +45 -4
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/waveform_util.py +17 -9
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/analysis_plots.py +38 -6
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/colors.py +1 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/gt.py +15 -9
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/layout.py +2 -2
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/mixture.py +240 -44
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/recanim.py +13 -7
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/scatterplots.py +28 -13
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/sorting.py +3 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/unit.py +321 -126
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/unit_comparison.py +31 -18
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/versus.py +28 -17
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/vismain.py +113 -22
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/waveforms.py +82 -20
- dartsort-0.5.2/src/dartsort.egg-info/PKG-INFO +206 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort.egg-info/SOURCES.txt +8 -3
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort.egg-info/requires.txt +5 -14
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_alignment.py +109 -106
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_clustering.py +42 -23
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_config.py +1 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_dartsort.py +20 -12
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_data_util.py +1 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_detect.py +5 -4
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_drift_util.py +6 -7
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_drifty_matching.py +3 -5
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_grab_and_featurize.py +26 -11
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_kmeans.py +1 -1
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_linalg.py +2 -2
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_localize_torch.py +10 -9
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_matching.py +81 -64
- dartsort-0.5.2/tests/test_mixture_classifier.py +65 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_modeling.py +12 -10
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_simkit.py +15 -8
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_subtract.py +115 -83
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_templates.py +14 -17
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_transform.py +55 -22
- dartsort-0.4.0/PKG-INFO +0 -97
- dartsort-0.4.0/README.md +0 -51
- dartsort-0.4.0/environment.yml +0 -18
- dartsort-0.4.0/src/dartsort/clustering/__init__.py +0 -3
- dartsort-0.4.0/src/dartsort/clustering/clustering_features.py +0 -202
- dartsort-0.4.0/src/dartsort/clustering/gmm/stable_features.py +0 -695
- dartsort-0.4.0/src/dartsort/peel/subtract.py +0 -980
- dartsort-0.4.0/src/dartsort/templates/superres_util.py +0 -202
- dartsort-0.4.0/src/dartsort/transform/pipeline.py +0 -394
- dartsort-0.4.0/src/dartsort/util/logging_util.py +0 -91
- dartsort-0.4.0/src/dartsort.egg-info/PKG-INFO +0 -97
- {dartsort-0.4.0 → dartsort-0.5.2}/.github/workflows/deploy.yml +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/.gitignore +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/.keep +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/basic_integration_test.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/ci diag.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/dartsort_dredge_demo.ipynb +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/dartsort_dredge_demo.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/data test.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/dead reckoning.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/denoise np1.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/denoise np2.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/exploratory.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/geom debug.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/hdbscan_clustering_5min.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/hybrid 10.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/hybrid cluster.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/hybrid_11.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/initial training.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/make hybrid.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/mgh.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/np1 feats.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/np2 processing version c.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/paperfigs.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/pdists.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/postcheck.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/ptp vae.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/re clust.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/reg fig loop.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/reg_sim_exp.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/relocating.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/relocating_all.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/restats +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/sortStinger1.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/sortStinger3.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/sortStinger4.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/sortStinger5.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/sortStinger6.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/spike farm.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/ss_ensemble_sim.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/ss_ensemble_sim_drift.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/ss_sim.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/stan diagnostics.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/storytelling c.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/storytelling.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/subtract_with_phaseshift_denoiser.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/debug_matching.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/test_agreement.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/test_amplitude_scaling.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/test_batch_optim.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/test_ibme.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/test_mm_initialization.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/test_normxcorr1d.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/test_reassignment.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/tests/test_relocation.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/notebook/thomas.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/setup.cfg +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/detect/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/evaluate/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/localize/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/localize/localize_torch.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/peel/matching_util/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/detect_np1.pt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/detect_np2.pt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/glasbey1024.npz +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/templates/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/transform/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/residual_util.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/spikeio.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/testing_util/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/util/torch_optimization_util.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/__init__.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort/vis/metrics_util.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort.egg-info/dependency_links.txt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort.egg-info/entry_points.txt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/src/dartsort.egg-info/top_level.txt +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/conftest.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_enforce_decrease.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_spiketorch.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_threshold.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_torch_optimization_util.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_util.py +0 -0
- {dartsort-0.4.0 → dartsort-0.5.2}/tests/test_waveform_util.py +0 -0
|
@@ -11,7 +11,6 @@ on:
|
|
|
11
11
|
workflow_dispatch:
|
|
12
12
|
|
|
13
13
|
jobs:
|
|
14
|
-
|
|
15
14
|
tests:
|
|
16
15
|
runs-on: "ubuntu-latest"
|
|
17
16
|
defaults:
|
|
@@ -23,20 +22,21 @@ jobs:
|
|
|
23
22
|
uses: actions/checkout@v4
|
|
24
23
|
with:
|
|
25
24
|
path: dartsort
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
- name: Fetch tags and describe
|
|
28
27
|
run: pushd dartsort/ && git fetch --prune --unshallow --tags && git describe && popd
|
|
29
28
|
|
|
30
29
|
- uses: actions/setup-python@v5
|
|
31
30
|
with:
|
|
32
|
-
python-version:
|
|
33
|
-
cache:
|
|
34
|
-
|
|
31
|
+
python-version: "3.x"
|
|
32
|
+
cache: "pip" # caching pip dependencies
|
|
33
|
+
|
|
35
34
|
- name: Install dependencies
|
|
36
35
|
run: |
|
|
37
36
|
python -m pip install -U pip # seems necessary to make sure pip is my pip
|
|
38
37
|
pip install --extra-index-url https://download.pytorch.org/whl/cpu torch
|
|
39
|
-
pip install
|
|
38
|
+
pip install git+https://github.com/SpikeInterface/spikeinterface.git
|
|
39
|
+
pip install -e dartsort/[full,test]
|
|
40
40
|
|
|
41
41
|
- name: pytest
|
|
42
42
|
run: |
|
|
@@ -26,20 +26,21 @@ jobs:
|
|
|
26
26
|
uses: actions/checkout@v4
|
|
27
27
|
with:
|
|
28
28
|
path: dartsort
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
- name: Fetch tags and describe
|
|
31
31
|
run: pushd dartsort/ && git fetch --prune --unshallow --tags && git describe && popd
|
|
32
32
|
|
|
33
33
|
- uses: actions/setup-python@v5
|
|
34
34
|
with:
|
|
35
|
-
python-version:
|
|
36
|
-
cache:
|
|
37
|
-
|
|
35
|
+
python-version: "3.x"
|
|
36
|
+
cache: "pip" # caching pip dependencies
|
|
37
|
+
|
|
38
38
|
- name: Install dependencies
|
|
39
39
|
run: |
|
|
40
40
|
python -m pip install -U pip # seems necessary to make sure pip is my pip
|
|
41
41
|
pip install --extra-index-url https://download.pytorch.org/whl/cpu torch
|
|
42
|
-
pip install
|
|
42
|
+
pip install git+https://github.com/SpikeInterface/spikeinterface.git
|
|
43
|
+
pip install -e dartsort/[full,test]
|
|
43
44
|
|
|
44
45
|
- name: pytest
|
|
45
46
|
run: |
|
dartsort-0.5.2/PKG-INFO
ADDED
|
@@ -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
|
+
[](https://github.com/cwindolf/dartsort/actions/)
|
|
41
|
+
[](https://coveralls.io/github/cwindolf/dartsort)
|
|
42
|
+
[](https://doi.org/10.5281/zenodo.16943074)
|
|
43
|
+
[](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/
|
dartsort-0.5.2/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
[](https://github.com/cwindolf/dartsort/actions/)
|
|
2
|
+
[](https://coveralls.io/github/cwindolf/dartsort)
|
|
3
|
+
[](https://doi.org/10.5281/zenodo.16943074)
|
|
4
|
+
[](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
|
|
@@ -18,6 +18,7 @@ dependencies = [
|
|
|
18
18
|
"dredge-ephys",
|
|
19
19
|
"h5py",
|
|
20
20
|
"jaxtyping",
|
|
21
|
+
"kdepy",
|
|
21
22
|
"linear_operator",
|
|
22
23
|
"numba",
|
|
23
24
|
"numpy>=1.20;python_version<'3.13'",
|
|
@@ -26,19 +27,18 @@ dependencies = [
|
|
|
26
27
|
"pandas",
|
|
27
28
|
"probeinterface",
|
|
28
29
|
"pydantic",
|
|
30
|
+
"pynapple",
|
|
29
31
|
"scipy>=1.13",
|
|
30
32
|
"scikit-learn",
|
|
31
|
-
"spikeinterface>=0.
|
|
33
|
+
"spikeinterface>=0.104.0",
|
|
32
34
|
"sympy",
|
|
33
35
|
"torch>=2.0",
|
|
34
36
|
"tqdm",
|
|
35
37
|
]
|
|
36
38
|
|
|
37
39
|
[project.optional-dependencies]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
gpu = ["cupy"]
|
|
41
|
-
full = ["matplotlib", "seaborn", "pytest", "pytest-cov", "ipywidgets", "ipykernel", "black"]
|
|
40
|
+
test = ["pytest", "pytest-cov"]
|
|
41
|
+
vis = ["matplotlib", "seaborn", "matplotlib-venn"]
|
|
42
42
|
|
|
43
43
|
[project.urls]
|
|
44
44
|
"Homepage" = "https://github.com/cwindolf/dartsort"
|
|
@@ -70,9 +70,18 @@ include = 'src\/.*\.pyi?$|tests\/.*\.pyi?$'
|
|
|
70
70
|
|
|
71
71
|
[tool.ruff]
|
|
72
72
|
line-length = 88
|
|
73
|
+
extend-select = ["I"]
|
|
74
|
+
ignore = ["F722"]
|
|
73
75
|
|
|
74
76
|
[tool.jupytext]
|
|
75
77
|
"formats" = "ipynb,py:percent"
|
|
76
78
|
|
|
77
|
-
[tool.
|
|
78
|
-
|
|
79
|
+
[tool.ty.src]
|
|
80
|
+
include = ["src", "tests"]
|
|
81
|
+
|
|
82
|
+
[tool.ty.analysis]
|
|
83
|
+
replace-imports-with-any = ["hdbscan"]
|
|
84
|
+
|
|
85
|
+
[tool.ty.rules]
|
|
86
|
+
"unsupported-base" = "ignore"
|
|
87
|
+
"invalid-key" = "ignore"
|
|
@@ -2,11 +2,12 @@ import importlib.metadata
|
|
|
2
2
|
|
|
3
3
|
from . import detect, util
|
|
4
4
|
from .clustering import (
|
|
5
|
+
SimpleMatrixFeatures,
|
|
6
|
+
StableWaveformFeatures,
|
|
5
7
|
cluster_util,
|
|
6
8
|
clustering_strategies,
|
|
7
9
|
density,
|
|
8
10
|
get_clusterer,
|
|
9
|
-
get_clustering_features,
|
|
10
11
|
kmeans,
|
|
11
12
|
merge,
|
|
12
13
|
refinement_strategies,
|
|
@@ -55,11 +56,17 @@ from .util.data_util import (
|
|
|
55
56
|
check_recording,
|
|
56
57
|
get_featurization_pipeline,
|
|
57
58
|
get_tpca,
|
|
58
|
-
|
|
59
|
+
load,
|
|
59
60
|
load_stored_tsvd,
|
|
60
61
|
)
|
|
61
62
|
from .util.drift_util import registered_geometry
|
|
62
63
|
from .util.internal_config import *
|
|
64
|
+
from .util.interpolation_util import (
|
|
65
|
+
FromFullProbeInterpolator,
|
|
66
|
+
StableFeaturesInterpolator,
|
|
67
|
+
ToFullProbeInterpolator,
|
|
68
|
+
pad_geom,
|
|
69
|
+
)
|
|
63
70
|
from .util.job_util import ensure_computation_config, set_global_computation_config
|
|
64
71
|
from .util.logging_util import (
|
|
65
72
|
DARTSORTDEBUG,
|
|
@@ -67,9 +74,10 @@ from .util.logging_util import (
|
|
|
67
74
|
DARTsortLogger,
|
|
68
75
|
get_logger,
|
|
69
76
|
)
|
|
77
|
+
from .util.motion import MotionInfo, get_motion_info, try_load_motion_info
|
|
70
78
|
from .util.noise_util import EmbeddedNoise
|
|
79
|
+
from .util.preprocess_util import preprocess
|
|
71
80
|
from .util.py_util import databag, resolve_path
|
|
72
|
-
from .util.
|
|
73
|
-
from .util.waveform_util import make_channel_index
|
|
81
|
+
from .util.waveform_util import full_channel_index, make_channel_index
|
|
74
82
|
|
|
75
83
|
__version__ = importlib.metadata.version("dartsort")
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import argparse
|
|
2
|
-
import spikeinterface.core as sc
|
|
3
2
|
import logging
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
import spikeinterface.core as sc
|
|
4
6
|
|
|
5
|
-
from .util import cli_util
|
|
6
7
|
from . import config, main
|
|
8
|
+
from .util import cli_util
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
def dartsort_cli():
|
|
@@ -71,7 +73,9 @@ def dartsort_cli():
|
|
|
71
73
|
if args.output_dir:
|
|
72
74
|
output_dir = cli_util.ensurepath(args.output_dir, strict=False)
|
|
73
75
|
elif config_toml is None:
|
|
74
|
-
print(
|
|
76
|
+
print(
|
|
77
|
+
f"No output directory given, exiting. See `{ap.prog} -h`.", file=sys.stderr
|
|
78
|
+
)
|
|
75
79
|
return 1
|
|
76
80
|
else:
|
|
77
81
|
output_dir = config_toml.parent
|
|
@@ -85,7 +89,6 @@ def dartsort_cli():
|
|
|
85
89
|
)
|
|
86
90
|
|
|
87
91
|
# load the recording
|
|
88
|
-
# TODO: preprocessing management
|
|
89
92
|
try:
|
|
90
93
|
rec = sc.load(cli_util.ensurepath(args.recording))
|
|
91
94
|
assert isinstance(rec, sc.BaseRecording)
|