def __getitem__(self, i):
        """depth[i]

        ith depth, a horizontal cross-section of the file, starting at 0.
        depth[i] returns a numpy.ndarray, and changes to this array will *not*
        be reflected on disk.

        When i is a slice, a generator of numpy.ndarray is returned.

        The depth slices are returned as a fast-by-slow shaped array, i.e. an
        inline sorted file with 10 inlines and 5 crosslines has the shape
        (10,5). If the file is unsorted, the array shape == tracecount.

        Be aware that this interface uses zero-based indices (like traces) and
        *not keys* (like ilines), so you can *not* use the values file.samples
        as indices.

        Parameters
        ----------
        i : int or slice

        Returns
        -------
        depth : numpy.ndarray of dtype or generator of numpy.ndarray of dtype

        Notes
        -----
        .. versionadded:: 1.1

        .. warning::
            The segyio 1.5 and 1.6 series, and 1.7.0, would return the depth_slice in the
            wrong shape for most files. Since segyio 1.7.1, the arrays have the
            correct shape, i.e. fast-by-slow. The underlying data was always
            fast-by-slow, so a numpy array reshape can fix programs using the
            1.5 and 1.6 series.

        Behaves like [] for lists.

        Examples
        --------
        Read a single cut (one sample per trace):

        >>> x = f.depth_slice[199]

        Copy every depth slice into a list:

        >>> l = [numpy.copy(x) for x in depth[:]

        Every third depth:

        >>> for d in depth[::3]:
        ...     (d * 6).mean()

        Read up to 250:

        >>> for d in depth[:250]:
        ...     d.mean()

        >>> len(ilines), len(xlines)
        (1, 6)
        >>> f.depth_slice[0]
        array([[0.  , 0.01, 0.02, 0.03, 0.04, 0.05]], dtype=float32)
        """

        try:
            i = self.wrapindex(i)
            buf = np.empty(self.shape, dtype=self.dtype)
            return self.filehandle.getdepth(i, buf.size, self.offsets, buf)

        except TypeError:
            try:
                indices = i.indices(len(self))
            except AttributeError:
                msg = 'depth indices must be integers or slices, not {}'
                raise TypeError(msg.format(type(i).__name__))

            def gen():
                x = np.empty(self.shape, dtype=self.dtype)
                y = np.copy(x)

                for j in range(*indices):
                    self.filehandle.getdepth(j, x.size, self.offsets, x)
                    x, y = y, x
                    yield y

            return gen()
def __getitem__ ( self , i ) : try : i = self . wrapindex ( i ) buf = np . empty ( self . shape , dtype = self . dtype ) return self . filehandle . getdepth ( i , buf . size , self . offsets , buf ) except TypeError : try : indices = i . indices ( len ( self ) ) except AttributeError : msg = 'depth indices must be integers or slices, not {}' raise TypeError ( msg . format ( type ( i ) . __name__ ) ) def gen ( ) : x = np . empty ( self . shape , dtype = self . dtype ) y = np . copy ( x ) for j in range ( * indices ) : self . filehandle . getdepth ( j , x . size , self . offsets , x ) x , y = y , x yield y return gen ( )
depth[i]

        ith depth, a horizontal cross-section of the file, starting at 0.
        depth[i] returns a numpy.ndarray, and changes to this array will *not*
        be reflected on disk.

        When i is a slice, a generator of numpy.ndarray is returned.

        The depth slices are returned as a fast-by-slow shaped array, i.e. an
        inline sorted file with 10 inlines and 5 crosslines has the shape
        (10,5). If the file is unsorted, the array shape == tracecount.

        Be aware that this interface uses zero-based indices (like traces) and
        *not keys* (like ilines), so you can *not* use the values file.samples
        as indices.

        Parameters
        ----------
        i : int or slice

        Returns
        -------
        depth : numpy.ndarray of dtype or generator of numpy.ndarray of dtype

        Notes
        -----
        .. versionadded:: 1.1

        .. warning::
            The segyio 1.5 and 1.6 series, and 1.7.0, would return the depth_slice in the
            wrong shape for most files. Since segyio 1.7.1, the arrays have the
            correct shape, i.e. fast-by-slow. The underlying data was always
            fast-by-slow, so a numpy array reshape can fix programs using the
            1.5 and 1.6 series.

        Behaves like [] for lists.

        Examples
        --------
        Read a single cut (one sample per trace):

        >>> x = f.depth_slice[199]

        Copy every depth slice into a list:

        >>> l = [numpy.copy(x) for x in depth[:]

        Every third depth:

        >>> for d in depth[::3]:
        ...     (d * 6).mean()

        Read up to 250:

        >>> for d in depth[:250]:
        ...     d.mean()

        >>> len(ilines), len(xlines)
        (1, 6)
        >>> f.depth_slice[0]
        array([[0.  , 0.01, 0.02, 0.03, 0.04, 0.05]], dtype=float32)