def _prepare_data(self, data, convert=False):
    if isinstance(data, list):
        data = np.array(data, dtype=np.float32)
    if (not isinstance(data, np.ndarray)):
        raise ValueError(('Data must be a ndarray (got %s)' % type(data)))
    if data.dtype.isbuiltin:
        if (convert is True):
            data = data.astype(np.float32)
        if (data.dtype in (np.float64, np.int64)):
            raise TypeError(('data must be 32-bit not %s' % data.dtype))
        c = (data.shape[(- 1)] if (data.ndim > 1) else 1)
        if (c in [2, 3, 4]):
            if (not data.flags['C_CONTIGUOUS']):
                logger.warning(('Copying discontiguous data for struct dtype:\n%s' % _last_stack_str()))
                data = data.copy()
        else:
            c = 1
        if (self._last_dim and (c != self._last_dim)):
            raise ValueError(('Last dimension should be %s not %s' % (self._last_dim, c)))
        data = data.view(dtype=[('f0', data.dtype.base, c)])
        self._last_dim = c
    return data
def _prepare_data(self, data, convert=False):
    if isinstance(data, list):
        data = np.array(data, dtype=np.float32)
    if (not isinstance(data, np.ndarray)):
        raise ValueError(('Data must be a ndarray (got %s)' % type(data)))
    if data.dtype.isbuiltin:
        if (convert is True):
            data = data.astype(np.float32)
        if (data.dtype in (np.float64, np.int64)):
            raise TypeError(('data must be 32-bit not %s' % data.dtype))
        c = (data.shape[(- 1)] if (data.ndim > 1) else 1)
        if (c in [2, 3, 4]):
            if (not data.flags['C_CONTIGUOUS']):
                logger.warning(('Copying discontiguous data for struct dtype:\n%s' % _last_stack_str()))
                data = data.copy()
        else:
            c = 1
        if (self._last_dim and (c != self._last_dim)):
            raise ValueError(('Last dimension should be %s not %s' % (self._last_dim, c)))
        data = data.view(dtype=[('f0', data.dtype.base, c)])
        self._last_dim = c
    return data