LorenFrankLab / spyglass

Neuroscience data analysis framework for reproducible research built by Loren Frank Lab at UCSF
https://lorenfranklab.github.io/spyglass/
MIT License
94 stars 42 forks source link

Incorrect Delete propagation in decoding #962

Closed samuelbray32 closed 5 months ago

samuelbray32 commented 6 months ago

Describe the bug Running a delete in UnitWaveformFeaturesGroup is trying to delete entries in DecodingOutput.SortedSpikesDecoding (which is not dependent on this table).

Note: The attempted deletes in DecodingOutput.SortedSpikesDecoding correspond to those matching the deletion key restriction

To Reproduce

from spyglass.decoding.v1.clusterless import UnitWaveformFeaturesGroup

key = {'nwb_file_name': 'Totoro20220607_.nwb',
 'waveform_features_group_name': '04_lineartrack'}
(UnitWaveformFeaturesGroup() & key).delete(key)

Output:

[11:24:24][INFO] Spyglass: Building merge cache for unit_waveform_features_group. Found 1 downstream merge tables [2024-05-08 11:24:24,592][INFO]: Merge: Deleting 20 rows from decoding_merge.decoding_output [2024-05-08 11:24:24,613][INFO]: Deleting 20 rows from decoding_merge.decoding_output__sorted_spikes_decoding_v1 [2024-05-08 11:24:24,623][INFO]: Deleting 20 rows from decoding_merge.decoding_output [2024-05-08 11:24:41,145][WARNING]: Deletes cancelled [2024-05-08 11:24:41,170][INFO]: Deleting 30 rows from decoding_clusterless_v1.unit_waveform_features_group__unit_features [2024-05-08 11:24:41,180][INFO]: Deleting 1 rows from decoding_clusterless_v1.unit_waveform_features_group [2024-05-08 11:24:43,562][WARNING]: Deletes cancelled

Expected behavior No deletes from the sorted decoding merge table

samuelbray32 commented 6 months ago

Note: Denying the merge delete and accepting the second set of deletes worked fine. The entry is now gone from the database

CBroz1 commented 6 months ago

I wonder if this would look different once #949 is merged, because it changes how I propagate restrictions

edeno commented 5 months ago

Do we know if #949 solved this?

samuelbray32 commented 5 months ago

Tested and appears to be resolved