Exemplo n.º 1
0
    def __init__(self, name, array, conditions=None):

        self.data = array
        if conditions is not None and isinstance(conditions, list):
            self.conditions = conditions

        Dataset.__init__(self, '{}'.format(name))
Exemplo n.º 2
0
    def __init__(self, name, garray, gindexer, alphabetsize, channel_last):

        self.garray = garray
        self.gindexer = gindexer
        self._alphabetsize = alphabetsize
        self._rcindex = [_complement_index(idx, garray.order)
                         for idx in range(pow(alphabetsize, garray.order))]
        self._channel_last = channel_last

        Dataset.__init__(self, '{}'.format(name))
Exemplo n.º 3
0
    def __init__(self, name, array, conditions=None):

        if conditions is not None:
            assert array.shape[-1] == len(conditions), \
                "array shape and condition number does not agree: {} != {}" \
                .format(array.shape[-1], len(conditions))

        self.data = copy.copy(array)
        self.conditions = conditions

        Dataset.__init__(self, '{}'.format(name))
Exemplo n.º 4
0
    def __init__(self, name, garray, gindexer, alphabet):

        self.garray = garray
        self.gindexer = gindexer
        self._alphabet = alphabet
        self.conditions = [
            ''.join(item) for item in product(sorted(self._alphabet),
                                              repeat=self.garray.order)
        ]
        self._alphabetsize = len(self._alphabet)
        self._rcindex = [
            _complement_index(idx, garray.order)
            for idx in range(pow(self._alphabetsize, garray.order))
        ]

        Dataset.__init__(self, '{}'.format(name))
Exemplo n.º 5
0
    def __init__(
            self,
            name,
            garray,
            gindexer,  # indices of pointing to region start
            padding_value,
            dimmode,
            channel_last):  # padding value

        self.garray = garray
        self.gindexer = gindexer
        self.padding_value = padding_value
        self.dimmode = dimmode
        self._channel_last = channel_last

        Dataset.__init__(self, name)
Exemplo n.º 6
0
    def __init__(self, name, filename, conditions=None, dtype='int8', sep=','):

        self.filename = filename

        if conditions is None:
            conditions = [
                os.path.splitext(os.path.basename(f))[0] for f in filename
            ]

        self.conditions = conditions
        data = []
        for _file in self.filename:
            data.append(pd.read_csv(_file, header=None, sep=sep, dtype=dtype))

            self.data = pd.concat(data, axis=1, ignore_index=True).values

        Dataset.__init__(self, name)
Exemplo n.º 7
0
    def __init__(self, array, aggregator=None, axis=None):

        self.data = copy.copy(array)
        if aggregator is None:
            aggregator = 'sum'

        def _get_aggregator(name):
            if callable(name):
                return name
            if name == 'sum':
                return np.sum
            elif name == 'mean':
                return np.mean
            elif name == 'max':
                return np.max
            raise ValueError('ReduceDim aggregator="{}" not known.'.format(name) +
                             'Must be "sum", "mean" or "max" or a callable.')
        self.aggregator = _get_aggregator(aggregator)
        self.axis = axis if axis is not None else (1, 2)
        Dataset.__init__(self, array.name)
Exemplo n.º 8
0
    def __init__(self, array):

        self.data = copy.copy(array)
        Dataset.__init__(self, array.name)
Exemplo n.º 9
0
    def __init__(self, array, deviance):

        self.data = copy.copy(array)
        self.deviance = deviance
        Dataset.__init__(self, array.name)
Exemplo n.º 10
0
    def __init__(self, array, axis):

        self.data = copy.copy(array)

        self.axis = axis
        Dataset.__init__(self, array.name)