correct printing of error messages
'{}'.format(np.ones(3)) gives only '1', but we want to see '[1 1 1]'
This commit is contained in:
parent
bc1d356d21
commit
a608310920
|
@ -148,7 +148,7 @@ class Geom():
|
|||
"""
|
||||
if microstructure is not None:
|
||||
if len(microstructure.shape) != 3:
|
||||
raise ValueError('Invalid microstructure shape {}'.format(*microstructure.shape))
|
||||
raise ValueError('Invalid microstructure shape {}'.format(microstructure.shape))
|
||||
elif microstructure.dtype not in np.sctypes['float'] + np.sctypes['int']:
|
||||
raise TypeError('Invalid data type {} for microstructure'.format(microstructure.dtype))
|
||||
else:
|
||||
|
@ -169,7 +169,7 @@ class Geom():
|
|||
self.size = grid/np.max(grid)
|
||||
else:
|
||||
if len(size) != 3 or any(np.array(size)<=0):
|
||||
raise ValueError('Invalid size {}'.format(*size))
|
||||
raise ValueError('Invalid size {}'.format(size))
|
||||
else:
|
||||
self.size = np.array(size)
|
||||
|
||||
|
@ -185,7 +185,7 @@ class Geom():
|
|||
"""
|
||||
if origin is not None:
|
||||
if len(origin) != 3:
|
||||
raise ValueError('Invalid origin {}'.format(*origin))
|
||||
raise ValueError('Invalid origin {}'.format(origin))
|
||||
else:
|
||||
self.origin = np.array(origin)
|
||||
|
||||
|
@ -458,7 +458,7 @@ class Geom():
|
|||
if not all(isinstance(d, str) for d in directions):
|
||||
raise TypeError('Directions are not of type str.')
|
||||
elif not set(directions).issubset(valid):
|
||||
raise ValueError('Invalid direction specified {}'.format(*set(directions).difference(valid)))
|
||||
raise ValueError('Invalid direction specified {}'.format(set(directions).difference(valid)))
|
||||
|
||||
limits = [None,None] if reflect else [-2,0]
|
||||
ms = self.get_microstructure()
|
||||
|
|
Loading…
Reference in New Issue