Skip to content

Commit c8a3035

Browse files
MAINT: use explicit isinstance(DipoleFixed) check in _line_figure
Replace the try/except AttributeError in _line_figure with an explicit isinstance(inst, DipoleFixed) check, per review feedback. DipoleFixed.plot() routes through _plot_evoked/_line_figure but has no get_channel_types() of its own (no ContainsMixin), only .info, so it needs the info-based lookup; every other caller (Evoked) has get_channel_types() directly. The bare try/except masked this and broke CI when the fallback was removed.
1 parent 66b2498 commit c8a3035

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

mne/viz/_mpl_figure.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2585,10 +2585,16 @@ def _line_figure(inst, axes=None, picks=None, **kwargs):
25852585
"""Instantiate a new line figure."""
25862586
from matplotlib.axes import Axes
25872587

2588+
from ..dipole import DipoleFixed
2589+
25882590
# if picks is None, only show data channels
25892591
allowed_ch_types = _DATA_CH_TYPES_SPLIT if picks is None else _VALID_CHANNEL_TYPES
25902592
# figure out expected number of axes
2591-
ch_types = np.array(inst.get_channel_types())
2593+
# DipoleFixed has no get_channel_types() of its own (no ContainsMixin)
2594+
if isinstance(inst, DipoleFixed):
2595+
ch_types = np.array(inst.info.get_channel_types())
2596+
else:
2597+
ch_types = np.array(inst.get_channel_types())
25922598
if picks is not None:
25932599
ch_types = ch_types[picks]
25942600
n_axes = len(np.intersect1d(ch_types, allowed_ch_types))

0 commit comments

Comments
 (0)