'Return raw array from either the HDU\'s memory buffer or underlying
file.'

def _get_raw_data(self, shape, code, offset):

    if isinstance(shape, int):
        shape = (shape,)
    if self._buffer:
        return np.ndarray(shape, dtype=code, buffer=self._buffer, offset=offset)
    elif self._file:
        return self._file.readarray(offset=offset, dtype=code, shape=shape)
    else:
        return None
