DARTsort 0.5.28__tar.gz → 0.5.29__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.28 → dartsort-0.5.29}/.github/workflows/ci.yml +2 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/PKG-INFO +4 -4
- {dartsort-0.5.28 → dartsort-0.5.29}/environment.yml +1 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/pyproject.toml +3 -4
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/agglomerate.py +14 -4
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/cluster_util.py +3 -3
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/mixture.py +2 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/refine_util.py +14 -3
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/config.py +5 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/analysis.py +2 -1
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/hybridkit.py +1 -1
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/noise_recording_tools.py +2 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/localize/localize_util.py +1 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/_multichan_denoiser_kit.py +1 -1
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/mixture_classifier.py +38 -71
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/reduction.py +0 -3
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/data_util.py +8 -6
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/drift_util.py +1 -1
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/internal_config.py +5 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/multiprocessing_util.py +2 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/preprocess_util.py +3 -3
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/registration_util.py +22 -14
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/waveform_util.py +1 -1
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/mixture.py +11 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/unit.py +18 -4
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort.egg-info/PKG-INFO +4 -4
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort.egg-info/requires.txt +2 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_clustering.py +7 -3
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_drift_util.py +23 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_simkit.py +7 -2
- {dartsort-0.5.28 → dartsort-0.5.29}/.github/workflows/ci_windows.yml +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/.github/workflows/deploy.yml +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/.github/workflows/docs.yml +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/.gitignore +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/README.md +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/docs/index.md +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/docs/main_api.md +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/docs/toolkit_api.md +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/notebook/.keep +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/notebook/fit_and_batch_matching.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/notebook/ibl_dandi_example.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/setup.cfg +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/__main__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/cli.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/clustering.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/clustering_features.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/density.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/forward_backward.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/kmeans.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/clustering/merge.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/detect/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/detect/detect.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/comparison.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/hybrid_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/sim_template_tools.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/simkit.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/evaluate/simlib.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/localize/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/localize/localize_torch.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/main.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/grab.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/matching.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/matching_util/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/matching_util/compressed_upsampled.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/matching_util/drifty.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/matching_util/matching_base.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/matching_util/pairwise.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/matching_util/pairwise_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/peel_base.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/peel_lib.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/reduction_template.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/shaver.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/subtract.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/subtract_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/peel/threshold.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/default_temporal_kernel.npy +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/detect_np1.pt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/detect_np2.pt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/glasbey1024.npz +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/offset_trained_denoiser.pt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/offset_trained_denoiser_added_temp.pt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/offset_trained_denoiser_added_temp_boost.pt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/original_single_chan_denoiser.pt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/pretrained/single_chan_denoiser.pt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/templates/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/templates/get_templates.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/templates/postprocess_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/templates/realignment.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/templates/template_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/templates/templates.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/templates/templib.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/all_transformers.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/amortized_localization.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/amplitudes.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/decollider.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/denoising_scorer.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/enforce_decrease.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/fixed_prop.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/interp.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/localize.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/matched_filter_net.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/matching_denoiser.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/pipeline.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/single_channel_denoiser.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/supervised_denoiser.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/temporal_pca.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/transform_base.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/vq_matched_filter.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/transform/whiten.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/cli_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/interpolation_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/job_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/logging_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/main_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/more_operators.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/motion.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/nn_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/noise_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/peel_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/py_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/residual_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/sparse_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/spikeio.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/spiketorch.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/testing_util/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/testing_util/matching_debug_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/testing_util/mixture_testing_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/torch_optimization_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/util/torch_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/__init__.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/analysis_plots.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/colors.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/gt.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/layout.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/metrics_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/recanim.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/scatterplots.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/sorting.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/unit_comparison.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/versus.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/vismain.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort/vis/waveforms.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort.egg-info/SOURCES.txt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort.egg-info/dependency_links.txt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort.egg-info/entry_points.txt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/src/dartsort.egg-info/top_level.txt +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/conftest.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_agglomerate.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_alignment.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_cluster_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_clustering_features.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_config.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_dartsort.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_data_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_density.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_detect.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_drifty_matching.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_enforce_decrease.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_grab_and_featurize.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_hybridkit.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_kmeans.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_linalg.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_localize_torch.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_matching.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_mixture_classifier.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_modeling.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_spiketorch.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_subtract.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_templates.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_threshold.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_torch_optimization_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_transform.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/tests/test_waveform_util.py +0 -0
- {dartsort-0.5.28 → dartsort-0.5.29}/zensical.toml +0 -0
|
@@ -19,14 +19,14 @@ jobs:
|
|
|
19
19
|
|
|
20
20
|
steps:
|
|
21
21
|
- name: Checkout
|
|
22
|
-
uses: actions/checkout@
|
|
22
|
+
uses: actions/checkout@v7
|
|
23
23
|
with:
|
|
24
24
|
path: dartsort
|
|
25
25
|
|
|
26
26
|
- name: Fetch tags and describe
|
|
27
27
|
run: pushd dartsort/ && git fetch --prune --unshallow --tags && git describe && popd
|
|
28
28
|
|
|
29
|
-
- uses: actions/setup-python@
|
|
29
|
+
- uses: actions/setup-python@v7
|
|
30
30
|
with:
|
|
31
31
|
python-version: "3.x"
|
|
32
32
|
cache: "pip" # caching pip dependencies
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dartsort
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.29
|
|
4
4
|
Summary: DARTsort
|
|
5
5
|
Author-email: Charlie Windolf <ciw2048@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/cwindolf/dartsort
|
|
@@ -8,12 +8,11 @@ Project-URL: Bug Tracker, https://github.com/cwindolf/dartsort/issues
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: dredge-ephys
|
|
13
|
+
Requires-Dist: dredge-ephys>=0.4.0
|
|
14
14
|
Requires-Dist: h5py
|
|
15
15
|
Requires-Dist: jaxtyping
|
|
16
|
-
Requires-Dist: kdepy
|
|
17
16
|
Requires-Dist: linear_operator
|
|
18
17
|
Requires-Dist: numba
|
|
19
18
|
Requires-Dist: numpy>=1.20; python_version < "3.13"
|
|
@@ -37,6 +36,7 @@ Provides-Extra: test
|
|
|
37
36
|
Requires-Dist: pytest; extra == "test"
|
|
38
37
|
Requires-Dist: pytest-cov; extra == "test"
|
|
39
38
|
Provides-Extra: vis
|
|
39
|
+
Requires-Dist: kdepy; extra == "vis"
|
|
40
40
|
Requires-Dist: matplotlib; extra == "vis"
|
|
41
41
|
Requires-Dist: seaborn; extra == "vis"
|
|
42
42
|
Requires-Dist: matplotlib-venn; extra == "vis"
|
|
@@ -8,17 +8,16 @@ dynamic = ["version"]
|
|
|
8
8
|
authors = [{ name = "Charlie Windolf", email = "ciw2048@gmail.com" }]
|
|
9
9
|
description = "DARTsort"
|
|
10
10
|
readme = "README.md"
|
|
11
|
-
requires-python = ">=3.
|
|
11
|
+
requires-python = ">=3.12"
|
|
12
12
|
classifiers = [
|
|
13
13
|
"Programming Language :: Python :: 3",
|
|
14
14
|
"License :: OSI Approved :: MIT License",
|
|
15
15
|
"Operating System :: OS Independent",
|
|
16
16
|
]
|
|
17
17
|
dependencies = [
|
|
18
|
-
"dredge-ephys",
|
|
18
|
+
"dredge-ephys>=0.4.0",
|
|
19
19
|
"h5py",
|
|
20
20
|
"jaxtyping",
|
|
21
|
-
"kdepy",
|
|
22
21
|
"linear_operator",
|
|
23
22
|
"numba",
|
|
24
23
|
"numpy>=1.20;python_version<'3.13'",
|
|
@@ -40,7 +39,7 @@ dependencies = [
|
|
|
40
39
|
[project.optional-dependencies]
|
|
41
40
|
doc = ["zensical", "mkdocstrings-python"]
|
|
42
41
|
test = ["pytest", "pytest-cov"]
|
|
43
|
-
vis = ["matplotlib", "seaborn", "matplotlib-venn"]
|
|
42
|
+
vis = ["kdepy", "matplotlib", "seaborn", "matplotlib-venn"]
|
|
44
43
|
|
|
45
44
|
[project.urls]
|
|
46
45
|
"Homepage" = "https://github.com/cwindolf/dartsort"
|
|
@@ -6,9 +6,15 @@ from typing import cast
|
|
|
6
6
|
import numba
|
|
7
7
|
import numpy as np
|
|
8
8
|
import torch
|
|
9
|
-
from KDEpy import FFTKDE
|
|
10
9
|
from spikeinterface.core import BaseRecording
|
|
11
10
|
|
|
11
|
+
try:
|
|
12
|
+
import KDEpy
|
|
13
|
+
|
|
14
|
+
HAVE_KDEPY = True
|
|
15
|
+
except ImportError:
|
|
16
|
+
HAVE_KDEPY = False
|
|
17
|
+
|
|
12
18
|
from ..templates.template_util import shared_basis_compress_templates
|
|
13
19
|
from ..templates.templates import TemplateData
|
|
14
20
|
from ..util.data_util import (
|
|
@@ -479,6 +485,8 @@ def qda(
|
|
|
479
485
|
) -> QDAResult:
|
|
480
486
|
from ..util.data_util import get_gmm_scores
|
|
481
487
|
|
|
488
|
+
assert HAVE_KDEPY or not bimodality
|
|
489
|
+
|
|
482
490
|
# reconstruct scores from sorting attached data (exclude train_ix?)
|
|
483
491
|
gscores = get_gmm_scores(sorting)
|
|
484
492
|
glabels = sorting.labels
|
|
@@ -597,6 +605,8 @@ def _qda_job(ij):
|
|
|
597
605
|
assert np.isclose(binc[bc], 0.0)
|
|
598
606
|
assert binc.shape[0] == 2 * bc + 1
|
|
599
607
|
|
|
608
|
+
from KDEpy import FFTKDE
|
|
609
|
+
|
|
600
610
|
try:
|
|
601
611
|
kde = FFTKDE(bw="ISJ").fit(dll)
|
|
602
612
|
except ValueError as e:
|
|
@@ -807,7 +817,7 @@ def _check_soft_assign_invariants(
|
|
|
807
817
|
maxdiff = -np.inf
|
|
808
818
|
n_neginf_viol = 0
|
|
809
819
|
|
|
810
|
-
for s in numba.prange(cand.shape[0]):
|
|
820
|
+
for s in numba.prange(cand.shape[0]):
|
|
811
821
|
for j in range(n_cand):
|
|
812
822
|
if cand[s, j] < 0:
|
|
813
823
|
nbye += 1
|
|
@@ -827,7 +837,7 @@ def _assign_labels(
|
|
|
827
837
|
n_changed = 0
|
|
828
838
|
n_labeled = 0
|
|
829
839
|
|
|
830
|
-
for s in numba.prange(cand.shape[0]):
|
|
840
|
+
for s in numba.prange(cand.shape[0]):
|
|
831
841
|
if labels[s] >= 0:
|
|
832
842
|
n_labeled += 1
|
|
833
843
|
if labels[s] != cand[s, 0]:
|
|
@@ -846,7 +856,7 @@ def _combine_loop(
|
|
|
846
856
|
):
|
|
847
857
|
n_cand = cand.shape[1]
|
|
848
858
|
|
|
849
|
-
for s in numba.prange(cand.shape[0]):
|
|
859
|
+
for s in numba.prange(cand.shape[0]):
|
|
850
860
|
spike_cand = cand[s]
|
|
851
861
|
for j in range(n_cand - 1):
|
|
852
862
|
spike_candj = spike_cand[j]
|
|
@@ -121,7 +121,7 @@ def merge_group_shifts(
|
|
|
121
121
|
|
|
122
122
|
@numba.njit(nogil=True, parallel=True)
|
|
123
123
|
def apply_time_shifts(times: np.ndarray, labels: np.ndarray, unit_shifts: np.ndarray):
|
|
124
|
-
for i in numba.prange(times.shape[0]):
|
|
124
|
+
for i in numba.prange(times.shape[0]):
|
|
125
125
|
label = labels[i]
|
|
126
126
|
if label >= 0:
|
|
127
127
|
times[i] -= unit_shifts[label]
|
|
@@ -867,7 +867,7 @@ def _violation_count_matrix(
|
|
|
867
867
|
n = times.shape[0]
|
|
868
868
|
|
|
869
869
|
# parallelize over chunks
|
|
870
|
-
for c in numba.prange(starts.shape[0] - 1):
|
|
870
|
+
for c in numba.prange(starts.shape[0] - 1):
|
|
871
871
|
out = counts[c] # my thread's output buffer
|
|
872
872
|
|
|
873
873
|
for i in range(starts[c], starts[c + 1]):
|
|
@@ -904,7 +904,7 @@ def _violation_weight_matrix(
|
|
|
904
904
|
window_length = weights.shape[0] - 1
|
|
905
905
|
|
|
906
906
|
# parallelize over chunks
|
|
907
|
-
for c in numba.prange(starts.shape[0] - 1):
|
|
907
|
+
for c in numba.prange(starts.shape[0] - 1):
|
|
908
908
|
out = sums[c] # my thread's output buffer
|
|
909
909
|
|
|
910
910
|
for i in range(starts[c], starts[c + 1]):
|
|
@@ -7598,7 +7598,7 @@ def _update_lut_mean_batch(
|
|
|
7598
7598
|
|
|
7599
7599
|
# constplogdet. add in the signal-rank-0-only terms.
|
|
7600
7600
|
lut_params.constplogdet[i0:i1] = neighb_cov.nobs[nn].mul_(LOG_2PI) # type: ignore # ty: ignore[x]
|
|
7601
|
-
lut_params.constplogdet[i0:i1] += neighb_cov.b.logdet[nn]
|
|
7601
|
+
lut_params.constplogdet[i0:i1] += neighb_cov.b.logdet[nn] # ty: ignore[not-subscriptable]
|
|
7602
7602
|
if pnoid:
|
|
7603
7603
|
assert lut_params.constplogdet[i0:i1].isfinite().all() # type: ignore # ty: ignore[x]
|
|
7604
7604
|
|
|
@@ -7658,7 +7658,7 @@ def _update_lut_ppca_batch(
|
|
|
7658
7658
|
assert lut_params.Tpad is not None
|
|
7659
7659
|
lut_params.Tpad[i0:i1, :, :-1] = T # type: ignore # ty: ignore[x]
|
|
7660
7660
|
cap_logdet = L.diagonal(dim1=-2, dim2=-1).log().sum(dim=1).mul_(2.0)
|
|
7661
|
-
lut_params.constplogdet[i0:i1] += cap_logdet
|
|
7661
|
+
lut_params.constplogdet[i0:i1] += cap_logdet # ty: ignore[not-subscriptable]
|
|
7662
7662
|
if pnoid:
|
|
7663
7663
|
assert lut_params.b.constplogdet[i0:i1].isfinite().all()
|
|
7664
7664
|
|
|
@@ -4,12 +4,17 @@ from typing import cast
|
|
|
4
4
|
import numba
|
|
5
5
|
import numpy as np
|
|
6
6
|
import torch
|
|
7
|
-
from KDEpy import FFTKDE
|
|
8
|
-
from KDEpy.bw_selection import improved_sheather_jones
|
|
9
7
|
from scipy.spatial import KDTree
|
|
10
8
|
from scipy.stats import norm
|
|
11
9
|
from spikeinterface.core.baserecording import BaseRecording
|
|
12
10
|
|
|
11
|
+
try:
|
|
12
|
+
import KDEpy
|
|
13
|
+
|
|
14
|
+
HAVE_KDEPY = True
|
|
15
|
+
except ImportError:
|
|
16
|
+
HAVE_KDEPY = False
|
|
17
|
+
|
|
13
18
|
from dartsort.clustering.mixture import Scores
|
|
14
19
|
|
|
15
20
|
from ..util import data_util, spiketorch
|
|
@@ -392,7 +397,9 @@ def collision_cleaning_error_filter(
|
|
|
392
397
|
assert flag_scores.excess_rate is not None
|
|
393
398
|
flag_bad |= flag_scores.excess_rate > refinement_cfg.cc_flag_excess_rate
|
|
394
399
|
|
|
395
|
-
logger.dartsortdebug(
|
|
400
|
+
logger.dartsortdebug(
|
|
401
|
+
f"CC flag criterion dropped {flag_bad.sum()} / {nu0} units."
|
|
402
|
+
)
|
|
396
403
|
keep_mask &= np.logical_not(flag_bad)
|
|
397
404
|
|
|
398
405
|
bad_ids = np.flatnonzero(np.logical_not(keep_mask))
|
|
@@ -646,6 +653,7 @@ def gmm_isolation_scores(
|
|
|
646
653
|
kde_rhs=50.0,
|
|
647
654
|
kde_dx: float = 0.5,
|
|
648
655
|
) -> GMMIsolationScores:
|
|
656
|
+
assert HAVE_KDEPY
|
|
649
657
|
if unit_ids is None:
|
|
650
658
|
unit_ids = np.arange(scores.candidates[:, 0].max().item() + 1)
|
|
651
659
|
assert unit_ids is not None
|
|
@@ -761,6 +769,9 @@ def _iso_job(unit_id) -> tuple[float, np.ndarray | None, np.ndarray | None]:
|
|
|
761
769
|
# fit kde. will symmetrize around 0 to avoid boundary issues (since lr>=0)
|
|
762
770
|
amax = in_lr.abs().amax().item()
|
|
763
771
|
lr = in_lr.double().numpy(force=True)
|
|
772
|
+
from KDEpy import FFTKDE
|
|
773
|
+
from KDEpy.bw_selection import improved_sheather_jones
|
|
774
|
+
|
|
764
775
|
try:
|
|
765
776
|
# select bandwidth based on positive part
|
|
766
777
|
bw = improved_sheather_jones(lr[:, None])
|
|
@@ -10,6 +10,7 @@ from .util.internal_config import (
|
|
|
10
10
|
KmeansppSelection,
|
|
11
11
|
KmeansppStopping,
|
|
12
12
|
MixtureStep,
|
|
13
|
+
MotionBatchingMode,
|
|
13
14
|
PreprocessingStrategy,
|
|
14
15
|
RealignStrategy,
|
|
15
16
|
TemplateSVDMethod,
|
|
@@ -250,6 +251,10 @@ class DARTsortUserConfig:
|
|
|
250
251
|
max_dist_from_median_um: float = 250.0
|
|
251
252
|
"""Motion bins farther than this from the local median will be replaced by interpolation."""
|
|
252
253
|
median_neighborhood_bins: int = 51
|
|
254
|
+
motion_batching_mode: MotionBatchingMode = "full"
|
|
255
|
+
"""'full' or 'online'. Online helps with long recordings."""
|
|
256
|
+
motion_chunk_len_s: Annotated[float, Field(gt=0)] = 3000.0
|
|
257
|
+
"""Chunk length in seconds for online motion tracking"""
|
|
253
258
|
|
|
254
259
|
# -- pipeline control parameters for specific use cases
|
|
255
260
|
fit_matching_models_only: bool = False
|
|
@@ -16,7 +16,7 @@ import spikeinterface.core as sc
|
|
|
16
16
|
import torch
|
|
17
17
|
from sklearn.decomposition import PCA
|
|
18
18
|
|
|
19
|
-
from ..clustering.agglomerate import QDAResult, qda, template_distances
|
|
19
|
+
from ..clustering.agglomerate import HAVE_KDEPY, QDAResult, qda, template_distances
|
|
20
20
|
from ..templates import TemplateData
|
|
21
21
|
from ..util import job_util, logging_util
|
|
22
22
|
from ..util.data_util import (
|
|
@@ -193,6 +193,7 @@ class DARTsortAnalysis:
|
|
|
193
193
|
|
|
194
194
|
if (
|
|
195
195
|
allow_qda
|
|
196
|
+
and HAVE_KDEPY
|
|
196
197
|
and template_data is not None
|
|
197
198
|
and hasattr(sorting, "gmm_candidates")
|
|
198
199
|
):
|
|
@@ -135,7 +135,7 @@ def make_hybrid_recording(
|
|
|
135
135
|
assert target_recording.get_num_segments() == 1
|
|
136
136
|
assert injected_sorting.get_num_segments() == 1
|
|
137
137
|
if hasattr(injected_sorting, "get_last_spike_frame"):
|
|
138
|
-
assert injected_sorting.get_last_spike_frame() < target_recording.get_num_frames()
|
|
138
|
+
assert injected_sorting.get_last_spike_frame() < target_recording.get_num_frames()
|
|
139
139
|
assert abs(templates.sampling_frequency - target_sampling_frequency) < 10
|
|
140
140
|
|
|
141
141
|
if folder is not None and not overwrite:
|
|
@@ -71,7 +71,7 @@ def get_background_recording(
|
|
|
71
71
|
spatial_std, spatial_vt = rbf_kernel_sqrt(
|
|
72
72
|
geom, bandwidth=noise_spatial_kernel_bandwidth
|
|
73
73
|
)
|
|
74
|
-
noise_temporal_kernel = noise_temporal_kernel.astype(spatial_vt.dtype) + 0j
|
|
74
|
+
noise_temporal_kernel = noise_temporal_kernel.astype(spatial_vt.dtype) + 0j
|
|
75
75
|
noise = StationaryFactorizedNoise(
|
|
76
76
|
spatial_std=spatial_std,
|
|
77
77
|
vt_spatial=spatial_vt,
|
|
@@ -119,7 +119,7 @@ class WhiteNoiseRecording(BaseRecording):
|
|
|
119
119
|
channel_ids = np.asarray(channel_ids)
|
|
120
120
|
assert channel_ids.shape == (n_channels,)
|
|
121
121
|
assert n_segments == 1
|
|
122
|
-
super().__init__(sampling_frequency, channel_ids=channel_ids, dtype=dtype)
|
|
122
|
+
super().__init__(sampling_frequency, channel_ids=channel_ids, dtype=dtype)
|
|
123
123
|
self._serializability["json"] = False
|
|
124
124
|
self._serializability["pickle"] = False
|
|
125
125
|
segment = WhiteNoiseRecordingSegment(
|
|
@@ -21,7 +21,6 @@ def localize_waveforms(
|
|
|
21
21
|
radius=None,
|
|
22
22
|
n_channels_subset=None,
|
|
23
23
|
):
|
|
24
|
-
C, dim = geom.shape
|
|
25
24
|
amp_vecs = ptp(waveforms, 1)
|
|
26
25
|
if main_channels is None:
|
|
27
26
|
main_channels = amp_vecs.argmax(1)
|
|
@@ -287,7 +286,7 @@ def point_source_mse(locs, amp_vecs, channels, channel_index, geom):
|
|
|
287
286
|
torch.asarray(amp_vecs).nan_to_num(),
|
|
288
287
|
channel_mask,
|
|
289
288
|
*torch.asarray(locs).T,
|
|
290
|
-
torch.asarray(dxz).nan_to_num(),
|
|
289
|
+
torch.asarray(dxz).nan_to_num(), # ty: ignore[too-many-positional-arguments]
|
|
291
290
|
)
|
|
292
291
|
alpha = alpha.numpy()
|
|
293
292
|
else:
|
|
@@ -353,7 +353,7 @@ def get_noise_h5(
|
|
|
353
353
|
|
|
354
354
|
@numba.njit(parallel=True)
|
|
355
355
|
def take_along_dim2_masked(arr, out, channels, mask_val):
|
|
356
|
-
for i in numba.prange(arr.shape[0]):
|
|
356
|
+
for i in numba.prange(arr.shape[0]):
|
|
357
357
|
wf = arr[i]
|
|
358
358
|
cc = channels[i]
|
|
359
359
|
for t in range(arr.shape[1]):
|
|
@@ -159,24 +159,9 @@ class TruncatedMixtureModelTransformer(BaseWaveformFeaturizer):
|
|
|
159
159
|
cii, cjj = np.nonzero(self.channel_index_np < len(self.channel_index_np))
|
|
160
160
|
self.channel_index_valid_inds = cii, cjj
|
|
161
161
|
|
|
162
|
-
# precompute drifting neighborhood lookup tables
|
|
163
162
|
if self.motion.drifting:
|
|
164
|
-
# in this case, prebake a lookup table
|
|
165
|
-
# TODO just consider relevant time bins here?
|
|
166
|
-
# or chunk this somehow?
|
|
167
|
-
tbs = self.motion.time_bins_s
|
|
168
|
-
tcm_t, nid_t = neighborhood_mapping_at_time(
|
|
169
|
-
motion=self.motion,
|
|
170
|
-
t_s=torch.from_numpy(tbs),
|
|
171
|
-
neighborhoods=self.b.neighborhoods,
|
|
172
|
-
channel_index=self.channel_index_np,
|
|
173
|
-
workers=self.workers,
|
|
174
|
-
static_neighbs=self.static_neighbs,
|
|
175
|
-
channel_index_valid_inds=self.channel_index_valid_inds,
|
|
176
|
-
)
|
|
177
163
|
nid_map = None
|
|
178
164
|
else:
|
|
179
|
-
tcm_t = nid_t = tbs = None
|
|
180
165
|
# in this case, channel index is a superset of neighborhoods and
|
|
181
166
|
# we prebake the mapping from chans to neighb ids
|
|
182
167
|
ci_eq_neighb = _outer_all_equal(
|
|
@@ -193,13 +178,6 @@ class TruncatedMixtureModelTransformer(BaseWaveformFeaturizer):
|
|
|
193
178
|
)
|
|
194
179
|
nid_map[_chans] = _chan_nids
|
|
195
180
|
self.register_buffer_or_none("neighborhood_ids_map", nid_map)
|
|
196
|
-
self.drifting_time_bins_s = tbs
|
|
197
|
-
self.register_buffer_or_none(
|
|
198
|
-
"drifting_target_channels_map_t", tcm_t, persistent=False
|
|
199
|
-
)
|
|
200
|
-
self.register_buffer_or_none(
|
|
201
|
-
"drifting_neighborhood_ids_map_t", nid_t, persistent=False
|
|
202
|
-
)
|
|
203
181
|
|
|
204
182
|
def fit(
|
|
205
183
|
self,
|
|
@@ -360,10 +338,21 @@ class TruncatedMixtureModelTransformer(BaseWaveformFeaturizer):
|
|
|
360
338
|
# drifting channel mapping
|
|
361
339
|
assert self.motion is not None
|
|
362
340
|
if self.motion.drifting:
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
341
|
+
time_bins_s = self.motion.time_bins_s
|
|
342
|
+
t_bin_s = time_bins_s[find_nearest(time_bins_s, chunk_center_s)]
|
|
343
|
+
depths_um = self.motion.geom[:, 1]
|
|
344
|
+
_, n_pitches_shift = self.motion.pitch_shifts(
|
|
345
|
+
times_s=np.full_like(depths_um, t_bin_s), depths_um=depths_um
|
|
346
|
+
)
|
|
347
|
+
target_channels_map, neighborhood_ids_map = neighborhood_mapping_at_shift(
|
|
348
|
+
self.motion,
|
|
349
|
+
n_pitches_shift=n_pitches_shift,
|
|
350
|
+
channel_index=self.channel_index_np,
|
|
351
|
+
neighborhoods=self.b.neighborhoods,
|
|
352
|
+
static_neighbs=self.static_neighbs,
|
|
353
|
+
channel_index_valid_inds=self.channel_index_valid_inds,
|
|
354
|
+
workers=self.workers,
|
|
355
|
+
)
|
|
367
356
|
else:
|
|
368
357
|
target_channels_map = self.b.channel_index
|
|
369
358
|
neighborhood_ids_map = self.b.neighborhood_ids_map
|
|
@@ -411,59 +400,37 @@ class TruncatedMixtureModelTransformer(BaseWaveformFeaturizer):
|
|
|
411
400
|
return res
|
|
412
401
|
|
|
413
402
|
|
|
414
|
-
def
|
|
403
|
+
def neighborhood_mapping_at_shift(
|
|
415
404
|
motion: MotionInfo,
|
|
416
405
|
*,
|
|
417
|
-
|
|
406
|
+
n_pitches_shift: np.ndarray,
|
|
418
407
|
channel_index: np.ndarray,
|
|
419
408
|
neighborhoods: torch.Tensor,
|
|
420
|
-
workers: int = 4,
|
|
421
|
-
shift_mode="round",
|
|
422
409
|
static_neighbs: np.ndarray,
|
|
423
410
|
channel_index_valid_inds: tuple[np.ndarray, np.ndarray],
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
411
|
+
workers: int = 4,
|
|
412
|
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
413
|
+
"""Map channels to registered target channels and neighborhood ids"""
|
|
414
|
+
shifted_neighbs = static_neighbs.copy()
|
|
415
|
+
shifted_neighbs[:, :, 1] += n_pitches_shift[:, None] * motion.pitch
|
|
416
|
+
_, umatch = motion.rgeom_kdt.query(
|
|
417
|
+
shifted_neighbs[channel_index_valid_inds],
|
|
418
|
+
distance_upper_bound=motion.min_dist,
|
|
419
|
+
workers=workers,
|
|
433
420
|
)
|
|
421
|
+
index = np.full(channel_index.shape, motion.rgeom.shape[0])
|
|
422
|
+
index[channel_index_valid_inds] = umatch
|
|
423
|
+
index = torch.asarray(index, device=neighborhoods.device)
|
|
424
|
+
assert index.shape[1] == neighborhoods.shape[1]
|
|
425
|
+
|
|
426
|
+
mapping = _outer_all_equal(index, neighborhoods)
|
|
427
|
+
_chans, _chan_nids = mapping.nonzero(as_tuple=True)
|
|
428
|
+
nids = torch.full(
|
|
429
|
+
(channel_index.shape[0],), neighborhoods.shape[0], device=neighborhoods.device
|
|
430
|
+
)
|
|
431
|
+
nids[_chans] = _chan_nids
|
|
434
432
|
|
|
435
|
-
|
|
436
|
-
probe_disp = -motion.disp_at_s(
|
|
437
|
-
times_s=t, depths_um=motion.geom[:, 1], grid=True
|
|
438
|
-
)
|
|
439
|
-
if shift_mode == "floor":
|
|
440
|
-
n_pitches_shift = (probe_disp / motion.pitch).astype(np.int32)
|
|
441
|
-
elif shift_mode == "round":
|
|
442
|
-
n_pitches_shift = np.round(probe_disp / motion.pitch).astype(np.int32)
|
|
443
|
-
else:
|
|
444
|
-
panic(shift_mode)
|
|
445
|
-
shift = n_pitches_shift * motion.pitch
|
|
446
|
-
shifted_neighbs = static_neighbs.copy()
|
|
447
|
-
shifted_neighbs[:, :, 1] += shift
|
|
448
|
-
_, umatch = motion.rgeom_kdt.query(
|
|
449
|
-
shifted_neighbs[channel_index_valid_inds],
|
|
450
|
-
distance_upper_bound=motion.min_dist,
|
|
451
|
-
workers=workers,
|
|
452
|
-
)
|
|
453
|
-
index = np.full(channel_index.shape, motion.rgeom.shape[0])
|
|
454
|
-
index[channel_index_valid_inds] = umatch
|
|
455
|
-
index = torch.asarray(index, device=neighborhoods.device)
|
|
456
|
-
assert index.shape[1] == neighborhoods.shape[1]
|
|
457
|
-
|
|
458
|
-
index_at_time[j] = index
|
|
459
|
-
|
|
460
|
-
mapping = _outer_all_equal(index, neighborhoods)
|
|
461
|
-
_chans, _chan_nids = mapping.nonzero(as_tuple=True)
|
|
462
|
-
nids_at_time[j, _chans] = _chan_nids
|
|
463
|
-
|
|
464
|
-
assert (index_at_time >= 0).all()
|
|
465
|
-
|
|
466
|
-
return index_at_time, nids_at_time
|
|
433
|
+
return index, nids
|
|
467
434
|
|
|
468
435
|
|
|
469
436
|
@torch_compile
|
|
@@ -176,7 +176,6 @@ class TemplateWaveformReducer(BaseWaveformFeaturizer):
|
|
|
176
176
|
mean = np.nan_to_num(mean, copy=False)
|
|
177
177
|
return count, mean, std
|
|
178
178
|
finally:
|
|
179
|
-
global _reduction_stuff
|
|
180
179
|
_reduction_stuff.ctx = None
|
|
181
180
|
|
|
182
181
|
def _initialize(self, wf_shape: tuple[int, int]):
|
|
@@ -221,7 +220,6 @@ def _reduction_init(
|
|
|
221
220
|
dev: torch.device,
|
|
222
221
|
do_std: bool,
|
|
223
222
|
):
|
|
224
|
-
global _reduction_stuff
|
|
225
223
|
|
|
226
224
|
labels = torch.asarray(labels, dtype=torch.int32, device=dev)
|
|
227
225
|
|
|
@@ -249,7 +247,6 @@ def _reduction_init(
|
|
|
249
247
|
|
|
250
248
|
|
|
251
249
|
def _reduction_job(j: int) -> _ReductionResult | None:
|
|
252
|
-
global _reduction_stuff
|
|
253
250
|
p = cast(_ReductionStuff, _reduction_stuff.ctx)
|
|
254
251
|
(inu,) = (p.labels == j).nonzero(as_tuple=True)
|
|
255
252
|
inu = inu.cpu()
|
|
@@ -750,7 +750,7 @@ class DARTsortSorting:
|
|
|
750
750
|
# path needs to be relative to npz path's parent in case user moves stuff
|
|
751
751
|
h5p = ensure_path(self.parent_h5_path, strict=True)
|
|
752
752
|
try:
|
|
753
|
-
h5p = h5p.relative_to(sorting_npz.parent, walk_up=True)
|
|
753
|
+
h5p = h5p.relative_to(sorting_npz.parent, walk_up=True)
|
|
754
754
|
except TypeError:
|
|
755
755
|
try:
|
|
756
756
|
h5p = h5p.relative_to(sorting_npz.parent)
|
|
@@ -1096,7 +1096,9 @@ class DARTsortSorting:
|
|
|
1096
1096
|
yield chunk
|
|
1097
1097
|
|
|
1098
1098
|
def slice_feature_by_name(
|
|
1099
|
-
self,
|
|
1099
|
+
self,
|
|
1100
|
+
dataset_name: str,
|
|
1101
|
+
mask: np.ndarray | slice = slice(None),
|
|
1100
1102
|
) -> np.ndarray:
|
|
1101
1103
|
if hasattr(self, dataset_name):
|
|
1102
1104
|
return getattr(self, dataset_name)[mask]
|
|
@@ -2395,7 +2397,7 @@ def _gmm_remap_on_disk(
|
|
|
2395
2397
|
def vacuum_neg_candidate_prob(
|
|
2396
2398
|
n_units: int, cand: np.ndarray, resp: np.ndarray, loglik: np.ndarray
|
|
2397
2399
|
):
|
|
2398
|
-
for s in numba.prange(cand.shape[0]):
|
|
2400
|
+
for s in numba.prange(cand.shape[0]):
|
|
2399
2401
|
spike_cand = cand[s]
|
|
2400
2402
|
# vacuum into noise component
|
|
2401
2403
|
# this is partly to handle stuff that was missed before getting here
|
|
@@ -2449,7 +2451,7 @@ def _pos_int_counts(x: np.ndarray) -> tuple[np.ndarray, int]:
|
|
|
2449
2451
|
# Create an isolated accumulation space for every thread
|
|
2450
2452
|
tcounts = np.zeros((num_threads, K), dtype=np.int64)
|
|
2451
2453
|
neg_count = 0
|
|
2452
|
-
for i in numba.prange(x.shape[0]):
|
|
2454
|
+
for i in numba.prange(x.shape[0]):
|
|
2453
2455
|
xi = x[i]
|
|
2454
2456
|
if xi < 0:
|
|
2455
2457
|
neg_count += 1
|
|
@@ -2475,7 +2477,7 @@ def flatten_remapping(units: np.ndarray, K: int | None = None) -> np.ndarray:
|
|
|
2475
2477
|
@numba.njit(nogil=True, parallel=True)
|
|
2476
2478
|
def count_not_sorted(x: np.ndarray) -> int:
|
|
2477
2479
|
count = 0
|
|
2478
|
-
for i in numba.prange(x.shape[0] - 1):
|
|
2480
|
+
for i in numba.prange(x.shape[0] - 1):
|
|
2479
2481
|
if x[i] > x[i + 1]:
|
|
2480
2482
|
count += 1
|
|
2481
2483
|
return count
|
|
@@ -2515,7 +2517,7 @@ def apply_label_remapping_in_place(
|
|
|
2515
2517
|
def _apply_remapping_and_count_over(labels: np.ndarray, remapping: np.ndarray) -> int:
|
|
2516
2518
|
over_count = 0
|
|
2517
2519
|
K = remapping.shape[0]
|
|
2518
|
-
for i in numba.prange(labels.shape[0]):
|
|
2520
|
+
for i in numba.prange(labels.shape[0]):
|
|
2519
2521
|
li = labels[i]
|
|
2520
2522
|
if li < 0:
|
|
2521
2523
|
continue
|
|
@@ -27,8 +27,8 @@ by integer numbers of pitches. As many shifted copies are created
|
|
|
27
27
|
as needed to capture all the drift.
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
|
+
from collections.abc import Sequence
|
|
30
31
|
from dataclasses import dataclass
|
|
31
|
-
from typing import Sequence
|
|
32
32
|
|
|
33
33
|
import numpy as np
|
|
34
34
|
import torch
|
|
@@ -856,6 +856,9 @@ class MatchingConfig:
|
|
|
856
856
|
delete_pconv: bool = True
|
|
857
857
|
|
|
858
858
|
|
|
859
|
+
MotionBatchingMode = Literal["full", "online"]
|
|
860
|
+
|
|
861
|
+
|
|
859
862
|
@cfg_dataclass
|
|
860
863
|
class MotionEstimationConfig:
|
|
861
864
|
"""Configure motion estimation."""
|
|
@@ -863,6 +866,8 @@ class MotionEstimationConfig:
|
|
|
863
866
|
do_motion_estimation: bool = True
|
|
864
867
|
|
|
865
868
|
# DREDge parameters
|
|
869
|
+
motion_batching_mode: MotionBatchingMode = "full"
|
|
870
|
+
motion_chunk_len_s: float = 3000.0
|
|
866
871
|
probe_boundary_padding_um: float = 100.0
|
|
867
872
|
spatial_bin_length_um: float = 1.0
|
|
868
873
|
temporal_bin_length_s: float = 1.0
|
|
@@ -16,7 +16,7 @@ try:
|
|
|
16
16
|
have_cloudpickle = True
|
|
17
17
|
except ImportError:
|
|
18
18
|
try:
|
|
19
|
-
from joblib.externals import cloudpickle
|
|
19
|
+
from joblib.externals import cloudpickle # ty: ignore[unresolved-import]
|
|
20
20
|
|
|
21
21
|
have_cloudpickle = True
|
|
22
22
|
except ImportError:
|
|
@@ -152,7 +152,7 @@ def handle_negative_jobs(n_jobs: int):
|
|
|
152
152
|
n_cores = os.process_cpu_count() # type: ignore
|
|
153
153
|
except AttributeError:
|
|
154
154
|
try:
|
|
155
|
-
my_cores = os.sched_getaffinity(0) # type: ignore
|
|
155
|
+
my_cores = os.sched_getaffinity(0) # type: ignore
|
|
156
156
|
if my_cores:
|
|
157
157
|
n_cores = len(my_cores)
|
|
158
158
|
else:
|
|
@@ -186,9 +186,9 @@ def _dump_json(recording: BaseRecording, json_path: Path | None):
|
|
|
186
186
|
try:
|
|
187
187
|
recording.dump_to_json(
|
|
188
188
|
file_path=json_path,
|
|
189
|
-
include_extra_metadata=True,
|
|
190
|
-
include_properties=True, # ty: ignore[unknown-argument]
|
|
191
|
-
include_annotations=True, # ty: ignore[unknown-argument]
|
|
189
|
+
include_extra_metadata=True,
|
|
190
|
+
include_properties=True, # ty: ignore[unknown-argument, unused-ignore-comment]
|
|
191
|
+
include_annotations=True, # ty: ignore[unknown-argument, unused-ignore-comment]
|
|
192
192
|
relative_to=True,
|
|
193
193
|
)
|
|
194
194
|
except TypeError:
|