Skip to content

Can't add tmp_data_to_save to old merged analyzer #4471

@chrishalcrow

Description

@chrishalcrow

As of v0.104.0 template_metrics saves some tmp_data_to_save: the peak_data and main_channel_templates alongside the metrics as data in the extension.

This creates a backward compatibility problem. When you load a v0.103.2 analyzer using v0.104.0, this has no peak_data. So when you try to e.g. merge two units, the analyzer cannot update the peak_data (since it has no peak data). Actual bug is here

self.sorting_analyzer, new_sorting_analyzer, self.data[k], new_tmp_data[k], new_unit_ids

self.data has no key "peak_data".

Wanted to raise an issue cause I think this is a general problem and there are a few solutions:

  1. Use get instead of indexing, and don't update data self.data didn't contain the tmp_data to being with.
  2. Use _handle_backward_compatibility_on_load to add a suitable "empty" peak_data.

Number 1. feels easier but I actually quite like 2, because it ensures that no matter what you load with v0.104.0, you get the same data structure. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    postprocessingRelated to postprocessing module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions