Skip to content

Commit

Permalink
interpolate_bad_channels: use has_channel_location insteas of get_pro…
Browse files Browse the repository at this point in the history
…peryt('contact_vector')
  • Loading branch information
alejoe91 committed Feb 16, 2024
1 parent 367f300 commit f7c3bd9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/spikeinterface/core/baserecordingsnippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ def set_channel_locations(self, locations, channel_ids=None):
if self.get_property("contact_vector") is not None:
raise ValueError("set_channel_locations(..) destroy the probe description, prefer set_probes(..)")
self.set_property("location", locations, ids=channel_ids)
self.set_dummy_probe_from_locations(locations)

def get_channel_locations(self, channel_ids=None, axes: str = "xy"):
if channel_ids is None:
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/extractors/nwbextractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def __init__(
self.set_channel_gains(gains)
self.set_channel_offsets(offsets)
if locations is not None:
self.set_dummy_probe_from_locations(locations)
self.set_channel_locations(locations)
if groups is not None:
self.set_channel_groups(groups)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def check_inputs(self, recording, bad_channel_ids):
if bad_channel_ids.ndim != 1:
raise TypeError("'bad_channel_ids' must be a 1d array or list.")

if recording.get_property("contact_vector") is None:
if not recording.has_channel_location():
raise ValueError("A probe must be attached to use bad channel interpolation. Use set_probe(...)")

if recording.get_probe().si_units != "um":
Expand Down

0 comments on commit f7c3bd9

Please sign in to comment.