From 5715d534d67e522750c59d7221b114a425992fbf Mon Sep 17 00:00:00 2001 From: Chris Halcrow <57948917+chrishalcrow@users.noreply.github.com> Date: Fri, 31 May 2024 15:13:56 +0100 Subject: [PATCH] Remove mearec from testing functions (#2930) * Replace mearec with lazy sorting in testing * Update curations tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * changed gh uri --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .../curation/tests/sv-sorting-curation.json | 2 +- .../tests/test_sortingview_curation.py | 27 ++++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/spikeinterface/curation/tests/sv-sorting-curation.json b/src/spikeinterface/curation/tests/sv-sorting-curation.json index 973463fe41..dd1201fc26 100644 --- a/src/spikeinterface/curation/tests/sv-sorting-curation.json +++ b/src/spikeinterface/curation/tests/sv-sorting-curation.json @@ -1 +1 @@ -{"labelsByUnit":{"#2":["mua"],"#3":["mua"],"#4":["mua"],"#5":["accept"],"#6":["accept"],"#7":["accept"],"#8":["artifact"],"#9":["artifact"]},"mergeGroups":[["#8","#9"]]} +{"labelsByUnit":{"2":["mua"],"3":["mua"],"4":["mua"],"5":["accept"],"6":["accept"],"7":["accept"],"8":["artifact"],"9":["artifact"]},"mergeGroups":[[8,9]]} diff --git a/src/spikeinterface/curation/tests/test_sortingview_curation.py b/src/spikeinterface/curation/tests/test_sortingview_curation.py index 5ac82aab86..8f9e3e570c 100644 --- a/src/spikeinterface/curation/tests/test_sortingview_curation.py +++ b/src/spikeinterface/curation/tests/test_sortingview_curation.py @@ -5,8 +5,8 @@ import numpy as np import spikeinterface as si +from spikeinterface.core import generate_sorting import spikeinterface.extractors as se -from spikeinterface.extractors import read_mearec from spikeinterface import set_global_tmp_folder from spikeinterface.postprocessing import ( compute_correlograms, @@ -34,8 +34,6 @@ # def generate_sortingview_curation_dataset(): # import spikeinterface.widgets as sw -# local_path = si.download_dataset(remote_path="mearec/mearec_test_10s.h5") -# recording, sorting = read_mearec(local_path) # sorting_analyzer = si.create_sorting_analyzer(sorting, recording, format="memory") # sorting_analyzer.compute("random_spikes") @@ -50,7 +48,7 @@ # w = sw.plot_sorting_summary(sorting_analyzer, curation=True, backend="sortingview") # # curation_link: -# # https://figurl.org/f?v=gs://figurl/spikesortingview-10&d=sha1://bd53f6b707f8121cadc901562a89b67aec81cc81&label=SpikeInterface%20-%20Sorting%20Summary +# # https://figurl.org/f?v=npm://@fi-sci/figurl-sortingview@12/dist&d=sha1://058ab901610aa9d29df565595a3cc2a81a1b08e5 @pytest.mark.skipif(ON_GITHUB and not KACHERY_CLOUD_SET, reason="Kachery cloud secrets not available") @@ -58,15 +56,14 @@ def test_gh_curation(): """ Test curation using GitHub URI. """ - local_path = si.download_dataset(remote_path="mearec/mearec_test_10s.h5") - _, sorting = read_mearec(local_path) + sorting = generate_sorting(num_units=10) # curated link: - # https://figurl.org/f?v=gs://figurl/spikesortingview-10&d=sha1://bd53f6b707f8121cadc901562a89b67aec81cc81&label=SpikeInterface%20-%20Sorting%20Summary&s={%22sortingCuration%22:%22gh://alejoe91/spikeinterface/fix-codecov/spikeinterface/curation/tests/sv-sorting-curation.json%22} + # https://figurl.org/f?v=npm://@fi-sci/figurl-sortingview@12/dist&d=sha1://058ab901610aa9d29df565595a3cc2a81a1b08e5 gh_uri = "gh://SpikeInterface/spikeinterface/main/src/spikeinterface/curation/tests/sv-sorting-curation.json" sorting_curated_gh = apply_sortingview_curation(sorting, uri_or_json=gh_uri, verbose=True) assert len(sorting_curated_gh.unit_ids) == 9 - assert "#8-#9" in sorting_curated_gh.unit_ids + assert 1, 2 in sorting_curated_gh.unit_ids assert "accept" in sorting_curated_gh.get_property_keys() assert "mua" in sorting_curated_gh.get_property_keys() assert "artifact" in sorting_curated_gh.get_property_keys() @@ -86,18 +83,17 @@ def test_sha1_curation(): """ Test curation using SHA1 URI. """ - local_path = si.download_dataset(remote_path="mearec/mearec_test_10s.h5") - _, sorting = read_mearec(local_path) + sorting = generate_sorting(num_units=10) # from SHA1 # curated link: - # https://figurl.org/f?v=gs://figurl/spikesortingview-10&d=sha1://bd53f6b707f8121cadc901562a89b67aec81cc81&label=SpikeInterface%20-%20Sorting%20Summary&s={%22sortingCuration%22:%22sha1://1182ba19671fcc7d3f8e0501b0f8c07fb9736c22%22} - sha1_uri = "sha1://1182ba19671fcc7d3f8e0501b0f8c07fb9736c22" + # https://figurl.org/f?v=npm://@fi-sci/figurl-sortingview@12/dist&d=sha1://058ab901610aa9d29df565595a3cc2a81a1b08e5 + sha1_uri = "sha1://449a428e8824eef9ad9bcc3241e45a2cee02d381" sorting_curated_sha1 = apply_sortingview_curation(sorting, uri_or_json=sha1_uri, verbose=True) # print(f"From SHA: {sorting_curated_sha1}") assert len(sorting_curated_sha1.unit_ids) == 9 - assert "#8-#9" in sorting_curated_sha1.unit_ids + assert 1, 2 in sorting_curated_sha1.unit_ids assert "accept" in sorting_curated_sha1.get_property_keys() assert "mua" in sorting_curated_sha1.get_property_keys() assert "artifact" in sorting_curated_sha1.get_property_keys() @@ -116,8 +112,7 @@ def test_json_curation(): """ Test curation using a JSON file. """ - local_path = si.download_dataset(remote_path="mearec/mearec_test_10s.h5") - _, sorting = read_mearec(local_path) + sorting = generate_sorting(num_units=10) # from curation.json json_file = parent_folder / "sv-sorting-curation.json" @@ -125,7 +120,7 @@ def test_json_curation(): sorting_curated_json = apply_sortingview_curation(sorting, uri_or_json=json_file, verbose=True) assert len(sorting_curated_json.unit_ids) == 9 - assert "#8-#9" in sorting_curated_json.unit_ids + assert 1, 2 in sorting_curated_json.unit_ids assert "accept" in sorting_curated_json.get_property_keys() assert "mua" in sorting_curated_json.get_property_keys() assert "artifact" in sorting_curated_json.get_property_keys()