Major rework of arguments using Extent/Slab/Plane
This commit is contained in:
parent
c598978543
commit
34f80202ba
8 changed files with 416 additions and 170 deletions
|
|
@ -2,7 +2,7 @@
|
|||
import numpy
|
||||
from numpy.testing import assert_allclose #, assert_array_equal
|
||||
|
||||
from .. import Grid
|
||||
from .. import Grid, Extent #, Slab, Plane
|
||||
|
||||
|
||||
def test_draw_oncenter_2x2() -> None:
|
||||
|
|
@ -12,7 +12,13 @@ def test_draw_oncenter_2x2() -> None:
|
|||
grid = Grid([xs, ys, zs], shifts=[[0, 0, 0]])
|
||||
arr = grid.allocate(0)
|
||||
|
||||
grid.draw_cuboid(arr, center=[0, 0, 0], dimensions=[1, 1, 10], foreground=1)
|
||||
grid.draw_cuboid(
|
||||
arr,
|
||||
x=dict(center=0, span=1),
|
||||
y=Extent(center=0, span=1),
|
||||
z=dict(center=0, span=10),
|
||||
foreground=1,
|
||||
)
|
||||
|
||||
correct = numpy.array([[0.25, 0.25],
|
||||
[0.25, 0.25]])[None, :, :, None]
|
||||
|
|
@ -27,7 +33,13 @@ def test_draw_ongrid_4x4() -> None:
|
|||
grid = Grid([xs, ys, zs], shifts=[[0, 0, 0]])
|
||||
arr = grid.allocate(0)
|
||||
|
||||
grid.draw_cuboid(arr, center=[0, 0, 0], dimensions=[2, 2, 10], foreground=1)
|
||||
grid.draw_cuboid(
|
||||
arr,
|
||||
x=dict(center=0, span=2),
|
||||
y=dict(min=-1, max=1),
|
||||
z=dict(center=0, min=-5),
|
||||
foreground=1,
|
||||
)
|
||||
|
||||
correct = numpy.array([[0, 0, 0, 0],
|
||||
[0, 1, 1, 0],
|
||||
|
|
@ -44,7 +56,13 @@ def test_draw_xshift_4x4() -> None:
|
|||
grid = Grid([xs, ys, zs], shifts=[[0, 0, 0]])
|
||||
arr = grid.allocate(0)
|
||||
|
||||
grid.draw_cuboid(arr, center=[0.5, 0, 0], dimensions=[1.5, 2, 10], foreground=1)
|
||||
grid.draw_cuboid(
|
||||
arr,
|
||||
x=dict(center=0.5, span=1.5),
|
||||
y=dict(min=-1, max=1),
|
||||
z=dict(center=0, span=10),
|
||||
foreground=1,
|
||||
)
|
||||
|
||||
correct = numpy.array([[0, 0, 0, 0],
|
||||
[0, 0.25, 0.25, 0],
|
||||
|
|
@ -61,7 +79,13 @@ def test_draw_yshift_4x4() -> None:
|
|||
grid = Grid([xs, ys, zs], shifts=[[0, 0, 0]])
|
||||
arr = grid.allocate(0)
|
||||
|
||||
grid.draw_cuboid(arr, center=[0, 0.5, 0], dimensions=[2, 1.5, 10], foreground=1)
|
||||
grid.draw_cuboid(
|
||||
arr,
|
||||
x=dict(min=-1, max=1),
|
||||
y=dict(center=0.5, span=1.5),
|
||||
z=dict(center=0, span=10),
|
||||
foreground=1,
|
||||
)
|
||||
|
||||
correct = numpy.array([[0, 0, 0, 0],
|
||||
[0, 0.25, 1, 0.25],
|
||||
|
|
@ -78,7 +102,13 @@ def test_draw_2shift_4x4() -> None:
|
|||
grid = Grid([xs, ys, zs], shifts=[[0, 0, 0]])
|
||||
arr = grid.allocate(0)
|
||||
|
||||
grid.draw_cuboid(arr, center=[0.5, 0, 0], dimensions=[1.5, 1, 10], foreground=1)
|
||||
grid.draw_cuboid(
|
||||
arr,
|
||||
x=dict(center=0.5, span=1.5),
|
||||
y=dict(min=-0.5, max=0.5),
|
||||
z=dict(center=0, span=10),
|
||||
foreground=1,
|
||||
)
|
||||
|
||||
correct = numpy.array([[0, 0, 0, 0],
|
||||
[0, 0.125, 0.125, 0],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue