Commit 1f5a6c6c authored by Theo Steininger's avatar Theo Steininger

Fixed infer_dtype in Field

parent 6c70837a
Pipeline #11886 passed with stage
in 10 minutes and 15 seconds
......@@ -90,9 +90,11 @@ class Field(Loggable, Versionable, object):
try:
dtype = val.dtype
except AttributeError:
if val is not None:
try:
if val is None:
raise TypeError
dtype = np.result_type(val)
else:
except(TypeError):
dtype = np.dtype(gc['default_field_dtype'])
else:
dtype = np.dtype(dtype)
......@@ -307,6 +309,9 @@ class Field(Loggable, Versionable, object):
# check if the `spaces` input is valid
spaces = utilities.cast_axis_to_tuple(spaces, len(self.domain))
if spaces is None:
spaces = range(len(self.domain))
for power_space_index in spaces:
power_space = self.domain[power_space_index]
if not isinstance(power_space, PowerSpace):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment