DARTsort 0.5.7__tar.gz → 0.5.9__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.5.7 → dartsort-0.5.9}/PKG-INFO +2 -2
- {dartsort-0.5.7 → dartsort-0.5.9}/pyproject.toml +1 -1
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/__init__.py +1 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/__init__.py +1 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/agglomerate.py +3 -4
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/kmeans.py +13 -6
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/mixture.py +9 -10
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/main.py +4 -1
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/matching_util/drifty.py +3 -3
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/matching_util/matching_base.py +5 -5
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/templates/realignment.py +2 -1
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/mixture_classifier.py +3 -2
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/data_util.py +70 -20
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/interpolation_util.py +5 -5
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/main_util.py +22 -8
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/motion.py +15 -1
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/spiketorch.py +46 -15
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/torch_util.py +46 -3
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort.egg-info/PKG-INFO +2 -2
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort.egg-info/requires.txt +1 -1
- {dartsort-0.5.7 → dartsort-0.5.9}/.github/workflows/ci.yml +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/.github/workflows/ci_windows.yml +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/.github/workflows/deploy.yml +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/.github/workflows/docs.yml +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/.gitignore +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/README.md +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/docs/index.md +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/docs/main_api.md +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/docs/toolkit_api.md +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/environment.yml +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/.keep +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/basic_integration_test.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/ci diag.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/dartsort_dredge_demo.ipynb +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/dartsort_dredge_demo.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/data test.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/dead reckoning.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/denoise np1.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/denoise np2.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/exploratory.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/geom debug.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/hdbscan_clustering_5min.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/hybrid 10.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/hybrid cluster.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/hybrid_11.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/initial training.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/make hybrid.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/mgh.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/np1 feats.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/np2 processing version c.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/paperfigs.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/pdists.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/postcheck.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/ptp vae.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/re clust.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/reg fig loop.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/reg_sim_exp.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/relocating.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/relocating_all.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/restats +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/sortStinger1.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/sortStinger3.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/sortStinger4.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/sortStinger5.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/sortStinger6.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/spike farm.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/ss_ensemble_sim.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/ss_ensemble_sim_drift.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/ss_sim.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/stan diagnostics.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/storytelling c.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/storytelling.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/subtract_with_phaseshift_denoiser.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/debug_matching.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/test_agreement.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/test_amplitude_scaling.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/test_batch_optim.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/test_ibme.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/test_mm_initialization.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/test_normxcorr1d.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/test_reassignment.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/tests/test_relocation.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/notebook/thomas.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/setup.cfg +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/cli.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/cluster_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/clustering.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/clustering_features.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/density.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/forward_backward.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/merge.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/modes.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/clustering/refine_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/config.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/detect/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/detect/detect.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/detect/detect_filters.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/evaluate/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/evaluate/analysis.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/evaluate/comparison.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/evaluate/hybrid_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/evaluate/noise_recording_tools.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/evaluate/sim_template_tools.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/evaluate/simkit.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/evaluate/simlib.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/localize/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/localize/localize_torch.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/localize/localize_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/grab.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/matching.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/matching_util/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/matching_util/compressed_upsampled.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/matching_util/pairwise.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/peel_base.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/peel_lib.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/reduction_template.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/shaver.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/subtract.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/peel/threshold.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/detect_np1.pt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/detect_np2.pt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/glasbey1024.npz +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/templates/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/templates/get_templates.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/templates/postprocess_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/templates/template_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/templates/templates.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/templates/templib.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/_multichan_denoiser_kit.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/all_transformers.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/amortized_localization.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/amplitudes.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/decollider.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/denoising_scorer.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/enforce_decrease.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/fixed_prop.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/interp.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/localize.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/matching_denoiser.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/pipeline.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/reduction.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/single_channel_denoiser.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/supervised_denoiser.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/temporal_pca.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/transform_base.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/transform/whiten.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/cli_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/drift_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/internal_config.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/job_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/logging_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/more_operators.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/multiprocessing_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/nn_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/noise_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/peel_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/preprocess_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/py_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/registration_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/residual_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/sparse_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/spikeio.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/testing_util/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/testing_util/matching_debug_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/torch_optimization_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/util/waveform_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/__init__.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/analysis_plots.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/colors.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/gt.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/layout.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/metrics_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/mixture.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/recanim.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/scatterplots.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/sorting.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/unit.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/unit_comparison.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/versus.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/vismain.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort/vis/waveforms.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort.egg-info/SOURCES.txt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort.egg-info/dependency_links.txt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort.egg-info/entry_points.txt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/src/dartsort.egg-info/top_level.txt +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/conftest.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_alignment.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_cluster_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_clustering.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_config.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_dartsort.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_data_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_density.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_detect.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_drift_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_drifty_matching.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_enforce_decrease.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_grab_and_featurize.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_kmeans.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_linalg.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_localize_torch.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_matching.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_mixture_classifier.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_modeling.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_simkit.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_spiketorch.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_subtract.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_templates.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_threshold.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_torch_optimization_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_transform.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/tests/test_waveform_util.py +0 -0
- {dartsort-0.5.7 → dartsort-0.5.9}/zensical.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dartsort
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.9
|
|
4
4
|
Summary: DARTsort
|
|
5
5
|
Author-email: Charlie Windolf <ciw2048@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/cwindolf/dartsort
|
|
@@ -27,7 +27,7 @@ Requires-Dist: scipy>=1.13
|
|
|
27
27
|
Requires-Dist: scikit-learn
|
|
28
28
|
Requires-Dist: spikeinterface>=0.104.0
|
|
29
29
|
Requires-Dist: sympy
|
|
30
|
-
Requires-Dist: torch>=2.
|
|
30
|
+
Requires-Dist: torch>=2.2
|
|
31
31
|
Requires-Dist: tqdm
|
|
32
32
|
Requires-Dist: typing-extensions
|
|
33
33
|
Provides-Extra: doc
|
|
@@ -155,6 +155,9 @@ def agglomerate(
|
|
|
155
155
|
axis=0,
|
|
156
156
|
)
|
|
157
157
|
qda_mask = np.logical_or(qda_mask_uni, qda_mask_bi)
|
|
158
|
+
assert np.all(qda_mask <= mask)
|
|
159
|
+
if fcorr_mask is not None:
|
|
160
|
+
assert np.all(np.logical_and(qda_mask, fcorr_mask) <= mask)
|
|
158
161
|
force_mask = linkage_mask(
|
|
159
162
|
tdist.distances,
|
|
160
163
|
linkage_method=template_merge_cfg.linkage,
|
|
@@ -162,10 +165,6 @@ def agglomerate(
|
|
|
162
165
|
)
|
|
163
166
|
qda_mask = np.logical_or(qda_mask, force_mask)
|
|
164
167
|
np.fill_diagonal(qda_mask, True)
|
|
165
|
-
if fcorr_mask is None:
|
|
166
|
-
assert np.all(qda_mask <= mask)
|
|
167
|
-
else:
|
|
168
|
-
assert np.all((qda_mask & fcorr_mask) <= mask)
|
|
169
168
|
qda_as_dist = np.logical_not(qda_mask).astype(np.float32)
|
|
170
169
|
|
|
171
170
|
agg_sorting, new_ids = recluster(
|
|
@@ -22,6 +22,7 @@ from ..util.sparse_util import (
|
|
|
22
22
|
sparse_centroid_distsq,
|
|
23
23
|
)
|
|
24
24
|
from ..util.spiketorch import spawn_torch_rg, sqeuc_cdist_known_norm
|
|
25
|
+
from ..util.torch_util import torch_compile, torch_compiler
|
|
25
26
|
|
|
26
27
|
logger = get_logger(__name__)
|
|
27
28
|
|
|
@@ -465,13 +466,19 @@ def kmeans(
|
|
|
465
466
|
)
|
|
466
467
|
|
|
467
468
|
|
|
468
|
-
@torch.
|
|
469
|
+
@torch.compiler.disable
|
|
470
|
+
def _uniform(gen: torch.Generator, buf: Tensor):
|
|
471
|
+
return buf.uniform_(generator=gen)
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
@torch_compiler(fullgraph=False)
|
|
469
475
|
def _one_gumbel_nolog(p: Tensor, gen: torch.Generator, buf: Tensor):
|
|
470
|
-
z =
|
|
476
|
+
z = _uniform(gen, buf)
|
|
477
|
+
z = z.log_()
|
|
471
478
|
return torch.divide(p, z, out=z).argmin(dim=0)
|
|
472
479
|
|
|
473
480
|
|
|
474
|
-
@
|
|
481
|
+
@torch_compile
|
|
475
482
|
def _sqeuc(X: Tensor, Xnormsq: Tensor, Y: Tensor, out: Tensor):
|
|
476
483
|
torch.addmm(Xnormsq, X, Y.transpose(0, 1), alpha=-2.0, out=out)
|
|
477
484
|
Ynormsq = (Y**2).sum(dim=1)
|
|
@@ -479,7 +486,7 @@ def _sqeuc(X: Tensor, Xnormsq: Tensor, Y: Tensor, out: Tensor):
|
|
|
479
486
|
return out
|
|
480
487
|
|
|
481
488
|
|
|
482
|
-
@
|
|
489
|
+
@torch_compiler(fullgraph=False)
|
|
483
490
|
def _kmeanspp_simple_loop(
|
|
484
491
|
*,
|
|
485
492
|
X: Tensor,
|
|
@@ -515,7 +522,7 @@ def _kmeanspp_simple_loop(
|
|
|
515
522
|
torch.minimum(dists, newdists, out=dists)
|
|
516
523
|
|
|
517
524
|
|
|
518
|
-
@
|
|
525
|
+
@torch_compiler(fullgraph=False)
|
|
519
526
|
def _kmeanspp_noassign_loop(
|
|
520
527
|
*,
|
|
521
528
|
X: Tensor,
|
|
@@ -547,7 +554,7 @@ def _kmeanspp_noassign_loop(
|
|
|
547
554
|
torch.minimum(dists, newdists, out=dists)
|
|
548
555
|
|
|
549
556
|
|
|
550
|
-
@
|
|
557
|
+
@torch_compiler(fullgraph=False)
|
|
551
558
|
def _kmeans_main_loop(
|
|
552
559
|
n_iter: int,
|
|
553
560
|
e: Tensor,
|
|
@@ -97,7 +97,7 @@ from ..util.spiketorch import (
|
|
|
97
97
|
sign,
|
|
98
98
|
spawn_torch_rg,
|
|
99
99
|
)
|
|
100
|
-
from ..util.torch_util import BModule
|
|
100
|
+
from ..util.torch_util import BModule, torch_compiler
|
|
101
101
|
from .cluster_util import linkage, maximal_leaf_groups
|
|
102
102
|
from .clustering_features import StableWaveformFeatures
|
|
103
103
|
from .kmeans import kmeans
|
|
@@ -5220,7 +5220,6 @@ def _select_partition(
|
|
|
5220
5220
|
return best_part, best_imp
|
|
5221
5221
|
|
|
5222
5222
|
|
|
5223
|
-
# @torch.jit.script
|
|
5224
5223
|
def _determine_part_score(
|
|
5225
5224
|
rest_logliks: Tensor,
|
|
5226
5225
|
crit_full_log_liks: Tensor,
|
|
@@ -5708,7 +5707,7 @@ def _whiten_and_noise_score_batch(
|
|
|
5708
5707
|
)
|
|
5709
5708
|
|
|
5710
5709
|
|
|
5711
|
-
@
|
|
5710
|
+
@torch_compiler(fullgraph=False)
|
|
5712
5711
|
def _whiten_and_noise_score_batch_k(
|
|
5713
5712
|
x: Tensor, neighb_ids: Tensor, Linv: Tensor, lik_const: Tensor
|
|
5714
5713
|
):
|
|
@@ -6199,7 +6198,7 @@ if TORCH_IS_OLD:
|
|
|
6199
6198
|
|
|
6200
6199
|
def _nonzero_static(x: Tensor, size: int):
|
|
6201
6200
|
nz = x.nonzero()
|
|
6202
|
-
assert nz.
|
|
6201
|
+
assert nz.shape[0] == size
|
|
6203
6202
|
return nz
|
|
6204
6203
|
else:
|
|
6205
6204
|
|
|
@@ -6207,7 +6206,7 @@ else:
|
|
|
6207
6206
|
return x.nonzero_static(size=size)
|
|
6208
6207
|
|
|
6209
6208
|
|
|
6210
|
-
@
|
|
6209
|
+
@torch_compiler(fullgraph=False)
|
|
6211
6210
|
def _combine_similar_resps(resps: Tensor, keep_mask: Tensor, n_keep: int) -> Tensor:
|
|
6212
6211
|
n_discard = resps.shape[1] - n_keep
|
|
6213
6212
|
assert n_discard + n_keep == resps.shape[1]
|
|
@@ -6649,7 +6648,7 @@ def _sparsify_candidates(
|
|
|
6649
6648
|
# = | A (x'-z') |^2.
|
|
6650
6649
|
|
|
6651
6650
|
|
|
6652
|
-
@
|
|
6651
|
+
@torch_compiler(fullgraph=False)
|
|
6653
6652
|
def _calc_loglik_rank0(
|
|
6654
6653
|
*,
|
|
6655
6654
|
whitenedx: Tensor,
|
|
@@ -6669,7 +6668,7 @@ def _calc_loglik_rank0(
|
|
|
6669
6668
|
return ll
|
|
6670
6669
|
|
|
6671
6670
|
|
|
6672
|
-
@
|
|
6671
|
+
@torch_compiler(fullgraph=False)
|
|
6673
6672
|
def _calc_loglik_ppca(
|
|
6674
6673
|
*,
|
|
6675
6674
|
whitenedx: Tensor,
|
|
@@ -6777,7 +6776,7 @@ def _stat_pass_batch(
|
|
|
6777
6776
|
return stats
|
|
6778
6777
|
|
|
6779
6778
|
|
|
6780
|
-
@
|
|
6779
|
+
@torch_compiler(fullgraph=False)
|
|
6781
6780
|
def _count_batch(
|
|
6782
6781
|
*,
|
|
6783
6782
|
responsibilities: Tensor,
|
|
@@ -6812,7 +6811,7 @@ def _count_batch(
|
|
|
6812
6811
|
return noise_N, N, Nlut, Qnflat, Qnflatlut
|
|
6813
6812
|
|
|
6814
6813
|
|
|
6815
|
-
@
|
|
6814
|
+
@torch_compiler(fullgraph=False)
|
|
6816
6815
|
def _stat_pass_batch_ppca(
|
|
6817
6816
|
*,
|
|
6818
6817
|
xt: Tensor,
|
|
@@ -6931,7 +6930,7 @@ def _stat_pass_batch_ppca(
|
|
|
6931
6930
|
return noise_N, N, Nlut, Ulut, R, elb
|
|
6932
6931
|
|
|
6933
6932
|
|
|
6934
|
-
@
|
|
6933
|
+
@torch_compiler(fullgraph=False)
|
|
6935
6934
|
def _stat_pass_batch_rank0(
|
|
6936
6935
|
*,
|
|
6937
6936
|
xt: Tensor,
|
|
@@ -247,6 +247,8 @@ def _dartsort_impl(
|
|
|
247
247
|
sampling_cfg=cfg.peeler_sampling_cfg,
|
|
248
248
|
waveform_cfg=cfg.waveform_cfg,
|
|
249
249
|
overwrite=overwrite,
|
|
250
|
+
_save_cfg=cfg,
|
|
251
|
+
_save_dir=output_dir,
|
|
250
252
|
)
|
|
251
253
|
ret["motion"] = motion
|
|
252
254
|
|
|
@@ -285,7 +287,8 @@ def _dartsort_impl(
|
|
|
285
287
|
sampling_cfg=cfg.peeler_sampling_cfg,
|
|
286
288
|
waveform_cfg=cfg.waveform_cfg,
|
|
287
289
|
overwrite=overwrite,
|
|
288
|
-
|
|
290
|
+
_save_cfg=cfg,
|
|
291
|
+
_save_dir=output_dir,
|
|
289
292
|
)
|
|
290
293
|
ret["motion"] = motion
|
|
291
294
|
ds_save_motion(motion, output_dir, work_dir, overwrite)
|
|
@@ -58,6 +58,7 @@ from ...util.motion import MotionInfo
|
|
|
58
58
|
from ...util.noise_util import SpatialWhitener
|
|
59
59
|
from ...util.py_util import databag
|
|
60
60
|
from ...util.spiketorch import full_shared_pconv, shared_temporal_pconv
|
|
61
|
+
from ...util.torch_util import torch_compiler
|
|
61
62
|
from ...util.waveform_util import upsample_singlechan_torch
|
|
62
63
|
from .matching_base import (
|
|
63
64
|
ChunkTemplateData,
|
|
@@ -647,7 +648,7 @@ def get_interp_upsampling_data(
|
|
|
647
648
|
# -- convolution
|
|
648
649
|
|
|
649
650
|
|
|
650
|
-
@
|
|
651
|
+
@torch_compiler()
|
|
651
652
|
def convolve_lowrank_shared(
|
|
652
653
|
traces: Tensor,
|
|
653
654
|
spatial_singular: Tensor,
|
|
@@ -677,7 +678,7 @@ def convolve_lowrank_shared(
|
|
|
677
678
|
# -- fine matching
|
|
678
679
|
|
|
679
680
|
|
|
680
|
-
@
|
|
681
|
+
@torch_compiler(fullgraph=False)
|
|
681
682
|
def _upsampling_fine_match(
|
|
682
683
|
*,
|
|
683
684
|
conv: Tensor,
|
|
@@ -730,7 +731,6 @@ def _upsampling_fine_match(
|
|
|
730
731
|
# --
|
|
731
732
|
|
|
732
733
|
|
|
733
|
-
@torch.jit.script
|
|
734
734
|
def _subtract_templates_loop(
|
|
735
735
|
traces: Tensor,
|
|
736
736
|
up_inds: Tensor | None,
|
|
@@ -12,7 +12,7 @@ from ...util.logging_util import DARTSORTVERBOSE, get_logger
|
|
|
12
12
|
from ...util.motion import MotionInfo
|
|
13
13
|
from ...util.py_util import databag
|
|
14
14
|
from ...util.spiketorch import argrelmax_dedup, grab_spikes, ptp
|
|
15
|
-
from ...util.torch_util import BModule
|
|
15
|
+
from ...util.torch_util import BModule, torch_compiler
|
|
16
16
|
|
|
17
17
|
logger = get_logger(__name__)
|
|
18
18
|
_extra_checks = logger.isEnabledFor(DARTSORTVERBOSE)
|
|
@@ -534,7 +534,7 @@ def subtract_precomputed_pconv(
|
|
|
534
534
|
)
|
|
535
535
|
|
|
536
536
|
|
|
537
|
-
@
|
|
537
|
+
@torch_compiler(fullgraph=False)
|
|
538
538
|
def _subtract_precomputed_pconv_unscaled(
|
|
539
539
|
conv: Tensor,
|
|
540
540
|
pconv: Tensor,
|
|
@@ -557,7 +557,7 @@ def _subtract_precomputed_pconv_unscaled(
|
|
|
557
557
|
conv[i0:i1].scatter_add_(dim=1, src=batch, index=ix)
|
|
558
558
|
|
|
559
559
|
|
|
560
|
-
@
|
|
560
|
+
@torch_compiler(fullgraph=False)
|
|
561
561
|
def _subtract_precomputed_pconv_scaled(
|
|
562
562
|
conv: Tensor,
|
|
563
563
|
pconv: Tensor,
|
|
@@ -583,7 +583,7 @@ def _subtract_precomputed_pconv_scaled(
|
|
|
583
583
|
conv[i0:i1].scatter_add_(dim=1, src=batch, index=ix)
|
|
584
584
|
|
|
585
585
|
|
|
586
|
-
@
|
|
586
|
+
@torch_compiler()
|
|
587
587
|
def _free_coarse_objective(
|
|
588
588
|
conv: Tensor,
|
|
589
589
|
normsq: Tensor,
|
|
@@ -597,7 +597,7 @@ def _free_coarse_objective(
|
|
|
597
597
|
return obj
|
|
598
598
|
|
|
599
599
|
|
|
600
|
-
@
|
|
600
|
+
@torch_compiler()
|
|
601
601
|
def _scaled_coarse_objective(
|
|
602
602
|
conv: Tensor,
|
|
603
603
|
normsq: Tensor,
|
|
@@ -19,6 +19,7 @@ from ..util.job_util import ensure_computation_config
|
|
|
19
19
|
from ..util.logging_util import get_logger, progrange
|
|
20
20
|
from ..util.motion import MotionInfo
|
|
21
21
|
from ..util.spiketorch import ptp
|
|
22
|
+
from ..util.torch_util import torch_compile
|
|
22
23
|
from .templates import TemplateData
|
|
23
24
|
|
|
24
25
|
logger = get_logger(__name__)
|
|
@@ -96,7 +97,7 @@ def realign(
|
|
|
96
97
|
return aligned_sorting, templates
|
|
97
98
|
|
|
98
99
|
|
|
99
|
-
@
|
|
100
|
+
@torch_compile
|
|
100
101
|
def singlechan_alignments(
|
|
101
102
|
traces: torch.Tensor, trough_factor: float = 3.0, dim: int = 1
|
|
102
103
|
) -> torch.Tensor:
|
|
@@ -29,7 +29,7 @@ from ..util.internal_config import (
|
|
|
29
29
|
from ..util.interpolation_util import StableFeaturesInterpolator, pad_geom
|
|
30
30
|
from ..util.motion import MotionInfo
|
|
31
31
|
from ..util.multiprocessing_util import handle_negative_jobs
|
|
32
|
-
from ..util.torch_util import cleanup_and_log_gpu_usage
|
|
32
|
+
from ..util.torch_util import cleanup_and_log_gpu_usage, torch_compile
|
|
33
33
|
from .transform_base import BaseWaveformFeaturizer
|
|
34
34
|
|
|
35
35
|
if TYPE_CHECKING:
|
|
@@ -38,6 +38,7 @@ if TYPE_CHECKING:
|
|
|
38
38
|
|
|
39
39
|
class TruncatedMixtureModelTransformer(BaseWaveformFeaturizer):
|
|
40
40
|
"""Gaussian mixture clustering and classification as a featurization node."""
|
|
41
|
+
|
|
41
42
|
is_multi = True
|
|
42
43
|
needs_residual = True
|
|
43
44
|
fits_from_disk = True
|
|
@@ -430,7 +431,7 @@ def neighborhood_mapping_at_time(
|
|
|
430
431
|
return index, nid_map
|
|
431
432
|
|
|
432
433
|
|
|
433
|
-
@
|
|
434
|
+
@torch_compile
|
|
434
435
|
def _outer_all_equal(x: torch.Tensor, y: torch.Tensor):
|
|
435
436
|
dim = x.shape[1]
|
|
436
437
|
x = x[:, None, :]
|
|
@@ -436,7 +436,13 @@ class DARTsortSorting:
|
|
|
436
436
|
parent_h5_path=h5_path,
|
|
437
437
|
)
|
|
438
438
|
|
|
439
|
-
def save(
|
|
439
|
+
def save(
|
|
440
|
+
self,
|
|
441
|
+
sorting_npz: str | Path,
|
|
442
|
+
save_h5_path: bool = True,
|
|
443
|
+
pack_simple_features: bool = False,
|
|
444
|
+
pack_extra_features: Sequence[str] | None = None,
|
|
445
|
+
):
|
|
440
446
|
"""Save to npz (usually dartsort_sorting.npz)
|
|
441
447
|
|
|
442
448
|
Support persisting myself in non-h5-supportable cases
|
|
@@ -445,6 +451,18 @@ class DARTsortSorting:
|
|
|
445
451
|
- When I have new labels.
|
|
446
452
|
This is done by saving to .npz, with a pointer (like a relative symlink)
|
|
447
453
|
to the .h5 file if it exists.
|
|
454
|
+
|
|
455
|
+
Parameters
|
|
456
|
+
----------
|
|
457
|
+
sorting_npz: str or Path
|
|
458
|
+
Path to save to
|
|
459
|
+
save_h5_path: bool
|
|
460
|
+
Whether to save the pointer to the hdf5 file.
|
|
461
|
+
pack_simple_features: bool, optional
|
|
462
|
+
If true, "simple features" (ie, 1d ones) will be stored
|
|
463
|
+
in the npz.
|
|
464
|
+
pack_extra_features: Sequence[str], optional
|
|
465
|
+
Additional features to save directly in the npz.
|
|
448
466
|
"""
|
|
449
467
|
sorting_npz = ensure_path(sorting_npz)
|
|
450
468
|
logger.dartsortdebug(f"Saving {self} to {sorting_npz}.")
|
|
@@ -455,9 +473,10 @@ class DARTsortSorting:
|
|
|
455
473
|
)
|
|
456
474
|
if self.labels is not None:
|
|
457
475
|
data["labels"] = self.labels
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
476
|
+
if hasattr(self, "geom"):
|
|
477
|
+
data["geom"] = getattr(self, "geom")
|
|
478
|
+
do_hdf5 = save_h5_path and self.parent_h5_path is not None
|
|
479
|
+
if do_hdf5:
|
|
461
480
|
# path needs to be relative to npz path's parent in case user moves stuff
|
|
462
481
|
h5p = ensure_path(self.parent_h5_path, strict=True)
|
|
463
482
|
try:
|
|
@@ -471,10 +490,23 @@ class DARTsortSorting:
|
|
|
471
490
|
|
|
472
491
|
h5p = relpath(h5p, start=sorting_npz.parent)
|
|
473
492
|
data["parent_h5_path"] = np.array(str(h5p))
|
|
493
|
+
|
|
474
494
|
data.update(self._ephemeral_features)
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
495
|
+
eph_keys = list(self._ephemeral_features.keys())
|
|
496
|
+
for k in pack_extra_features or []:
|
|
497
|
+
data[k] = getattr(self, k)
|
|
498
|
+
eph_keys.append(k)
|
|
499
|
+
if pack_simple_features:
|
|
500
|
+
# ephemeral already stored so just need to check persistent
|
|
501
|
+
for k in self._persistent_features:
|
|
502
|
+
if k in data:
|
|
503
|
+
continue
|
|
504
|
+
v = getattr(self, k)
|
|
505
|
+
if 1 <= v.ndim <= 2 and v.shape[0] == self.times_samples.shape[0]:
|
|
506
|
+
data[k] = v
|
|
507
|
+
eph_keys.append(k)
|
|
508
|
+
|
|
509
|
+
data["ephemeral_feature_names"] = np.array(eph_keys)
|
|
478
510
|
data["loaded_persistent_features"] = np.array(
|
|
479
511
|
list(self._persistent_features.keys())
|
|
480
512
|
)
|
|
@@ -495,6 +527,8 @@ class DARTsortSorting:
|
|
|
495
527
|
channels = data["channels"]
|
|
496
528
|
labels = data.get("labels", None)
|
|
497
529
|
sampling_frequency = data["sampling_frequency"]
|
|
530
|
+
geom = data.get("geom", None)
|
|
531
|
+
|
|
498
532
|
if isinstance(sampling_frequency, np.ndarray):
|
|
499
533
|
sampling_frequency = sampling_frequency.item()
|
|
500
534
|
parent_h5_path = data.get("parent_h5_path", None)
|
|
@@ -504,7 +538,12 @@ class DARTsortSorting:
|
|
|
504
538
|
ephemeral_features = {k: data[k] for k in load_ephemeral_feature_names}
|
|
505
539
|
else:
|
|
506
540
|
ephemeral_features = {}
|
|
507
|
-
|
|
541
|
+
if geom is not None:
|
|
542
|
+
ephemeral_features["geom"] = geom
|
|
543
|
+
if parent_h5_path is not None:
|
|
544
|
+
loaded_persistent_features = data.get("loaded_persistent_features", [])
|
|
545
|
+
else:
|
|
546
|
+
loaded_persistent_features = []
|
|
508
547
|
|
|
509
548
|
if parent_h5_path is not None:
|
|
510
549
|
parent_h5_path = parent_h5_path.item()
|
|
@@ -758,7 +797,9 @@ def load(f: str | Path, labels_stem: str | None = None) -> DARTsortSorting:
|
|
|
758
797
|
raise ValueError(f"{labels_npy} does not exist.")
|
|
759
798
|
labels = np.load(labels_npy)
|
|
760
799
|
if not labels.shape == st.channels.shape:
|
|
761
|
-
raise ValueError(
|
|
800
|
+
raise ValueError(
|
|
801
|
+
f"{labels_npy} shape {labels.shape} does not match channels shape {st.channels.shape}."
|
|
802
|
+
)
|
|
762
803
|
|
|
763
804
|
st = st.ephemeral_replace(labels=labels)
|
|
764
805
|
|
|
@@ -1095,8 +1136,9 @@ def merged_responsibilities(
|
|
|
1095
1136
|
|
|
1096
1137
|
def explode_soft_assignment_sorting(
|
|
1097
1138
|
sorting: DARTsortSorting,
|
|
1098
|
-
responsibilities_key="
|
|
1099
|
-
candidates_key="
|
|
1139
|
+
responsibilities_key="merged_responsibilities",
|
|
1140
|
+
candidates_key="merged_candidates",
|
|
1141
|
+
needs_merge: bool = False,
|
|
1100
1142
|
) -> DARTsortSorting:
|
|
1101
1143
|
"""Convert a hard-assigned sorting to a soft-assigned one
|
|
1102
1144
|
|
|
@@ -1109,19 +1151,27 @@ def explode_soft_assignment_sorting(
|
|
|
1109
1151
|
|
|
1110
1152
|
t_s = cast(np.ndarray, getattr(sorting, "times_seconds"))
|
|
1111
1153
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1154
|
+
if needs_merge:
|
|
1155
|
+
mgr = merged_responsibilities(
|
|
1156
|
+
sorting,
|
|
1157
|
+
responsibilities_key=responsibilities_key,
|
|
1158
|
+
candidates_key=candidates_key,
|
|
1159
|
+
)
|
|
1160
|
+
mergedr = mgr["merged_responsibilities"]
|
|
1161
|
+
c = mgr["merged_candidates"]
|
|
1162
|
+
Klabel = mgr["K"]
|
|
1163
|
+
else:
|
|
1164
|
+
mergedr = getattr(sorting, responsibilities_key)
|
|
1165
|
+
c = getattr(sorting, candidates_key)
|
|
1166
|
+
mergedr = mergedr[:, : c.shape[1]]
|
|
1167
|
+
Klabel = c.max() + 1
|
|
1120
1168
|
|
|
1121
1169
|
h = entropy(torch.asarray(mergedr), reduce_mean=False).numpy()
|
|
1122
1170
|
|
|
1123
1171
|
# okay, having deduplicated, we are now ready to explode
|
|
1124
|
-
nz =
|
|
1172
|
+
nz = mergedr > 0
|
|
1173
|
+
nz = np.logical_and(nz, c < Klabel, out=nz)
|
|
1174
|
+
nz = np.logical_and(nz, c >= 0, out=nz)
|
|
1125
1175
|
spike_ix, candidate_ix = np.nonzero(nz)
|
|
1126
1176
|
|
|
1127
1177
|
reorder = np.argsort(sorting.times_samples[spike_ix], kind="stable")
|
|
@@ -9,7 +9,7 @@ import torch.nn.functional as F
|
|
|
9
9
|
from .data_util import yield_masked_chunks
|
|
10
10
|
from .internal_config import InterpolationParams, tps_interp_params
|
|
11
11
|
from .motion import MotionInfo
|
|
12
|
-
from .torch_util import BModule
|
|
12
|
+
from .torch_util import BModule, torch_compile
|
|
13
13
|
from .waveform_util import make_channel_index
|
|
14
14
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
@@ -579,20 +579,20 @@ def kriging_neighborhood_solve(
|
|
|
579
579
|
return out
|
|
580
580
|
|
|
581
581
|
|
|
582
|
-
@
|
|
582
|
+
@torch_compile
|
|
583
583
|
def _kneighb_loop(
|
|
584
584
|
features_padded_flat: torch.Tensor,
|
|
585
585
|
neighborhoods_padded: torch.Tensor,
|
|
586
586
|
neighb_solved: torch.Tensor,
|
|
587
587
|
):
|
|
588
588
|
out = features_padded_flat.new_empty(
|
|
589
|
-
(
|
|
589
|
+
(neighborhoods_padded.shape[0], features_padded_flat.shape[0])
|
|
590
590
|
)
|
|
591
591
|
for j in range(neighborhoods_padded.shape[0]):
|
|
592
592
|
neighb = neighborhoods_padded[j]
|
|
593
593
|
fj = features_padded_flat[:, neighb]
|
|
594
|
-
torch.mv(fj, neighb_solved[j], out=out[
|
|
595
|
-
return out
|
|
594
|
+
torch.mv(fj, neighb_solved[j], out=out[j])
|
|
595
|
+
return out.t().contiguous()
|
|
596
596
|
|
|
597
597
|
|
|
598
598
|
def kriging_poly_expand(
|
|
@@ -2,7 +2,7 @@ import json
|
|
|
2
2
|
import shutil
|
|
3
3
|
from dataclasses import asdict, replace
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import Sequence
|
|
5
|
+
from typing import TYPE_CHECKING, Sequence
|
|
6
6
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
from spikeinterface.core import BaseRecording
|
|
@@ -17,9 +17,11 @@ from ..util.internal_config import (
|
|
|
17
17
|
RefinementConfig,
|
|
18
18
|
)
|
|
19
19
|
from ..util.logging_util import get_logger
|
|
20
|
-
from ..util.motion import MotionInfo, try_load_motion_info
|
|
21
20
|
from ..util.py_util import dartcopy2, dartcopytree, ensure_path
|
|
22
21
|
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from ..util.motion import MotionInfo
|
|
24
|
+
|
|
23
25
|
logger = get_logger(__name__)
|
|
24
26
|
|
|
25
27
|
|
|
@@ -126,7 +128,7 @@ def ds_all_to_workdir(
|
|
|
126
128
|
|
|
127
129
|
|
|
128
130
|
def ds_save_motion(
|
|
129
|
-
motion: MotionInfo,
|
|
131
|
+
motion: "MotionInfo",
|
|
130
132
|
output_dir: Path,
|
|
131
133
|
work_dir: Path | None = None,
|
|
132
134
|
overwrite: bool = False,
|
|
@@ -205,18 +207,26 @@ def ds_handle_link_from(cfg: DARTsortInternalConfig, output_dir: Path):
|
|
|
205
207
|
|
|
206
208
|
|
|
207
209
|
def ds_save_features(
|
|
208
|
-
cfg: DARTsortInternalConfig,
|
|
210
|
+
cfg: DARTsortInternalConfig | None,
|
|
209
211
|
sorting: DARTsortSorting,
|
|
210
|
-
output_dir: Path,
|
|
212
|
+
output_dir: Path | None,
|
|
211
213
|
work_dir: Path | None = None,
|
|
212
214
|
is_final=False,
|
|
215
|
+
ensure_saving: bool | None = None,
|
|
213
216
|
):
|
|
214
217
|
if work_dir is None:
|
|
215
218
|
# nothing to copy
|
|
216
219
|
return
|
|
217
|
-
|
|
220
|
+
|
|
221
|
+
if ensure_saving is None:
|
|
222
|
+
assert cfg is not None
|
|
223
|
+
if not (cfg.save_intermediate_features or is_final):
|
|
224
|
+
return
|
|
225
|
+
elif not ensure_saving:
|
|
218
226
|
return
|
|
219
227
|
|
|
228
|
+
assert output_dir is not None
|
|
229
|
+
|
|
220
230
|
# find h5 and models and copy
|
|
221
231
|
assert sorting.parent_h5_path is not None
|
|
222
232
|
h5_path = ensure_path(sorting.parent_h5_path)
|
|
@@ -230,8 +240,10 @@ def ds_save_features(
|
|
|
230
240
|
if models_path.exists():
|
|
231
241
|
targ_models = output_dir / models_path.name
|
|
232
242
|
pconv_h5 = targ_models / "pconv.h5"
|
|
233
|
-
if cfg.matching_cfg.delete_pconv and pconv_h5.exists():
|
|
243
|
+
if cfg is not None and cfg.matching_cfg.delete_pconv and pconv_h5.exists():
|
|
234
244
|
pconv_h5.unlink()
|
|
245
|
+
elif cfg is None:
|
|
246
|
+
assert not pconv_h5.exists() # don't know what to do with it, pass cfg
|
|
235
247
|
logger.dartsortdebug(f"Copy intermediate {models_path=} -> {targ_models=}.")
|
|
236
248
|
dartcopytree(cfg, models_path, targ_models)
|
|
237
249
|
|
|
@@ -271,7 +283,7 @@ def ds_handle_delete_intermediate_features(
|
|
|
271
283
|
|
|
272
284
|
def ds_fast_forward(
|
|
273
285
|
store_dir: Path, cfg: DARTsortInternalConfig
|
|
274
|
-
) -> tuple[int, DARTsortSorting | None, MotionInfo | None]:
|
|
286
|
+
) -> "tuple[int, DARTsortSorting | None, MotionInfo | None]":
|
|
275
287
|
"""Fast-forward to the where sorting left off
|
|
276
288
|
|
|
277
289
|
# TODO: error if there is a saved cfg which differs? Maybe just optionally?
|
|
@@ -281,6 +293,8 @@ def ds_fast_forward(
|
|
|
281
293
|
next_step: int
|
|
282
294
|
cur_sorting: DARTsortSorting
|
|
283
295
|
"""
|
|
296
|
+
from .motion import try_load_motion_info
|
|
297
|
+
|
|
284
298
|
# this cur_h5 variable points to the peeling result we'll try to load
|
|
285
299
|
cur_h5 = sub_h5 = store_dir / "subtraction.h5"
|
|
286
300
|
cur_step = 0
|
|
@@ -15,6 +15,7 @@ if TYPE_CHECKING:
|
|
|
15
15
|
from .drift_util import get_pitch, registered_geometry
|
|
16
16
|
from .internal_config import (
|
|
17
17
|
ComputationConfig,
|
|
18
|
+
DARTsortInternalConfig,
|
|
18
19
|
FeaturizationConfig,
|
|
19
20
|
FitSamplingConfig,
|
|
20
21
|
MotionEstimationConfig,
|
|
@@ -57,7 +58,8 @@ def get_motion_info(
|
|
|
57
58
|
amplitudes_dataset_name="denoised_ptp_amplitudes",
|
|
58
59
|
overwrite: bool = False,
|
|
59
60
|
show_progress: bool = True,
|
|
60
|
-
|
|
61
|
+
_save_cfg: DARTsortInternalConfig | None = None,
|
|
62
|
+
_save_dir: Path | None = None,
|
|
61
63
|
) -> "MotionInfo":
|
|
62
64
|
"""Get a MotionInfo object by loading from disk, from SI/dredge, or by computing it
|
|
63
65
|
|
|
@@ -66,6 +68,8 @@ def get_motion_info(
|
|
|
66
68
|
motion based on the spike locations in the sorting object, using parameters
|
|
67
69
|
from motion_cfg.
|
|
68
70
|
"""
|
|
71
|
+
from .main_util import ds_save_features
|
|
72
|
+
|
|
69
73
|
if (motion := try_load_motion_info(output_directory, filename)) is not None:
|
|
70
74
|
return motion
|
|
71
75
|
|
|
@@ -76,6 +80,9 @@ def get_motion_info(
|
|
|
76
80
|
need_motion_estimate = motion_cfg.do_motion_estimation and not have_motion
|
|
77
81
|
|
|
78
82
|
# skip peak detection if possible
|
|
83
|
+
_saving_intermediates = (
|
|
84
|
+
_save_cfg is not None and _save_cfg.save_intermediate_features
|
|
85
|
+
)
|
|
79
86
|
need_new_peaks = detect_new_peaks and (
|
|
80
87
|
need_motion_estimate or _saving_intermediates
|
|
81
88
|
)
|
|
@@ -84,6 +91,7 @@ def get_motion_info(
|
|
|
84
91
|
assert sorting is not None
|
|
85
92
|
assert sampling_cfg is not None
|
|
86
93
|
assert waveform_cfg is not None
|
|
94
|
+
output_directory = ensure_path(output_directory)
|
|
87
95
|
motion_sorting = detect_for_motion(
|
|
88
96
|
output_directory=output_directory,
|
|
89
97
|
recording=recording,
|
|
@@ -95,6 +103,12 @@ def get_motion_info(
|
|
|
95
103
|
overwrite=overwrite,
|
|
96
104
|
show_progress=show_progress,
|
|
97
105
|
)
|
|
106
|
+
ds_save_features(
|
|
107
|
+
cfg=_save_cfg,
|
|
108
|
+
sorting=motion_sorting,
|
|
109
|
+
work_dir=output_directory,
|
|
110
|
+
output_dir=_save_dir,
|
|
111
|
+
)
|
|
98
112
|
else:
|
|
99
113
|
motion_sorting = sorting
|
|
100
114
|
|