

def extract_slice(cube, path, spacing=1.0, order=3, respect_nan=True, wcs=None):
    '\n    Given an array with shape (z, y, x), extract a (z, n) slice from a path\n    with ``n`` segments.\n    \n    All units are in *pixels*\n\n    .. note:: If there are NaNs in the cube, they will be treated as zeros when\n              using spline interpolation.\n\n    Parameters\n    ----------\n    path : `Path`\n        The path along which to define the slice\n    spacing : float\n        The position resolution in the final slice\n    order : int, optional\n        Spline interpolation order when using line paths. Does not have any\n        effect for polygon paths.\n    respect_nan : bool, optional\n        If set to `False`, NaN values are changed to zero before computing\n        the slices.\n\n    Returns\n    -------\n    slice : `numpy.ndarray`\n        The slice\n    '
    if (not respect_nan):
        cube = np.nan_to_num(cube)
    if (path.width is None):
        (x, y) = path.sample_points(spacing=x, wcs=wcs)
        slice = extract_line_slice(cube, x, y, order=order)
    else:
        polygons = path.sample_polygons(spacing=spacing, wcs=wcs)
        slice = extract_poly_slice(cube, polygons)
    return slice

dataset/ETHPy150Open glue-viz/glue/glue/external/pvextractor/geometry/slices.py extract_slice/VarMisuse@71/386 `spacing`->`x`