DARTsort 0.3.6.4__tar.gz → 0.4.0__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.3.6.4 → dartsort-0.4.0}/.github/workflows/ci.yml +0 -7
- {dartsort-0.3.6.4 → dartsort-0.4.0}/.github/workflows/ci_windows.yml +8 -8
- {dartsort-0.3.6.4 → dartsort-0.4.0}/.github/workflows/deploy.yml +3 -1
- {dartsort-0.3.6.4 → dartsort-0.4.0}/.gitignore +1 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/PKG-INFO +5 -2
- {dartsort-0.3.6.4 → dartsort-0.4.0}/README.md +1 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/pyproject.toml +4 -2
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/__init__.py +14 -7
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/cluster_util.py +13 -18
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/clustering.py +37 -62
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/clustering_features.py +27 -27
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/density.py +9 -11
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/forward_backward.py +3 -3
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/gmm/mixture.py +1352 -440
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/gmm/stable_features.py +23 -321
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/kmeans.py +307 -123
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/merge.py +8 -11
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/refine_util.py +48 -59
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/config.py +46 -31
- dartsort-0.4.0/src/dartsort/detect/__init__.py +2 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/detect/detect.py +22 -69
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/evaluate/analysis.py +44 -62
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/evaluate/comparison.py +6 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/evaluate/hybrid_util.py +25 -34
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/evaluate/noise_recording_tools.py +1 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/evaluate/simkit.py +94 -52
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/evaluate/simlib.py +105 -14
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/localize/localize_torch.py +1 -1
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/localize/localize_util.py +17 -15
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/main.py +58 -90
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/__init__.py +1 -2
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/grab.py +25 -32
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/matching.py +105 -138
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/matching_util/compressed_upsampled.py +27 -46
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/matching_util/drifty.py +104 -72
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/matching_util/matching_base.py +61 -59
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/matching_util/pairwise.py +15 -7
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/matching_util/pairwise_util.py +15 -16
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/peel_base.py +90 -82
- dartsort-0.4.0/src/dartsort/peel/reduction_template.py +385 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/subtract.py +149 -305
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/threshold.py +75 -130
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/templates/__init__.py +3 -1
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/templates/get_templates.py +79 -197
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/templates/postprocess_util.py +102 -38
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/templates/realignment.py +4 -3
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/templates/superres_util.py +23 -25
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/templates/template_util.py +71 -53
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/templates/templates.py +30 -8
- dartsort-0.4.0/src/dartsort/templates/templib.py +195 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/all_transformers.py +8 -2
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/amplitudes.py +6 -3
- dartsort-0.4.0/src/dartsort/transform/fixed_prop.py +28 -0
- dartsort-0.4.0/src/dartsort/transform/interp.py +48 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/pipeline.py +4 -1
- dartsort-0.4.0/src/dartsort/transform/reduction.py +265 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/temporal_pca.py +77 -19
- dartsort-0.4.0/src/dartsort/transform/whiten.py +32 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/data_util.py +302 -42
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/drift_util.py +45 -162
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/internal_config.py +193 -129
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/interpolation_util.py +597 -106
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/job_util.py +12 -1
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/main_util.py +20 -12
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/more_operators.py +6 -2
- dartsort-0.4.0/src/dartsort/util/motion.py +337 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/multiprocessing_util.py +21 -14
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/noise_util.py +308 -230
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/py_util.py +39 -14
- dartsort-0.4.0/src/dartsort/util/registration_util.py +82 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/spiketorch.py +64 -11
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/testing_util/matching_debug_util.py +69 -25
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/waveform_util.py +7 -4
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/__init__.py +20 -13
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/analysis_plots.py +3 -3
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/mixture.py +162 -47
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/recanim.py +8 -10
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/scatterplots.py +20 -21
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/unit.py +14 -1
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/vismain.py +29 -58
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort.egg-info/PKG-INFO +5 -2
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort.egg-info/SOURCES.txt +7 -9
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort.egg-info/requires.txt +2 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_alignment.py +34 -47
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_clustering.py +10 -11
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_config.py +2 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_dartsort.py +5 -5
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_detect.py +3 -3
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_drift_util.py +35 -27
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_grab_and_featurize.py +4 -4
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_linalg.py +2 -2
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_localize_torch.py +8 -8
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_matching.py +22 -13
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_modeling.py +38 -7
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_simkit.py +45 -40
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_spiketorch.py +4 -2
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_subtract.py +9 -4
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_templates.py +188 -90
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_transform.py +8 -1
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_waveform_util.py +4 -1
- dartsort-0.3.6.4/src/dartsort/clustering/relocate.py +0 -109
- dartsort-0.3.6.4/src/dartsort/clustering/split.py +0 -1285
- dartsort-0.3.6.4/src/dartsort/detect/__init__.py +0 -2
- dartsort-0.3.6.4/src/dartsort/peel/running_template.py +0 -1701
- dartsort-0.3.6.4/src/dartsort/peel/universal.py +0 -191
- dartsort-0.3.6.4/src/dartsort/transform/single_channel_templates.py +0 -98
- dartsort-0.3.6.4/src/dartsort/util/registration_util.py +0 -128
- dartsort-0.3.6.4/src/dartsort/util/universal_util.py +0 -269
- dartsort-0.3.6.4/src/dartsort/vis/over_time.py +0 -514
- dartsort-0.3.6.4/tests/test_relocate.py +0 -147
- dartsort-0.3.6.4/tests/test_universal.py +0 -9
- {dartsort-0.3.6.4 → dartsort-0.4.0}/environment.yml +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/.keep +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/basic_integration_test.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/ci diag.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/dartsort_dredge_demo.ipynb +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/dartsort_dredge_demo.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/data test.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/dead reckoning.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/denoise np1.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/denoise np2.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/exploratory.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/geom debug.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/hdbscan_clustering_5min.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/hybrid 10.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/hybrid cluster.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/hybrid_11.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/initial training.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/make hybrid.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/mgh.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/np1 feats.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/np2 processing version c.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/paperfigs.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/pdists.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/postcheck.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/ptp vae.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/re clust.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/reg fig loop.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/reg_sim_exp.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/relocating.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/relocating_all.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/restats +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/sortStinger1.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/sortStinger3.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/sortStinger4.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/sortStinger5.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/sortStinger6.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/spike farm.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/ss_ensemble_sim.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/ss_ensemble_sim_drift.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/ss_sim.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/stan diagnostics.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/storytelling c.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/storytelling.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/subtract_with_phaseshift_denoiser.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/debug_matching.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/test_agreement.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/test_amplitude_scaling.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/test_batch_optim.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/test_ibme.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/test_mm_initialization.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/test_normxcorr1d.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/test_reassignment.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/tests/test_relocation.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/notebook/thomas.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/setup.cfg +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/cli.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/__init__.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/clustering/modes.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/detect/detect_filters.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/evaluate/__init__.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/evaluate/sim_template_tools.py +3 -3
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/localize/__init__.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/peel/matching_util/__init__.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/detect_np1.pt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/detect_np2.pt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/glasbey1024.npz +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/__init__.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/_multichan_denoiser_kit.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/amortized_localization.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/decollider.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/enforce_decrease.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/localize.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/matching_denoiser.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/single_channel_denoiser.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/supervised_denoiser.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/transform/transform_base.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/__init__.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/cli_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/logging_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/nn_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/peel_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/residual_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/sparse_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/spikeio.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/testing_util/__init__.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/torch_optimization_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/util/torch_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/colors.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/gt.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/layout.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/metrics_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/sorting.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/unit_comparison.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/versus.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort/vis/waveforms.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort.egg-info/dependency_links.txt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort.egg-info/entry_points.txt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/src/dartsort.egg-info/top_level.txt +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/conftest.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_data_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_drifty_matching.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_enforce_decrease.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_kmeans.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_threshold.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_torch_optimization_util.py +0 -0
- {dartsort-0.3.6.4 → dartsort-0.4.0}/tests/test_util.py +0 -0
|
@@ -27,12 +27,6 @@ jobs:
|
|
|
27
27
|
- name: Fetch tags and describe
|
|
28
28
|
run: pushd dartsort/ && git fetch --prune --unshallow --tags && git describe && popd
|
|
29
29
|
|
|
30
|
-
- name: Get DREDge
|
|
31
|
-
uses: actions/checkout@v4
|
|
32
|
-
with:
|
|
33
|
-
repository: evarol/dredge
|
|
34
|
-
path: dredge
|
|
35
|
-
|
|
36
30
|
- uses: actions/setup-python@v5
|
|
37
31
|
with:
|
|
38
32
|
python-version: '3.x'
|
|
@@ -42,7 +36,6 @@ jobs:
|
|
|
42
36
|
run: |
|
|
43
37
|
python -m pip install -U pip # seems necessary to make sure pip is my pip
|
|
44
38
|
pip install --extra-index-url https://download.pytorch.org/whl/cpu torch
|
|
45
|
-
pip install dredge/
|
|
46
39
|
pip install -e dartsort/[full]
|
|
47
40
|
|
|
48
41
|
- name: pytest
|
|
@@ -4,12 +4,19 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
+
workflow_run:
|
|
8
|
+
workflows: [CI]
|
|
9
|
+
types: [completed]
|
|
10
|
+
branches:
|
|
11
|
+
- develop
|
|
7
12
|
workflow_dispatch:
|
|
8
13
|
|
|
9
14
|
jobs:
|
|
10
|
-
|
|
11
15
|
tests_windows:
|
|
12
16
|
runs-on: "windows-latest"
|
|
17
|
+
if: >-
|
|
18
|
+
github.event_name != 'workflow_run' ||
|
|
19
|
+
github.event.workflow_run.conclusion == 'success'
|
|
13
20
|
defaults:
|
|
14
21
|
run:
|
|
15
22
|
shell: bash -el {0}
|
|
@@ -23,12 +30,6 @@ jobs:
|
|
|
23
30
|
- name: Fetch tags and describe
|
|
24
31
|
run: pushd dartsort/ && git fetch --prune --unshallow --tags && git describe && popd
|
|
25
32
|
|
|
26
|
-
- name: Get DREDge
|
|
27
|
-
uses: actions/checkout@v4
|
|
28
|
-
with:
|
|
29
|
-
repository: evarol/dredge
|
|
30
|
-
path: dredge
|
|
31
|
-
|
|
32
33
|
- uses: actions/setup-python@v5
|
|
33
34
|
with:
|
|
34
35
|
python-version: '3.x'
|
|
@@ -38,7 +39,6 @@ jobs:
|
|
|
38
39
|
run: |
|
|
39
40
|
python -m pip install -U pip # seems necessary to make sure pip is my pip
|
|
40
41
|
pip install --extra-index-url https://download.pytorch.org/whl/cpu torch
|
|
41
|
-
pip install dredge/
|
|
42
42
|
pip install -e dartsort/[full]
|
|
43
43
|
|
|
44
44
|
- name: pytest
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dartsort
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: DARTsort
|
|
5
|
-
Author-email: Charlie Windolf <
|
|
5
|
+
Author-email: Charlie Windolf <ciw2048@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/cwindolf/dartsort
|
|
7
7
|
Project-URL: Bug Tracker, https://github.com/cwindolf/dartsort/issues
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -10,7 +10,9 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Requires-Python: >=3.11
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: dredge-ephys
|
|
13
14
|
Requires-Dist: h5py
|
|
15
|
+
Requires-Dist: jaxtyping
|
|
14
16
|
Requires-Dist: linear_operator
|
|
15
17
|
Requires-Dist: numba
|
|
16
18
|
Requires-Dist: numpy>=1.20; python_version < "3.13"
|
|
@@ -44,6 +46,7 @@ Requires-Dist: black; extra == "full"
|
|
|
44
46
|
|
|
45
47
|
[](https://github.com/cwindolf/dartsort/actions/)
|
|
46
48
|
[](https://coveralls.io/github/cwindolf/dartsort)
|
|
49
|
+
[](https://doi.org/10.5281/zenodo.16943074)
|
|
47
50
|
|
|
48
51
|
# dartsort
|
|
49
52
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
[](https://github.com/cwindolf/dartsort/actions/)
|
|
2
2
|
[](https://coveralls.io/github/cwindolf/dartsort)
|
|
3
|
+
[](https://doi.org/10.5281/zenodo.16943074)
|
|
3
4
|
|
|
4
5
|
# dartsort
|
|
5
6
|
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dartsort"
|
|
7
7
|
dynamic = ["version"]
|
|
8
|
-
authors = [{ name = "Charlie Windolf", email = "
|
|
8
|
+
authors = [{ name = "Charlie Windolf", email = "ciw2048@gmail.com" }]
|
|
9
9
|
description = "DARTsort"
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.11"
|
|
@@ -15,7 +15,9 @@ classifiers = [
|
|
|
15
15
|
"Operating System :: OS Independent",
|
|
16
16
|
]
|
|
17
17
|
dependencies = [
|
|
18
|
+
"dredge-ephys",
|
|
18
19
|
"h5py",
|
|
20
|
+
"jaxtyping",
|
|
19
21
|
"linear_operator",
|
|
20
22
|
"numba",
|
|
21
23
|
"numpy>=1.20;python_version<'3.13'",
|
|
@@ -73,4 +75,4 @@ line-length = 88
|
|
|
73
75
|
"formats" = "ipynb,py:percent"
|
|
74
76
|
|
|
75
77
|
[tool.pyright]
|
|
76
|
-
"include" = ["src"]
|
|
78
|
+
"include" = ["src", "tests"]
|
|
@@ -26,16 +26,15 @@ from .main import (
|
|
|
26
26
|
check_recording,
|
|
27
27
|
cluster,
|
|
28
28
|
dartsort,
|
|
29
|
-
estimate_motion,
|
|
30
29
|
grab,
|
|
31
30
|
logger,
|
|
32
31
|
match,
|
|
33
32
|
run_peeler,
|
|
34
33
|
subtract,
|
|
35
34
|
threshold,
|
|
36
|
-
universal_match,
|
|
37
35
|
)
|
|
38
36
|
from .peel.grab import GrabAndFeaturize
|
|
37
|
+
from .peel.matching import MatchingTemplates
|
|
39
38
|
from .templates import (
|
|
40
39
|
TemplateData,
|
|
41
40
|
estimate_template_library,
|
|
@@ -43,17 +42,25 @@ from .templates import (
|
|
|
43
42
|
realign,
|
|
44
43
|
)
|
|
45
44
|
from .transform import WaveformPipeline
|
|
46
|
-
from .util import
|
|
45
|
+
from .util import (
|
|
46
|
+
data_util,
|
|
47
|
+
logging_util,
|
|
48
|
+
noise_util,
|
|
49
|
+
spikeio,
|
|
50
|
+
spiketorch,
|
|
51
|
+
waveform_util,
|
|
52
|
+
)
|
|
47
53
|
from .util.data_util import (
|
|
48
54
|
DARTsortSorting,
|
|
55
|
+
check_recording,
|
|
49
56
|
get_featurization_pipeline,
|
|
50
|
-
load_h5,
|
|
51
57
|
get_tpca,
|
|
58
|
+
load_h5,
|
|
52
59
|
load_stored_tsvd,
|
|
53
|
-
check_recording,
|
|
54
60
|
)
|
|
55
61
|
from .util.drift_util import registered_geometry
|
|
56
62
|
from .util.internal_config import *
|
|
63
|
+
from .util.job_util import ensure_computation_config, set_global_computation_config
|
|
57
64
|
from .util.logging_util import (
|
|
58
65
|
DARTSORTDEBUG,
|
|
59
66
|
DARTSORTVERBOSE,
|
|
@@ -61,8 +68,8 @@ from .util.logging_util import (
|
|
|
61
68
|
get_logger,
|
|
62
69
|
)
|
|
63
70
|
from .util.noise_util import EmbeddedNoise
|
|
64
|
-
from .util.py_util import resolve_path
|
|
65
|
-
from .util.
|
|
71
|
+
from .util.py_util import databag, resolve_path
|
|
72
|
+
from .util.motion import MotionInfo, get_motion_info, try_load_motion_info
|
|
66
73
|
from .util.waveform_util import make_channel_index
|
|
67
74
|
|
|
68
75
|
__version__ = importlib.metadata.version("dartsort")
|
|
@@ -14,6 +14,7 @@ from sklearn.neighbors import KNeighborsClassifier
|
|
|
14
14
|
|
|
15
15
|
from ..util import data_util, drift_util, waveform_util
|
|
16
16
|
from ..util.logging_util import get_logger
|
|
17
|
+
from ..util.motion import MotionInfo
|
|
17
18
|
from dredge.motion_util import IdentityMotionEstimate
|
|
18
19
|
|
|
19
20
|
|
|
@@ -201,15 +202,15 @@ def combine_disjoint(inds_a, labels_a, inds_b, labels_b):
|
|
|
201
202
|
return labels
|
|
202
203
|
|
|
203
204
|
|
|
204
|
-
def reorder_by_depth(sorting,
|
|
205
|
+
def reorder_by_depth(sorting, motion=None):
|
|
205
206
|
kept = np.flatnonzero(sorting.labels >= 0)
|
|
206
207
|
kept_labels = sorting.labels[kept]
|
|
207
208
|
|
|
208
209
|
units, kept_labels = np.unique(kept_labels, return_inverse=True)
|
|
209
210
|
|
|
210
211
|
depths = sorting.point_source_localizations[kept, 2]
|
|
211
|
-
if
|
|
212
|
-
depths =
|
|
212
|
+
if motion is not None:
|
|
213
|
+
depths = motion.correct_s(sorting.times_seconds[kept], depths)
|
|
213
214
|
|
|
214
215
|
centroids = np.zeros(units.size)
|
|
215
216
|
for u in range(units.size):
|
|
@@ -224,43 +225,37 @@ def reorder_by_depth(sorting, motion_est=None):
|
|
|
224
225
|
|
|
225
226
|
|
|
226
227
|
def closest_registered_channels(
|
|
227
|
-
times_seconds, x, z_abs,
|
|
228
|
+
*, times_seconds, x, z_abs, z_reg=None, motion: MotionInfo
|
|
228
229
|
) -> np.ndarray:
|
|
229
230
|
"""Assign spikes to the drift-extended channel closest to their registered position"""
|
|
230
|
-
if motion_est is None:
|
|
231
|
-
motion_est = IdentityMotionEstimate()
|
|
232
|
-
registered_geom = drift_util.registered_geometry(geom, motion_est)
|
|
233
231
|
if z_reg is None:
|
|
234
|
-
|
|
232
|
+
assert motion is not None
|
|
233
|
+
z_reg = motion.correct_s(times_seconds, z_abs)
|
|
235
234
|
reg_pos = np.c_[x, z_reg]
|
|
236
235
|
|
|
237
|
-
|
|
238
|
-
_, reg_channels = registered_kdt.query(reg_pos)
|
|
236
|
+
_, reg_channels = motion.rgeom_kdt.query(reg_pos)
|
|
239
237
|
reg_channels = np.atleast_1d(reg_channels)
|
|
240
238
|
|
|
241
239
|
return reg_channels
|
|
242
240
|
|
|
243
241
|
|
|
244
242
|
def grid_snap(
|
|
243
|
+
*,
|
|
245
244
|
times_seconds,
|
|
246
245
|
x,
|
|
247
246
|
z_abs,
|
|
248
|
-
geom,
|
|
249
247
|
grid_dx=15.0,
|
|
250
248
|
grid_dz=15.0,
|
|
251
249
|
z_reg=None,
|
|
252
|
-
|
|
250
|
+
motion: MotionInfo,
|
|
253
251
|
) -> np.ndarray:
|
|
254
|
-
if motion_est is None:
|
|
255
|
-
motion_est = IdentityMotionEstimate()
|
|
256
252
|
if z_reg is None:
|
|
257
|
-
z_reg =
|
|
253
|
+
z_reg = motion.correct_s(times_seconds, z_abs)
|
|
258
254
|
reg_pos = np.c_[x, z_reg]
|
|
259
255
|
|
|
260
256
|
# make a grid inside the registered geom bounding box
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
min_z, max_z = registered_geom[:, 1].min(), registered_geom[:, 1].max()
|
|
257
|
+
min_x, max_x = motion.rgeom[:, 0].min(), motion.rgeom[:, 0].max()
|
|
258
|
+
min_z, max_z = motion.rgeom[:, 1].min(), motion.rgeom[:, 1].max()
|
|
264
259
|
grid_x = np.arange(min_x, max_x, grid_dx)
|
|
265
260
|
grid_x += (min_x + max_x) / 2 - grid_x.mean()
|
|
266
261
|
grid_z = np.arange(min_z, max_z, grid_dz)
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import gc
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Literal, Self, cast
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import sklearn.cluster
|
|
6
6
|
import torch
|
|
7
7
|
from spikeinterface.core import BaseRecording
|
|
8
8
|
|
|
9
|
-
from ..util
|
|
10
|
-
from ..util.
|
|
9
|
+
from ..util import job_util
|
|
10
|
+
from ..util.data_util import DARTsortSorting, chunk_time_ranges, fit_reweighting
|
|
11
11
|
from ..util.internal_config import (
|
|
12
12
|
ClusteringConfig,
|
|
13
|
-
RefinementConfig,
|
|
14
|
-
FitSamplingConfig,
|
|
15
13
|
ComputationConfig,
|
|
14
|
+
FitSamplingConfig,
|
|
15
|
+
RefinementConfig,
|
|
16
16
|
)
|
|
17
|
-
from .
|
|
18
|
-
from ..util import
|
|
17
|
+
from ..util.main_util import ds_save_intermediate_labels
|
|
18
|
+
from ..util.motion import MotionInfo
|
|
19
19
|
from . import cluster_util, density, forward_backward, refine_util
|
|
20
|
+
from .clustering_features import SimpleMatrixFeatures
|
|
20
21
|
from .gmm import mixture
|
|
21
22
|
|
|
22
|
-
|
|
23
23
|
clustering_strategies: dict[str, "type[Clusterer]"] = {}
|
|
24
24
|
refinement_strategies: dict[str, "type[Refinement]"] = {}
|
|
25
25
|
|
|
@@ -161,12 +161,12 @@ class Clusterer:
|
|
|
161
161
|
features: SimpleMatrixFeatures,
|
|
162
162
|
sorting: DARTsortSorting,
|
|
163
163
|
recording: BaseRecording,
|
|
164
|
-
|
|
164
|
+
motion: MotionInfo,
|
|
165
165
|
) -> DARTsortSorting:
|
|
166
166
|
if features is None:
|
|
167
167
|
pass
|
|
168
168
|
else:
|
|
169
|
-
labels = self._cluster(features, sorting, recording,
|
|
169
|
+
labels = self._cluster(features, sorting, recording, motion)
|
|
170
170
|
sorting = sorting.ephemeral_replace(labels=labels)
|
|
171
171
|
if self.labels_fmt and self.save_labels_dir is not None:
|
|
172
172
|
assert "{" not in self.labels_fmt
|
|
@@ -181,10 +181,10 @@ class Clusterer:
|
|
|
181
181
|
features: SimpleMatrixFeatures,
|
|
182
182
|
sorting: DARTsortSorting,
|
|
183
183
|
recording: BaseRecording,
|
|
184
|
-
|
|
184
|
+
motion: MotionInfo,
|
|
185
185
|
) -> np.ndarray:
|
|
186
186
|
"""Unused method but shows API."""
|
|
187
|
-
del features, recording,
|
|
187
|
+
del features, recording, motion
|
|
188
188
|
assert sorting.labels is not None
|
|
189
189
|
return sorting.labels
|
|
190
190
|
|
|
@@ -198,15 +198,14 @@ class ChannelSnapClusterer(Clusterer):
|
|
|
198
198
|
features: SimpleMatrixFeatures,
|
|
199
199
|
sorting: DARTsortSorting,
|
|
200
200
|
recording: BaseRecording,
|
|
201
|
-
|
|
201
|
+
motion: MotionInfo,
|
|
202
202
|
) -> np.ndarray:
|
|
203
203
|
return cluster_util.closest_registered_channels(
|
|
204
204
|
times_seconds=sorting.times_seconds, # type: ignore
|
|
205
205
|
x=features.x,
|
|
206
206
|
z_abs=features.z,
|
|
207
207
|
z_reg=features.z_reg,
|
|
208
|
-
|
|
209
|
-
motion_est=motion_est,
|
|
208
|
+
motion=motion,
|
|
210
209
|
)
|
|
211
210
|
|
|
212
211
|
|
|
@@ -244,7 +243,7 @@ class GridSnapClusterer(Clusterer):
|
|
|
244
243
|
features: SimpleMatrixFeatures,
|
|
245
244
|
sorting: DARTsortSorting,
|
|
246
245
|
recording: BaseRecording,
|
|
247
|
-
|
|
246
|
+
motion: MotionInfo,
|
|
248
247
|
) -> np.ndarray:
|
|
249
248
|
return cluster_util.grid_snap(
|
|
250
249
|
times_seconds=sorting.times_seconds, # type: ignore
|
|
@@ -253,8 +252,7 @@ class GridSnapClusterer(Clusterer):
|
|
|
253
252
|
z_reg=features.z_reg,
|
|
254
253
|
grid_dx=self.grid_dx,
|
|
255
254
|
grid_dz=self.grid_dz,
|
|
256
|
-
|
|
257
|
-
motion_est=motion_est,
|
|
255
|
+
motion=motion,
|
|
258
256
|
)
|
|
259
257
|
|
|
260
258
|
|
|
@@ -329,7 +327,7 @@ class DensityPeaksClusterer(Clusterer):
|
|
|
329
327
|
features: SimpleMatrixFeatures,
|
|
330
328
|
sorting: DARTsortSorting,
|
|
331
329
|
recording: BaseRecording,
|
|
332
|
-
|
|
330
|
+
motion: MotionInfo,
|
|
333
331
|
) -> np.ndarray:
|
|
334
332
|
subsampling, ixs = self.handle_sampling(features)
|
|
335
333
|
X = features.features
|
|
@@ -354,7 +352,7 @@ class DensityPeaksClusterer(Clusterer):
|
|
|
354
352
|
features.xyza,
|
|
355
353
|
features.amplitudes,
|
|
356
354
|
sorting,
|
|
357
|
-
|
|
355
|
+
motion,
|
|
358
356
|
recording.get_channel_locations(),
|
|
359
357
|
sigma_local=self.sigma_local,
|
|
360
358
|
sigma_regional=self.sigma_regional,
|
|
@@ -479,7 +477,7 @@ class GMMDensityPeaksClusterer(Clusterer):
|
|
|
479
477
|
features: SimpleMatrixFeatures,
|
|
480
478
|
sorting: DARTsortSorting,
|
|
481
479
|
recording: BaseRecording,
|
|
482
|
-
|
|
480
|
+
motion: MotionInfo,
|
|
483
481
|
) -> np.ndarray:
|
|
484
482
|
res = density.gmm_density_peaks(
|
|
485
483
|
X=features.features,
|
|
@@ -551,7 +549,7 @@ class RecursiveHDBSCANClusterer(Clusterer):
|
|
|
551
549
|
features: SimpleMatrixFeatures,
|
|
552
550
|
sorting: DARTsortSorting,
|
|
553
551
|
recording: BaseRecording,
|
|
554
|
-
|
|
552
|
+
motion: MotionInfo,
|
|
555
553
|
) -> np.ndarray:
|
|
556
554
|
return cluster_util.recursive_hdbscan_clustering(
|
|
557
555
|
features.features,
|
|
@@ -593,7 +591,7 @@ class ScikitLearnClusterer(Clusterer):
|
|
|
593
591
|
features: SimpleMatrixFeatures,
|
|
594
592
|
sorting: DARTsortSorting,
|
|
595
593
|
recording: BaseRecording,
|
|
596
|
-
|
|
594
|
+
motion: MotionInfo,
|
|
597
595
|
) -> np.ndarray:
|
|
598
596
|
skcls = getattr(sklearn.cluster, self.sklearn_class_name)
|
|
599
597
|
clus = skcls(**self.sklearn_kwargs)
|
|
@@ -617,10 +615,10 @@ class Refinement(Clusterer):
|
|
|
617
615
|
features: SimpleMatrixFeatures,
|
|
618
616
|
sorting: DARTsortSorting,
|
|
619
617
|
recording: BaseRecording,
|
|
620
|
-
|
|
618
|
+
motion: MotionInfo,
|
|
621
619
|
):
|
|
622
|
-
sorting = self.clusterer.cluster(features, sorting, recording,
|
|
623
|
-
sorting = self.refine(features, sorting, recording,
|
|
620
|
+
sorting = self.clusterer.cluster(features, sorting, recording, motion)
|
|
621
|
+
sorting = self.refine(features, sorting, recording, motion)
|
|
624
622
|
return sorting
|
|
625
623
|
|
|
626
624
|
def _refine(
|
|
@@ -628,9 +626,9 @@ class Refinement(Clusterer):
|
|
|
628
626
|
features: SimpleMatrixFeatures,
|
|
629
627
|
sorting: DARTsortSorting,
|
|
630
628
|
recording: BaseRecording,
|
|
631
|
-
|
|
629
|
+
motion: MotionInfo,
|
|
632
630
|
):
|
|
633
|
-
del features, recording,
|
|
631
|
+
del features, recording, motion
|
|
634
632
|
return sorting
|
|
635
633
|
|
|
636
634
|
def refine(
|
|
@@ -638,9 +636,9 @@ class Refinement(Clusterer):
|
|
|
638
636
|
features: SimpleMatrixFeatures,
|
|
639
637
|
sorting: DARTsortSorting,
|
|
640
638
|
recording: BaseRecording,
|
|
641
|
-
|
|
639
|
+
motion: MotionInfo,
|
|
642
640
|
):
|
|
643
|
-
sorting = self._refine(features, sorting, recording,
|
|
641
|
+
sorting = self._refine(features, sorting, recording, motion)
|
|
644
642
|
if self.labels_fmt and self.save_labels_dir is not None:
|
|
645
643
|
labels_fmt = self.labels_fmt.format(stepname="")
|
|
646
644
|
ds_save_intermediate_labels(
|
|
@@ -658,14 +656,14 @@ class TMMRefinement(Refinement):
|
|
|
658
656
|
features: SimpleMatrixFeatures,
|
|
659
657
|
sorting: DARTsortSorting,
|
|
660
658
|
recording: BaseRecording,
|
|
661
|
-
|
|
659
|
+
motion: MotionInfo,
|
|
662
660
|
):
|
|
663
661
|
assert features is not None
|
|
664
662
|
subsampling, ixs = self.handle_sampling(features)
|
|
665
663
|
ixs = cast(np.ndarray, ixs) if subsampling else None
|
|
666
664
|
sorting = mixture.tmm_demix(
|
|
667
665
|
sorting=sorting,
|
|
668
|
-
|
|
666
|
+
motion=motion,
|
|
669
667
|
refinement_cfg=self.refinement_cfg,
|
|
670
668
|
computation_cfg=self.computation_cfg,
|
|
671
669
|
fit_indices=ixs,
|
|
@@ -681,43 +679,20 @@ class TMMRefinement(Refinement):
|
|
|
681
679
|
refinement_strategies["tmm"] = TMMRefinement
|
|
682
680
|
|
|
683
681
|
|
|
684
|
-
class SplitMergeRefinement(Refinement):
|
|
685
|
-
def _refine(
|
|
686
|
-
self,
|
|
687
|
-
features: SimpleMatrixFeatures,
|
|
688
|
-
sorting: DARTsortSorting,
|
|
689
|
-
recording: BaseRecording,
|
|
690
|
-
motion_est=None,
|
|
691
|
-
):
|
|
692
|
-
return refine_util.split_merge(
|
|
693
|
-
recording=recording,
|
|
694
|
-
sorting=sorting,
|
|
695
|
-
motion_est=motion_est,
|
|
696
|
-
split_cfg=self.refinement_cfg.split_cfg,
|
|
697
|
-
merge_cfg=self.refinement_cfg.merge_cfg,
|
|
698
|
-
merge_template_cfg=self.refinement_cfg.merge_template_cfg,
|
|
699
|
-
computation_cfg=self.computation_cfg,
|
|
700
|
-
)
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
# code too old. todo.
|
|
704
|
-
# refinement_strategies["splitmerge"] = SplitMergeRefinement
|
|
705
|
-
|
|
706
|
-
|
|
707
682
|
class PCMergeRefinement(Refinement):
|
|
708
683
|
def _refine(
|
|
709
684
|
self,
|
|
710
685
|
features: SimpleMatrixFeatures,
|
|
711
686
|
sorting: DARTsortSorting,
|
|
712
687
|
recording: BaseRecording,
|
|
713
|
-
|
|
688
|
+
motion: MotionInfo,
|
|
714
689
|
):
|
|
715
690
|
return refine_util.pc_merge(
|
|
716
|
-
sorting,
|
|
691
|
+
sorting=sorting,
|
|
717
692
|
refinement_cfg=self.refinement_cfg,
|
|
718
|
-
|
|
693
|
+
motion=motion,
|
|
719
694
|
computation_cfg=self.computation_cfg,
|
|
720
|
-
)
|
|
695
|
+
).sorting
|
|
721
696
|
|
|
722
697
|
|
|
723
698
|
refinement_strategies["pcmerge"] = PCMergeRefinement
|
|
@@ -731,7 +706,7 @@ class ForwardBackwardEnsembler(Refinement):
|
|
|
731
706
|
features: SimpleMatrixFeatures,
|
|
732
707
|
sorting: DARTsortSorting,
|
|
733
708
|
recording: BaseRecording,
|
|
734
|
-
|
|
709
|
+
motion: MotionInfo,
|
|
735
710
|
):
|
|
736
711
|
chunk_length_samples = (
|
|
737
712
|
recording.sampling_frequency * self.refinement_cfg.chunk_size_s
|
|
@@ -745,7 +720,7 @@ class ForwardBackwardEnsembler(Refinement):
|
|
|
745
720
|
mask = np.flatnonzero(times_seconds == times_seconds.clip(lo, hi))
|
|
746
721
|
s = sorting.mask(mask)
|
|
747
722
|
f = features.mask(mask)
|
|
748
|
-
l = self.clusterer._cluster(f, s, recording,
|
|
723
|
+
l = self.clusterer._cluster(f, s, recording, motion)
|
|
749
724
|
labels = np.full_like(sorting.labels, -1)
|
|
750
725
|
labels[mask] = l
|
|
751
726
|
chunk_sortings.append(sorting.ephemeral_replace(labels=labels))
|
|
@@ -756,7 +731,7 @@ class ForwardBackwardEnsembler(Refinement):
|
|
|
756
731
|
log_c=self.refinement_cfg.log_c,
|
|
757
732
|
feature_scales=self.refinement_cfg.feature_scales,
|
|
758
733
|
adaptive_feature_scales=self.refinement_cfg.adaptive_feature_scales,
|
|
759
|
-
|
|
734
|
+
motion=motion,
|
|
760
735
|
)
|
|
761
736
|
sorting = sorting.ephemeral_replace(labels=labels)
|
|
762
737
|
return sorting
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Self, cast
|
|
2
2
|
|
|
3
3
|
import h5py
|
|
4
4
|
import numpy as np
|
|
5
5
|
import torch
|
|
6
|
+
from spikeinterface.core import BaseRecording
|
|
6
7
|
|
|
7
|
-
from ..util.internal_config import ClusteringFeaturesConfig
|
|
8
8
|
from ..util import drift_util, interpolation_util
|
|
9
|
+
from ..util.data_util import DARTsortSorting
|
|
10
|
+
from ..util.internal_config import ClusteringFeaturesConfig
|
|
11
|
+
from ..util.motion import MotionInfo
|
|
9
12
|
from ..util.py_util import databag
|
|
10
13
|
from ..util.waveform_util import single_channel_index
|
|
11
14
|
from . import cluster_util
|
|
@@ -21,9 +24,9 @@ minimal_features_cfg = ClusteringFeaturesConfig(
|
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
def get_clustering_features(
|
|
24
|
-
recording,
|
|
25
|
-
sorting,
|
|
26
|
-
|
|
27
|
+
recording: BaseRecording,
|
|
28
|
+
sorting: DARTsortSorting,
|
|
29
|
+
motion: MotionInfo,
|
|
27
30
|
clustering_features_cfg: (
|
|
28
31
|
ClusteringFeaturesConfig | None
|
|
29
32
|
) = default_clustering_features_cfg,
|
|
@@ -32,7 +35,7 @@ def get_clustering_features(
|
|
|
32
35
|
clustering_features_cfg = minimal_features_cfg
|
|
33
36
|
if clustering_features_cfg.features_type == "simple_matrix":
|
|
34
37
|
return SimpleMatrixFeatures.from_config(
|
|
35
|
-
recording, sorting,
|
|
38
|
+
recording, sorting, motion, clustering_features_cfg
|
|
36
39
|
)
|
|
37
40
|
assert False
|
|
38
41
|
|
|
@@ -62,14 +65,20 @@ class SimpleMatrixFeatures:
|
|
|
62
65
|
)
|
|
63
66
|
|
|
64
67
|
@classmethod
|
|
65
|
-
def from_config(
|
|
68
|
+
def from_config(
|
|
69
|
+
cls,
|
|
70
|
+
recording: BaseRecording,
|
|
71
|
+
sorting: DARTsortSorting,
|
|
72
|
+
motion: MotionInfo,
|
|
73
|
+
clustering_features_cfg: ClusteringFeaturesConfig,
|
|
74
|
+
):
|
|
66
75
|
assert clustering_features_cfg.features_type == "simple_matrix"
|
|
67
76
|
|
|
68
77
|
xyza = getattr(sorting, clustering_features_cfg.localizations_dataset_name)
|
|
69
78
|
x = xyza[:, 0]
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
z = xyza[:, 2]
|
|
80
|
+
t_s = sorting.times_seconds # type: ignore
|
|
81
|
+
z_reg = motion.correct_s(t_s, z)
|
|
73
82
|
|
|
74
83
|
features = []
|
|
75
84
|
|
|
@@ -110,22 +119,13 @@ class SimpleMatrixFeatures:
|
|
|
110
119
|
dataset_name=clustering_features_cfg.pca_dataset_name,
|
|
111
120
|
)
|
|
112
121
|
elif do_pcs and clustering_features_cfg.motion_aware:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
registered_geom = geom
|
|
116
|
-
else:
|
|
117
|
-
registered_geom = drift_util.registered_geometry(
|
|
118
|
-
geom, motion_est=motion_est
|
|
119
|
-
)
|
|
120
|
-
res = drift_util.get_shift_info(sorting, motion_est, geom)
|
|
121
|
-
channels, shifts, n_pitches_shift = res
|
|
122
|
-
mainchan_ci = single_channel_index(len(geom))
|
|
122
|
+
shifts, n_pitches_shift = motion.pitch_shifts(sorting=sorting)
|
|
123
|
+
mainchan_ci = single_channel_index(len(motion.geom))
|
|
123
124
|
schan, *_ = drift_util.get_stable_channels(
|
|
124
|
-
|
|
125
|
-
channels,
|
|
126
|
-
mainchan_ci,
|
|
127
|
-
|
|
128
|
-
n_pitches_shift,
|
|
125
|
+
motion=motion,
|
|
126
|
+
channels=sorting.channels,
|
|
127
|
+
channel_index=mainchan_ci,
|
|
128
|
+
n_pitches_shift=n_pitches_shift,
|
|
129
129
|
workers=clustering_features_cfg.workers,
|
|
130
130
|
)
|
|
131
131
|
mask = np.ones((1,), dtype=bool)
|
|
@@ -134,11 +134,11 @@ class SimpleMatrixFeatures:
|
|
|
134
134
|
pcs = interpolation_util.interpolate_by_chunk(
|
|
135
135
|
mask=mask,
|
|
136
136
|
dataset=h5[clustering_features_cfg.pca_dataset_name],
|
|
137
|
-
geom=geom,
|
|
137
|
+
geom=motion.geom,
|
|
138
138
|
channel_index=cast(h5py.Dataset, h5["channel_index"])[:],
|
|
139
139
|
channels=sorting.channels,
|
|
140
140
|
shifts=shifts,
|
|
141
|
-
registered_geom=
|
|
141
|
+
registered_geom=motion.rgeom,
|
|
142
142
|
target_channels=schan,
|
|
143
143
|
params=clustering_features_cfg.interp_params,
|
|
144
144
|
)
|