Skip to content

Commit 91ca0d6

Browse files
authored
Merge pull request #3958 from RobertoDF/patch-3
keep probe_planar_contour when aggregating channels
2 parents 2ef382c + e5ffc24 commit 91ca0d6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/spikeinterface/core/channelsaggregationrecording.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ def __init__(self, recording_list_or_dict=None, renamed_channel_ids=None, record
105105
"Locations are not unique! " "Cannot aggregate recordings!"
106106
)
107107

108+
planar_contour_keys = [
109+
key for recording in recording_list for key in recording.get_annotation_keys() if "planar_contour" in key
110+
]
111+
if len(planar_contour_keys) > 0:
112+
if all(
113+
k == planar_contour_keys[0] for k in planar_contour_keys
114+
): # we add the 'planar_contour' annotations only if there is a unique one in the recording_list
115+
planar_contour_key = planar_contour_keys[0]
116+
collect_planar_contours = []
117+
for rec in recording_list:
118+
collect_planar_contours.append(rec.get_annotation(planar_contour_key))
119+
if all(np.array_equal(arr, collect_planar_contours[0]) for arr in collect_planar_contours):
120+
self.set_annotation(planar_contour_key, collect_planar_contours[0])
121+
108122
# finally add segments, we need a channel mapping
109123
ch_id = 0
110124
channel_map = {}

0 commit comments

Comments
 (0)