def setup_all_grid_types(self, u, d):

    np.random.seed(141412)

    self.grid = {}

    # Cartesian
    x = np.linspace(-u, u, 8)
    y = np.linspace(-u, u, 6)
    z = np.linspace(-u, u, 4)
    self.grid['car'] = CartesianGrid(x, y, z)

    # Cylindrical polar
    w = np.linspace(0., 2. * u, 8)
    z = np.linspace(-u, u, 4)
    p = np.linspace(0., 2. * np.pi, 6)
    self.grid['cyl'] = CylindricalPolarGrid(w, z, p)

    # Spherical polar
    r = np.linspace(0., 3. * u, 6)
    t = np.linspace(0., np.pi, 8)
    p = np.linspace(0., 2. * np.pi, 4)
    self.grid['sph'] = SphericalPolarGrid(r, t, p)

    # AMR

    self.grid['amr'] = AMRGrid()

    level1 = self.grid['amr'].add_level()
    grid = level1.add_grid()
    grid.xmin, grid.xmax = -u, u
    grid.ymin, grid.ymax = -u, u
    grid.zmin, grid.zmax = -u, u
    grid.nx, grid.ny, grid.nz = 8, 6, 4
    grid.quantities['density'] = np.random.random((4, 6, 8)) * d
    grid.quantities['density_2'] = np.random.random((4, 6, 8)) * d
    grid.quantities['density_3'] = np.random.random((4, 6, 8)) * d

    level2 = self.grid['amr'].add_level()
    grid2 = level2.add_grid()
    grid2.xmin, grid2.xmax = -u, 0.
    grid2.ymin, grid2.ymax = -u, 0.
    grid2.zmin, grid2.zmax = -u, 0.
    grid2.nx, grid2.ny, grid2.nz = 4, 6, 20
    grid2.quantities['density'] = np.random.random((20, 6, 4)) * d
    grid2.quantities['density_2'] = np.random.random((20, 6, 4)) * d
    grid2.quantities['density_3'] = np.random.random((20, 6, 4)) * d

    # Octree
    refined = [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
               0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
    self.grid['oct'] = OctreeGrid(0., 0., 0., u, u, u, np.array(refined).astype(bool))

    # Set up initial densities
    self.density = {}
    self.density['car'] = np.random.random(self.grid['car'].shape) * d
    self.density['cyl'] = np.random.random(self.grid['cyl'].shape) * d
    self.density['sph'] = np.random.random(self.grid['sph'].shape) * d
    self.density['amr'] = self.grid['amr']['density']
    self.density['oct'] = np.random.random(len(refined)) * d

    # Second set of densities
    self.density_2 = {}
    self.density_2['car'] = np.random.random(self.grid['car'].shape) * d
    self.density_2['cyl'] = np.random.random(self.grid['cyl'].shape) * d
    self.density_2['sph'] = np.random.random(self.grid['sph'].shape) * d
    self.density_2['amr'] = self.grid['amr']['density_2']
    self.density_2['oct'] = np.random.random(len(refined)) * d

    # Third set of densities
    self.density_3 = {}
    self.density_3['car'] = np.random.random(self.grid['car'].shape) * d
    self.density_3['cyl'] = np.random.random(self.grid['cyl'].shape) * d
    self.density_3['sph'] = np.random.random(self.grid['sph'].shape) * d
    self.density_3['amr'] = self.grid['amr']['density_3']
    self.density_3['oct'] = np.random.random(len(refined)) * d
All grids are guaranteed to cover the volume from -u to u in x, y, z
dataset/ETHPy150Open hyperion-rt/hyperion/hyperion/model/tests/test_bit_level.py/setup_all_grid_types