pt_select = results > opts.overlap_threshold selected = selected[pt_select] results = results[pt_select] grid, spacing = amrlib.refine_regular_grid(selected, spacing, return_cntr=True) else: grid, spacing = amrlib.refine_regular_grid(selected, spacing, return_cntr=opts.setup) print "%d cells after refinement" % len(grid) grid = amrlib.prune_duplicate_pts(grid, init_region._bounds, spacing) # # Clean up # grid = numpy.array(grid) bounds_mask = amrlib.check_grid(grid, intr_prms, opts.distance_coordinates) grid = grid[bounds_mask] print "%d cells after bounds checking" % len(grid) if len(grid) == 0: exit("All cells would be removed by physical boundaries.") # Convert back to physical mass grid = amrlib.apply_inv_transform(grid, intr_prms, opts.distance_coordinates) cells = amrlib.grid_to_cells(grid, spacing) if opts.setup: grid_group = amrlib.init_grid_hdf(init_region, opts.setup + ".hdf", opts.overlap_threshold, opts.distance_coordinates, intr_prms=intr_prms) level = amrlib.save_grid_cells_hdf(grid_group, cells, "mass1_mass2", intr_prms=intr_prms) else: grp = amrlib.load_grid_level(opts.refine, None)
spacing, return_cntr=True) else: grid, spacing = amrlib.refine_regular_grid(selected, spacing, return_cntr=opts.setup) print "%d cells after refinement" % len(grid) grid = amrlib.prune_duplicate_pts(grid, init_region._bounds, spacing) # # Clean up # grid = numpy.array(grid) bounds_mask = amrlib.check_grid(grid, intr_prms, opts.distance_coordinates) grid = grid[bounds_mask] print "%d cells after bounds checking" % len(grid) if len(grid) == 0: exit("All cells would be removed by physical boundaries.") # Convert back to physical mass grid = amrlib.apply_inv_transform(grid, intr_prms, opts.distance_coordinates) cells = amrlib.grid_to_cells(grid, spacing) if opts.setup: grid_group = amrlib.init_grid_hdf(init_region, opts.setup + ".hdf", opts.overlap_threshold, opts.distance_coordinates,