inaos / iron-array

2 stars 0 forks source link

The python wrapper should fully understand np.dtype #608

Closed FrancescAlted closed 2 years ago

FrancescAlted commented 2 years ago

Right now, this is not the case:

import numpy as np
import iarray as ia

x = np.eye(200)
iax = ia.empty(x.shape, dtype=x.dtype)
# iax = ia.empty(x.shape, dtype="f8")  # this fails too!
iax[:] = x

raises the next error:

Traceback (most recent call last):
  File "/Users/faltet/iarray/iron-array-python/bench/dtype-bug.py", line 8, in <module>
    iax = ia.empty(x.shape, dtype=x.dtype)
  File "/Users/faltet/iarray/iron-array-python/iarray/constructors.py", line 80, in empty
    with ia.config(shape=shape, cfg=cfg, **kwargs) as cfg:
  File "/Users/faltet/miniconda3/envs/iron-array-python/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/Users/faltet/iarray/iron-array-python/iarray/config_params.py", line 686, in config
    cfg = set_config_defaults(cfg, shape, **kwargs)
  File "/Users/faltet/iarray/iron-array-python/iarray/config_params.py", line 659, in set_config_defaults
    cfg._get_shape_advice(shape)
  File "/Users/faltet/iarray/iron-array-python/iarray/config_params.py", line 584, in _get_shape_advice
    chunks_, blocks_ = partition_advice(shape, cfg=self)
  File "/Users/faltet/iarray/iron-array-python/iarray/config_params.py", line 101, in partition_advice
    chunks, blocks = ext.partition_advice(
  File "iarray_ext.pyx", line 1800, in iarray.iarray_ext.partition_advice
  File "iarray_ext.pyx", line 338, in iarray.iarray_ext.IaDTShape.__cinit__
KeyError: dtype('float64')

Process finished with exit code 1