Skip to content

CurationV1 fails to write file with no spike times #1532

@CBroz1

Description

@CBroz1

If no spikes are found for a given curation, we see a KeyError here...

14:23:11][ERROR] Spyglass: Failed to insert initial curation for archibald20210714_.nwb | SG 26 | Intvl 05_s3: 'spike_times'
Traceback (most recent call last):
  File "[User Script]", line 255, in _process_single_sort_group
    inserted: Union[Dict, List[Dict]] = CurationV1.insert_curation(
  File "/spyglass/spikesorting/v1/curation.py", line 97, in insert_curation
    analysis_file_name, object_id = _write_sorting_to_nwb_with_curation(
  File "/spyglass/spikesorting/v1/curation.py", line 351, in _write_sorting_to_nwb_with_curation
    for unit_id, spike_times in zip(units.index, units["spike_times"])
  File ".../pandas/core/frame.py", line 4113, in __getitem__
    indexer = self.columns.get_loc(key)
  File ".../pandas/core/indexes/range.py", line 417, in get_loc
    raise KeyError(key)
KeyError: 'spike_times'

Ultimately caused by this dict comprehension...

units_dict = {
unit_id: spike_times
for unit_id, spike_times in zip(units.index, units["spike_times"])
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions