Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvanzwieten committed May 23, 2024
1 parent d1916e0 commit ecf7246
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nutils/evaluable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ def __init__(self, args: typing.Tuple[Array, ...], args_idx: typing.Tuple[typing
try:
shape = tuple(lengths[i] for i in out_idx)
except KeyError:
raise ValueError('Output axis {} is not listed in any of the arguments.'.format(', '.join(i for i in out_idx if i not in lengths)))
raise ValueError('Output axis {} is not listed in any of the arguments.'.format(', '.join(str(i) for i in out_idx if i not in lengths)))
self.args = args
self.args_idx = args_idx
self.out_idx = out_idx
Expand Down
2 changes: 0 additions & 2 deletions tests/test_evaluable.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ def assertFunctionAlmostEqual(self, actual, desired, decimal):
self.assertArrayAlmostEqual(actual.eval(**evalargs), desired, decimal)
with self.subTest('simplified'):
self.assertArrayAlmostEqual(actual.simplified.eval(**evalargs), desired, decimal)
with self.subTest('optimized'):
self.assertArrayAlmostEqual(actual.optimized_for_numpy.eval(**evalargs), desired, decimal)
if actual.dtype != bool:
with self.subTest('sparse'):
indices, values, shape = sparse.extract(evaluable.eval_sparse(actual, **evalargs))
Expand Down
4 changes: 2 additions & 2 deletions tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,11 +1187,11 @@ def test_lower(self):
points = ref.getpoints('bezier', 4)
coordinates = evaluable.constant(points.coords)
lowerargs = function.LowerArgs.for_space('X', (self.checktransforms,), evaluable.Argument('ielem', (), int), coordinates)
lowered = self.basis.lower(lowerargs)
lowered = evaluable.compile(self.basis.lower(lowerargs), stats=False)
with _builtin_warnings.catch_warnings():
_builtin_warnings.simplefilter('ignore', category=evaluable.ExpensiveEvaluationWarning)
for ielem in range(self.checknelems):
value = lowered.eval(ielem=ielem)
value = lowered(ielem=ielem)
if value.shape[0] == 1:
value = numpy.tile(value, (points.npoints, 1))
self.assertAllAlmostEqual(value, self.checkeval(ielem, points))
Expand Down
3 changes: 2 additions & 1 deletion tests/test_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ def test_get_evaluable_weights(self):
def test_get_lower_args(self):
assert len(self.desired_transform_chains) == len(self.desired_points) == self.desired_nelems
args = self.sample.get_lower_args(evaluable.Argument('ielem', (), int))
args_points_shape = evaluable.compile(args.points_shape)
for ielem, (desired_chains, desired_points) in enumerate(zip(self.desired_transform_chains, self.desired_points)):
assert len(desired_chains) == len(desired_points) == len(self.desired_spaces)
desired_shape = tuple(p.coords.shape[0] for p in desired_points)
actual_shape = tuple(n.__index__() for n in evaluable.Tuple(args.points_shape).eval(ielem=ielem))
actual_shape = tuple(n.__index__() for n in args_points_shape(ielem=ielem))
self.assertEqual(actual_shape, desired_shape)
offset = 0
for space, desired_chain, desired_point in zip(self.desired_spaces, desired_chains, desired_points):
Expand Down

0 comments on commit ecf7246

Please sign in to comment.