def get_batch(self, batch_size=32, shuffle=False, rng_seed=None,
                  buffer_size=2, dtype=np.float32, chw_order=False):
        ndata = len(self.X)

        # set randomstate for shuffling data, if supplied
        if rng_seed is None:
            rng = np.random
        else:
            rng = np.random.RandomState(seed=rng_seed)

        # index to iterate through X, y
        idxs = range(ndata)
        if shuffle:
            rng.shuffle(idxs)

        # set up generator with buffer
        def gen_batch():
            # generate batches
            nb_batch = int(np.ceil(float(ndata)/batch_size))
            for b in range(nb_batch):
                # determine batch size. all should equal bsize except the
                # last batch, when len(X) % bsize != 0.
                batch_end = (b + 1) * batch_size
                if batch_end > ndata:
                    nb_samples = ndata - b * batch_size
                else:
                    nb_samples = batch_size

                # get a minibatch
                bX = []
                for i in xrange(nb_samples):
                    idx = idxs[(b * batch_size) + i]
                    x = np.array(
                        self.data_loader(self.X[idx], **self.dl_kwargs),
                        dtype=np.float32)

                    # apply actions: zmuv, static_aug, rng_aug, etc.
                    x = self.standardize(x)
                    bX.append(x)
                bX = np.array(bX, dtype=dtype)

                # do batch zmuv
                if self.batch_zmuv:
                    bX = bX - bX.mean(axis=self.batch_axis)
                    bX = bX / (bX.std(axis=self.batch_axis) + 1e-12)

                if chw_order:
                    if self.greyscale:
                        bX = np.expand_dims(bX, 3)
                    bX = bX.transpose(0, 3, 1, 2)

                if self.y is not None:
                    bslice = idxs[b * batch_size: b * batch_size + nb_samples]
                    yield bX, self.y[bslice]
                else:
                    yield bX

        return dtb.buffered_gen_threaded(gen_batch(), buffer_size=buffer_size)

    # --- functions that need to be defined in parent class --- #
Verify detection of invocation of py.test
dataset/ETHPy150Open longubu/datumio/datumio/datagen.py/BaseGenerator.get_batch--crossover with--dataset/ETHPy150Open skoczen/polytester/tests/parsers/test_pytest_parser.py/TestPyTestParser.test_command_matches