From 19194275c1a5c6d0795af442c8a4ac0e1c0966d2 Mon Sep 17 00:00:00 2001 From: Sam Bray Date: Fri, 27 Oct 2023 10:34:40 -0700 Subject: [PATCH 1/2] Prevent Curation from re-adding an existing sorting key with a new curation_id --- src/spyglass/spikesorting/spikesorting_populator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spyglass/spikesorting/spikesorting_populator.py b/src/spyglass/spikesorting/spikesorting_populator.py index 2c23edcfc..cb95049c5 100644 --- a/src/spyglass/spikesorting/spikesorting_populator.py +++ b/src/spyglass/spikesorting/spikesorting_populator.py @@ -214,7 +214,8 @@ def spikesorting_pipeline_populator( # initial curation print("Beginning curation") for sorting_key in (SpikeSorting() & sort_dict).fetch("KEY"): - Curation.insert_curation(sorting_key) + if not (Curation() & sorting_key): + Curation.insert_curation(sorting_key) # Calculate quality metrics and perform automatic curation if specified if ( From 2c86a5bba98d547041be3527928740eca2af2d6f Mon Sep 17 00:00:00 2001 From: Sam Bray Date: Fri, 27 Oct 2023 16:59:59 -0700 Subject: [PATCH 2/2] Only run populator on initial curation entries --- src/spyglass/spikesorting/spikesorting_populator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spyglass/spikesorting/spikesorting_populator.py b/src/spyglass/spikesorting/spikesorting_populator.py index cb95049c5..8e31eb47a 100644 --- a/src/spyglass/spikesorting/spikesorting_populator.py +++ b/src/spyglass/spikesorting/spikesorting_populator.py @@ -227,7 +227,7 @@ def spikesorting_pipeline_populator( print("Extracting waveforms") curation_keys = [ {**k, "waveform_params_name": waveform_params_name} - for k in (Curation() & sort_dict).fetch("KEY") + for k in (Curation() & sort_dict & {"curation_id": 0}).fetch("KEY") ] WaveformSelection.insert(curation_keys, skip_duplicates=True) Waveforms.populate(sort_dict)