<commit_before>import numpy as np

try:
    from enthought.mayavi import mlab
except ImportError:
    from mayavi import mlab

from dipy.utils.spheremakers import sphere_vf_from


def show_odfs(odfs, vertices_faces, image=None, colormap='jet',
              scale=2.2, norm=True, radial_scale=True):
    """
    Display a grid of ODFs.

    Parameters
    ----------
    odfs : (X, Y, Z, M) ndarray
        A 3-D arrangement of orientation distribution functions (ODFs).  At
        each ``(x, y, z)`` position, it contains the the values of the
        corresponding ODF evaluated on the M vertices.
    vertices_faces : str or tuple of (vertices, faces)
        A named sphere from `dipy.data.get_sphere`, or a combination of
        `(vertices, faces)`.
    image : (X, Y) ndarray
        Background image (e.g., fractional anisotropy) do display behind the
        ODFs.
    colormap : str
        Color mapping.<commit_msg>BF: Mayavi is an optional requirement.<commit_after>import numpy as np

try: 
    # Mayavi appears in many guises:
    try:
        from enthought.mayavi import mlab
    except ImportError:
        from mayavi import mlab
# But if you don't have it, we're not going to give you too much of a hard time:
except ImportError:
    e_s = "You do not have Mayavi installed. Some visualization functions"
    e_s += " might not work."
    print(e_s)
    
from dipy.utils.spheremakers import sphere_vf_from


def show_odfs(odfs, vertices_faces, image=None, colormap='jet',
              scale=2.2, norm=True, radial_scale=True):
    """
    Display a grid of ODFs.

    Parameters
    ----------
    odfs : (X, Y, Z, M) ndarray
        A 3-D arrangement of orientation distribution functions (ODFs).  At
        each ``(x, y, z)`` position, it contains the the values of the
        corresponding ODF evaluated on the M vertices.
    vertices_faces : str or tuple of (vertices, faces)
        A named sphere from `dipy.data.get_sphere`, or a combination of
        `(vertices, faces)`.
    image : (X, Y) ndarray
        Background image (e.g., fractional anisotropy) do display behind the
        ODFs.
    colormap : str
        Color mapping.
{'fraction_non_alphanumeric': 0.08960739030023095, 'fraction_numerical': 0.002771362586605081, 'mean_word_length': 2.5742574257425743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7020664', 'n_tokens_mistral': 669, 'n_tokens_neox': 638, 'n_words': 251}