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 43 forks source link

`get_spiking_v1_merge_ids` invalid restriction #1159

Open CBroz1 opened 1 month ago

CBroz1 commented 1 month ago

https://github.com/LorenFrankLab/spyglass/blob/03e39960e31bb358ba3f112220a5fdbb2e6acc76/src/spyglass/spikesorting/v1/utils.py#L37-L71

get_spiking_v1_merge_ids uses the same restriction for both SpikeSortingRecordingSelection and ArtifactDetectionSelection tables. A valid restriction for one may not be valid for the other. Should these be separated into two inputs, recording_restr and artifact_restr?

The collected recording IDs are then used with fetch1 which implies that there should be only one recording per entry in ArtifactDetectionSelection. This may be true, but is not enforced, as a secondary key.

This function could also be refactored to reduce the number of fetches. Perhaps this is replaced by long distance restriction?