# Path: ndd/exceptions.py
# class DataArrayError(NddError):
#     """Input is not a valid data array."""
# 
# class NddError(Exception):
#     """Base class for ndd exceptions."""


import logging
import numpy
from itertools import combinations
from numbers import Integral
from operator import itemgetter
from ndd.exceptions import DataArrayError, NddError
    from collections.abc import Sequence
    from collections import Sequence

    def __init__(self, ar, axis=0, ks=None, k=None):
        # set data
        if not isinstance(ar, self.__class__):
            ar = numpy.atleast_2d(ar)
            if not ar.size:
                raise NddError('Empty data array')
            if ar.ndim > 2:
                raise NddError('Input array has %s dimensions; must be 2D' %
                               ar.ndim)
            if ar.shape[0] > 1:
                # take 1D array as single variable, n samples data
                if ar.shape[0] > 1 and axis == 0:
                    ar = ar.T
            self._data = ar
        else:
            self._data = ar.data
        self._ks = None
        self._k = k
        if ks is not None:
            self.ks = ks

    def __getitem__(self, index):
        cls = type(self)
        if isinstance(index, slice):
            return cls(self.data[index], axis=1)
        if isinstance(index, Integral):
            return self.data[index]
        if is_sequence(index):
            return cls(itemgetter(*index)(self), axis=1)

# Path: ndd/exceptions.py
# class DataArrayError(NddError):
#     """Input is not a valid data array."""
# 
# class NddError(Exception):
#     """Base class for ndd exceptions."""


# Path: ndd/data.py
import logging
import numpy
from itertools import combinations
from numbers import Integral
from operator import itemgetter
from ndd.exceptions import DataArrayError, NddError
    from collections.abc import Sequence
    from collections import Sequence


    def __init__(self, ar, axis=0, ks=None, k=None):
        # set data
        if not isinstance(ar, self.__class__):
            ar = numpy.atleast_2d(ar)
            if not ar.size:
                raise NddError('Empty data array')
            if ar.ndim > 2:
                raise NddError('Input array has %s dimensions; must be 2D' %
                               ar.ndim)
            if ar.shape[0] > 1:
                # take 1D array as single variable, n samples data
                if ar.shape[0] > 1 and axis == 0:
                    ar = ar.T
            self._data = ar
        else:
            self._data = ar.data
        self._ks = None
        self._k = k
        if ks is not None:
            self.ks = ks

    def __getitem__(self, index):
        cls = type(self)
        if isinstance(index, slice):
            return cls(self.data[index], axis=1)
        if isinstance(index, Integral):
            return self.data[index]
        if is_sequence(index):
            return cls(itemgetter(*index)(self), axis=1)

        raise NddError('%s is not avalid index type' % type(index))