def compress(self, condition, axis=0, out=None):
        """Return selected slices of an array along given axis.

        Parameters
        ----------
        condition : array_like, bool
            Array that selects which entries to return. N.B., if len(condition)
            is less than the size of the given axis, then output is truncated to the length
            of the condition array.
        axis : int, optional
            Axis along which to take slices. If None, work on the flattened array.
        out : ndarray, optional
            Output array.  Its type is preserved and it must be of the right
            shape to hold the output.

        Returns
        -------
        out : HaplotypeArray
            A copy of the array without the slices along axis for which `condition`
            is false.

        Examples
        --------
        >>> import allel
        >>> h = allel.HaplotypeArray([[0, 0, 0, 1],
        ...                           [0, 1, 1, 1],
        ...                           [0, 2, -1, -1]], dtype='i1')
        >>> h.compress([True, False, True], axis=0)
        <HaplotypeArray shape=(2, 4) dtype=int8>
        0 0 0 1
        0 2 . .
        >>> h.compress([True, False, True, False], axis=1)
        <HaplotypeArray shape=(3, 2) dtype=int8>
        0 0
        0 1
        0 .

        """
        return compress_haplotype_array(self, condition, axis=axis, cls=type(self),
                                        compress=np.compress, out=out)