yt.testing.amrspace

yt.testing.amrspace(extent, levels=7, cells=8)[source]

Creates two numpy arrays representing the left and right bounds of an AMR grid as well as an array for the AMR level of each cell.

Parameters:

extent : array-like

This a sequence of length 2*ndims that is the bounds of each dimension. For example, the 2D unit square would be given by [0.0, 1.0, 0.0, 1.0]. A 3D cylindrical grid may look like [0.0, 2.0, -1.0, 1.0, 0.0, 2*np.pi].

levels : int or sequence of ints, optional

This is the number of AMR refinement levels. If given as a sequence (of length ndims), then each dimension will be refined down to this level. All values in this array must be the same or zero. A zero valued dimension indicates that this dim should not be refined. Taking the 3D cylindrical example above if we don’t want refine theta but want r and z at 5 we would set levels=(5, 5, 0).

cells : int, optional

This is the number of cells per refinement level.

Returns:

left : float ndarray, shape=(npoints, ndims)

The left AMR grid points.

right : float ndarray, shape=(npoints, ndims)

The right AMR grid points.

level : int ndarray, shape=(npoints,)

The AMR level for each point.

Examples

>>> l, r, lvl = amrspace([0.0, 2.0, 1.0, 2.0, 0.0, 3.14], levels=(3,3,0), cells=2)
>>> print l
[[ 0.     1.     0.   ]
 [ 0.25   1.     0.   ]
 [ 0.     1.125  0.   ]
 [ 0.25   1.125  0.   ]
 [ 0.5    1.     0.   ]
 [ 0.     1.25   0.   ]
 [ 0.5    1.25   0.   ]
 [ 1.     1.     0.   ]
 [ 0.     1.5    0.   ]
 [ 1.     1.5    0.   ]]