Skip to content

keep probe_planar_contour when aggregating channels #3958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/spikeinterface/core/channelsaggregationrecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ def __init__(self, recording_list_or_dict=None, renamed_channel_ids=None, record
"Locations are not unique! " "Cannot aggregate recordings!"
)

planar_contour_keys = [
key for recording in recording_list for key in recording.get_annotation_keys() if "planar_contour" in key
]
if len(planar_contour_keys) > 0:
if all(
k == planar_contour_keys[0] for k in planar_contour_keys
): # we add the 'planar_contour' annotations only if there is a unique one in the recording_list
planar_contour_key = planar_contour_keys[0]
collect_planar_contours = []
for rec in recording_list:
collect_planar_contours.append(rec.get_annotation(planar_contour_key))
if all(np.array_equal(arr, collect_planar_contours[0]) for arr in collect_planar_contours):
self.set_annotation(planar_contour_key, collect_planar_contours[0])

# finally add segments, we need a channel mapping
ch_id = 0
channel_map = {}
Expand Down