コード例 #1
0
    selected = get_evidence_grid(selected, res_pts, intr_prms)

    if opts.verbose:
        print "Loaded %d result points" % len(selected)

    if opts.refine:
        # FIXME: We use overlap threshold as a proxy for confidence level
        selected = get_cr_from_grid(selected, results, cr_thr=opts.overlap_threshold)
        print "Selected %d cells from %3.2f%% confidence region" % (len(selected), opts.overlap_threshold*100)

if opts.prerefine:
    print "Performing refinement for points with overlap > %1.3f" % opts.overlap_threshold
    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)
コード例 #2
0
    if opts.refine:
        # FIXME: We use overlap threshold as a proxy for confidence level
        selected = get_cr_from_grid(selected,
                                    results,
                                    cr_thr=opts.overlap_threshold)
        print "Selected %d cells from %3.2f%% confidence region" % (
            len(selected), opts.overlap_threshold * 100)

if opts.prerefine:
    print "Performing refinement for points with overlap > %1.3f" % opts.overlap_threshold
    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)
コード例 #3
0
    #spacing /= 2
    selected = amrlib.apply_transform(selected, intr_prms, opts.distance_coordinates)

    grid_tree = BallTree(selected)
    grid_idx = []
    # Reorder the grid points to match their weight indices
    for res in res_pts:
        dist, idx = grid_tree.query(res, k=1)
        # Stupid floating point inexactitude...
        #assert all([numpy.isclose(a, b) for a, b in zip(res, selected[idx[0][0]])])
        grid_idx.append(idx[0][0])
    selected = get_cr_from_grid(selected[grid_idx], results, cr_thr=0.9)
    print "Selected %d cells from %.2f%% confidence region" % (len(selected), 0.9)
####

grid, spacing = amrlib.refine_regular_grid(selected, spacing)
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.")
コード例 #4
0
                                      opts.distance_coordinates)

    grid_tree = BallTree(selected)
    grid_idx = []
    # Reorder the grid points to match their weight indices
    for res in res_pts:
        dist, idx = grid_tree.query(res, k=1)
        # Stupid floating point inexactitude...
        #assert all([numpy.isclose(a, b) for a, b in zip(res, selected[idx[0][0]])])
        grid_idx.append(idx[0][0])
    selected = get_cr_from_grid(selected[grid_idx], results, cr_thr=0.9)
    print "Selected %d cells from %.2f%% confidence region" % (len(selected),
                                                               0.9)
####

grid, spacing = amrlib.refine_regular_grid(selected, spacing)
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.")