Skip to content

Commit

Permalink
port away from deprecated actx.zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl committed Aug 7, 2024
1 parent d39b16f commit 45824f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/test_fmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def test_fmm_completeness(actx_factory, dims, nsources_req, ntargets_req,
raise ValueError("unsupported value of 'filter_kind'")
else:
wrangler = ConstantOneExpansionWrangler(tree_indep, host_trav)
flags = 1 + actx.zeros(ntargets or nsources, dtype=np.int8)
flags = 1 + actx.np.zeros(ntargets or nsources, dtype=np.int8)

if ntargets is None and not filter_kind:
# This check only works for targets == sources.
Expand Down
16 changes: 8 additions & 8 deletions test/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def test_extent_tree(actx_factory, dims, extent_norm, visualize=False):
targets = make_normal_particle_array(actx.queue, ntargets, dims, dtype,
seed=19)

refine_weights = actx.zeros(nsources + ntargets, np.int32)
refine_weights = actx.np.zeros(nsources + ntargets, np.int32)
refine_weights[:nsources] = 1

rng = np.random.default_rng(13)
Expand Down Expand Up @@ -693,7 +693,7 @@ def test_leaves_to_balls_query(actx_factory, dims, visualize=False):

nballs = 10**4
ball_centers = make_normal_particle_array(actx.queue, nballs, dims, dtype)
ball_radii = 0.1 + actx.zeros(nballs, dtype)
ball_radii = 0.1 + actx.np.zeros(nballs, dtype)

from boxtree.area_query import LeavesToBallsLookupBuilder
lblb = LeavesToBallsLookupBuilder(actx.context)
Expand Down Expand Up @@ -797,7 +797,7 @@ def test_area_query(actx_factory, dims, visualize=False):

nballs = 10**4
ball_centers = make_normal_particle_array(actx.queue, nballs, dims, dtype)
ball_radii = 0.1 + actx.zeros(nballs, dtype)
ball_radii = 0.1 + actx.np.zeros(nballs, dtype)

run_area_query_test(actx, tree, ball_centers, ball_radii)

Expand Down Expand Up @@ -838,7 +838,7 @@ def test_area_query_balls_outside_bbox(actx_factory, dims, visualize=False):
actx.from_numpy(
rng.uniform(bbox_min - 1, bbox_max + 1, nballs).astype(dtype))
for i in range(dims)])
ball_radii = 0.1 + actx.zeros(nballs, dtype)
ball_radii = 0.1 + actx.np.zeros(nballs, dtype)

run_area_query_test(actx, tree, ball_centers, ball_radii)

Expand Down Expand Up @@ -867,7 +867,7 @@ def test_area_query_elwise(actx_factory, dims, visualize=False):

nballs = 10**4
ball_centers = make_normal_particle_array(actx.queue, nballs, dims, dtype)
ball_radii = 0.1 + actx.zeros(nballs, dtype)
ball_radii = 0.1 + actx.np.zeros(nballs, dtype)

from boxtree.area_query import AreaQueryElementwiseTemplate, PeerListFinder

Expand Down Expand Up @@ -1017,7 +1017,7 @@ def test_space_invader_query(actx_factory, dims, dtype, visualize=False):

nballs = 10**4
ball_centers = make_normal_particle_array(actx.queue, nballs, dims, dtype)
ball_radii = 0.1 + actx.zeros(nballs, dtype)
ball_radii = 0.1 + actx.np.zeros(nballs, dtype)

from boxtree.area_query import LeavesToBallsLookupBuilder, SpaceInvaderQueryBuilder

Expand Down Expand Up @@ -1088,7 +1088,7 @@ def test_same_tree_with_zero_weight_particles(actx_factory, dims):
sources = actx.from_numpy(sources)
targets = actx.from_numpy(targets)

refine_weights = actx.empty(nsources + ntargets, np.int32)
refine_weights = actx.np.zeros(nsources + ntargets, np.int32)
refine_weights[:nsources] = 1
refine_weights[nsources:] = 0

Expand Down Expand Up @@ -1122,7 +1122,7 @@ def test_max_levels_error(actx_factory):
from boxtree import TreeBuilder
tb = TreeBuilder(actx.context)

sources = [actx.zeros(11, np.float64) for i in range(2)]
sources = [actx.np.zeros(11, np.float64) for i in range(2)]
from boxtree.tree_build import MaxLevelsExceeded
with pytest.raises(MaxLevelsExceeded):
_tree, _ = tb(actx.queue, sources, max_particles_in_box=10, debug=True)
Expand Down

0 comments on commit 45824f5

Please sign in to comment.