Return a vector appropriate to a dimensional space, using an input vector
    as a prompt depending on its type:

        - If the input is a vector, return that vector.
        - If the input is a scalar, return a vector filled with that value.

    Useful when a function expects an array specifying values along each axis,
    but wants to also accept a scalar value in case the length is the same in
    all directions.

    Parameters
    ----------
    x: float or array-like
        The input parameter that may need padding.
    d: int
        The dimensional space to make `x` appropriate for.

    Returns
    -------
    x_pad: array-like, shape (d,)
        The padded parameter.

def pad_length(x, d):
    """Return a vector appropriate to a dimensional space, using an input vector
    as a prompt depending on its type:

        - If the input is a vector, return that vector.
        - If the input is a scalar, return a vector filled with that value.

    Useful when a function expects an array specifying values along each axis,
    but wants to also accept a scalar value in case the length is the same in
    all directions.

    Parameters
    ----------
    x: float or array-like
        The input parameter that may need padding.
    d: int
        The dimensional space to make `x` appropriate for.

    Returns
    -------
    x_pad: array-like, shape (d,)
        The padded parameter.
    """
    try:
        x[0]
    except TypeError:
        x = d * [x]
    return np.array(x)