devito
devito copied to clipboard
support modulo=None default argument for Data object
Thanks for this!
What's the cause of the issue? Could you attach a tiny MFE?
Hey Fabio,
This is an old DUG patch from Tim that allows you to create a Data object directly. Take the following simple example:
from devito.data import Data
import numpy as np
data = Data((1000,), dtype=np.uint8)
Traceback (most recent call last):
File "xxx/devito3/test.py", line 4, in <module>
data = Data((1000,), dtype=np.uint8)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxx/devito3/devito/data/data.py", line 53, in __new__
assert len(shape) == len(modulo)
^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
If you check the code, the statement obj._modulo = modulo or (False,)*len(shape) is already meant to handle this case and the assert just seems in the wrong location.