prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  montage_sgskip.py example doesn't run
  When trying to run the example in `examples/visualization/montage_sgskip.py`, I get an exception:
  
  ```python
  ValueError: A head<->mri transformation matrix (trans) is required to plot head surfaces in head coordinates, `trans=None` is not allowed
  ```
  It runs if I pass `trans='fsaverage'` but I'm not sure this is how this example intended to behave (as the BEM is based on a sphere here).
  
  @agramfort care to take a look?
  
  </issue>
  <code>
  [start of examples/visualization/montage_sgskip.py]
  1 # -*- coding: utf-8 -*-
  2 """
  3 .. _plot_montage:
  4 
  5 Plotting sensor layouts of EEG systems
  6 ======================================
  7 
  8 This example illustrates how to load all the EEG system montages
  9 shipped in MNE-python, and display it on the fsaverage template subject.
  10 """  # noqa: D205, D400
  11 # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
  12 #          Joan Massich <mailsik@gmail.com>
  13 #
  14 # License: BSD-3-Clause
  15 
  16 # %%
  17 
  18 import os.path as op
  19 
  20 import mne
  21 from mne.channels.montage import get_builtin_montages
  22 from mne.datasets import fetch_fsaverage
  23 from mne.viz import set_3d_title, set_3d_view
  24 
  25 
  26 # %%
  27 # Check all montages against a sphere
  28 
  29 for current_montage in get_builtin_montages():
  30     montage = mne.channels.make_standard_montage(current_montage)
  31     info = mne.create_info(
  32         ch_names=montage.ch_names, sfreq=100., ch_types='eeg')
  33     info.set_montage(montage)
  34     sphere = mne.make_sphere_model(r0='auto', head_radius='auto', info=info)
  35     fig = mne.viz.plot_alignment(
  36         # Plot options
  37         show_axes=True, dig='fiducials', surfaces='head',
  38         bem=sphere, info=info)
  39     set_3d_view(figure=fig, azimuth=135, elevation=80)
  40     set_3d_title(figure=fig, title=current_montage)
  41 
  42 
  43 # %%
  44 # Check all montages against fsaverage
  45 
  46 subjects_dir = op.dirname(fetch_fsaverage())
  47 
  48 for current_montage in get_builtin_montages():
  49     montage = mne.channels.make_standard_montage(current_montage)
  50     # Create dummy info
  51     info = mne.create_info(
  52         ch_names=montage.ch_names, sfreq=100., ch_types='eeg')
  53     info.set_montage(montage)
  54     fig = mne.viz.plot_alignment(
  55         # Plot options
  56         show_axes=True, dig='fiducials', surfaces='head', mri_fiducials=True,
  57         subject='fsaverage', subjects_dir=subjects_dir, info=info,
  58         coord_frame='mri',
  59         trans='fsaverage',  # transform from head coords to fsaverage's MRI
  60     )
  61     set_3d_view(figure=fig, azimuth=135, elevation=80)
  62     set_3d_title(figure=fig, title=current_montage)
  63
  [end of examples/visualization/montage_sgskip.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/examples/visualization/montage_sgskip.py b/examples/visualization/montage_sgskip.py
  --- a/examples/visualization/montage_sgskip.py
  +++ b/examples/visualization/montage_sgskip.py
  @@ -16,6 +16,7 @@
   # %%
   
   import os.path as op
  +import numpy as np
   
   import mne
   from mne.channels.montage import get_builtin_montages
  @@ -35,6 +36,7 @@
       fig = mne.viz.plot_alignment(
           # Plot options
           show_axes=True, dig='fiducials', surfaces='head',
  +        trans=mne.Transform("head", "mri", trans=np.eye(4)),  # identity
           bem=sphere, info=info)
       set_3d_view(figure=fig, azimuth=135, elevation=80)
       set_3d_title(figure=fig, title=current_montage)
  
verification_info: {"golden_diff": "diff --git a/examples/visualization/montage_sgskip.py b/examples/visualization/montage_sgskip.py\n--- a/examples/visualization/montage_sgskip.py\n+++ b/examples/visualization/montage_sgskip.py\n@@ -16,6 +16,7 @@\n # %%\n \n import os.path as op\n+import numpy as np\n \n import mne\n from mne.channels.montage import get_builtin_montages\n@@ -35,6 +36,7 @@\n     fig = mne.viz.plot_alignment(\n         # Plot options\n         show_axes=True, dig='fiducials', surfaces='head',\n+        trans=mne.Transform(\"head\", \"mri\", trans=np.eye(4)),  # identity\n         bem=sphere, info=info)\n     set_3d_view(figure=fig, azimuth=135, elevation=80)\n     set_3d_title(figure=fig, title=current_montage)\n", "issue": "montage_sgskip.py example doesn't run\nWhen trying to run the example in `examples/visualization/montage_sgskip.py`, I get an exception:\r\n\r\n```python\r\nValueError: A head<->mri transformation matrix (trans) is required to plot head surfaces in head coordinates, `trans=None` is not allowed\r\n```\r\nIt runs if I pass `trans='fsaverage'` but I'm not sure this is how this example intended to behave (as the BEM is based on a sphere here).\r\n\r\n@agramfort care to take a look?\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\n.. _plot_montage:\n\nPlotting sensor layouts of EEG systems\n======================================\n\nThis example illustrates how to load all the EEG system montages\nshipped in MNE-python, and display it on the fsaverage template subject.\n\"\"\"  # noqa: D205, D400\n# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>\n#          Joan Massich <mailsik@gmail.com>\n#\n# License: BSD-3-Clause\n\n# %%\n\nimport os.path as op\n\nimport mne\nfrom mne.channels.montage import get_builtin_montages\nfrom mne.datasets import fetch_fsaverage\nfrom mne.viz import set_3d_title, set_3d_view\n\n\n# %%\n# Check all montages against a sphere\n\nfor current_montage in get_builtin_montages():\n    montage = mne.channels.make_standard_montage(current_montage)\n    info = mne.create_info(\n        ch_names=montage.ch_names, sfreq=100., ch_types='eeg')\n    info.set_montage(montage)\n    sphere = mne.make_sphere_model(r0='auto', head_radius='auto', info=info)\n    fig = mne.viz.plot_alignment(\n        # Plot options\n        show_axes=True, dig='fiducials', surfaces='head',\n        bem=sphere, info=info)\n    set_3d_view(figure=fig, azimuth=135, elevation=80)\n    set_3d_title(figure=fig, title=current_montage)\n\n\n# %%\n# Check all montages against fsaverage\n\nsubjects_dir = op.dirname(fetch_fsaverage())\n\nfor current_montage in get_builtin_montages():\n    montage = mne.channels.make_standard_montage(current_montage)\n    # Create dummy info\n    info = mne.create_info(\n        ch_names=montage.ch_names, sfreq=100., ch_types='eeg')\n    info.set_montage(montage)\n    fig = mne.viz.plot_alignment(\n        # Plot options\n        show_axes=True, dig='fiducials', surfaces='head', mri_fiducials=True,\n        subject='fsaverage', subjects_dir=subjects_dir, info=info,\n        coord_frame='mri',\n        trans='fsaverage',  # transform from head coords to fsaverage's MRI\n    )\n    set_3d_view(figure=fig, azimuth=135, elevation=80)\n    set_3d_title(figure=fig, title=current_montage)\n", "path": "examples/visualization/montage_sgskip.py"}]}