Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"the base object isn't a bohrium array" when reading from HDF5 #615

Open
dionhaefner opened this issue Apr 24, 2019 · 0 comments
Open

"the base object isn't a bohrium array" when reading from HDF5 #615

dionhaefner opened this issue Apr 24, 2019 · 0 comments

Comments

@dionhaefner
Copy link
Collaborator

Test script:

import tempfile

import numpy as np
import bohrium as bh
import h5py


if __name__ == '__main__':
    with tempfile.NamedTemporaryFile() as tmp:
        data = np.random.rand(100, 100)

        with h5py.File(tmp, 'w') as f:
            f['test'] = data

        out = bh.empty((100, 100))
        with h5py.File(tmp) as f:
            out[...] = f['test'][...]

        assert np.array_equal(out.copy2numpy(), data)

Output:

$ python bh_bug.py
bh_bug.py:17: UserWarning: Bohrium does not support the dtype 'float64', the new array will be a regular NumPy array.
  out[...] = f['test']
Traceback (most recent call last):
  File "bh_bug.py", line 17, in <module>
    out[...] = f['test']
  File "bohrium/ufuncs.pyx", line 55, in bohrium.ufuncs.setitem
  File "bohrium/bhary.pyx", line 95, in bohrium.bhary.fix_biclass_wrapper.inner
  File "bohrium/ufuncs.pyx", line 103, in bohrium.ufuncs.assign
ValueError: get_base() -  the base object isn't a bohrium array!

Works fine if I do

-         out[...] = f['test'][...]
+         out[...] = f['test'][...].astype(out.dtype)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant