Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tpeulen committed Mar 18, 2024
1 parent 922023b commit d31045d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion examples/labels/plot_path_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
ps = [a.get_particle() for a in IMP.atom.get_leaves(hier)]
path_map.set_particles(ps)
path_map.sample_obstacles(extra_radius=0.0)
# The origin is located on an atom and hence blocked. Thus, there cannot be
# a path to the origin. Hence, unblock sphere around the origin.
path_map.fill_sphere(path_origin, radius=3.0, value=0.0, inverse=False)
path_map.update_tiles()

# %%
Expand All @@ -92,7 +95,7 @@
path_map.find_path_dijkstra(start_idx, -1) # if the end_idx
# %%
# Now, we can backtrace the shortest path from every tile (voxel) to the
# start index. A path is a squence of tile/voxel ids.
# start index. A path is a sequence of tile/voxel ids.
t = path_map.get_tiles()
end_idx_1 = 829
path_1 = t[end_idx_1].backtrack_to_path()
Expand All @@ -102,6 +105,7 @@
path_2 = t[end_idx_2].backtrack_to_path()
print(path_2)


# %%
# Not to all tiles a path can be found. A tile without a path to the
# starting tile has a path-length of 1.
Expand Down
10 changes: 7 additions & 3 deletions examples/labels/plot_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@
# The PathMapHeader defines the grid spacing and the size of the grid used
# in the path search. The grid will have an edge that has twice the maximum
# path length.
max_path_length = 20.0
grid_spacing = 1.0
path_map_header = IMP.bff.PathMapHeader(max_path_length, grid_spacing)
path_map_header_parameter = {
"max_path_length": 20.0,
"grid_spacing": 1.0,
"neighbor_radius": 2,
"obstacle_threshold": 1e-5
}
path_map_header = IMP.bff.PathMapHeader(**path_map_header_parameter)
path_map_header.set_path_origin(path_origin)

# %%
Expand Down
4 changes: 4 additions & 0 deletions examples/release_highlights/plot_release_highlights_0_12_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@
ps = [a.get_particle() for a in IMP.atom.get_leaves(hier)]
path_map.set_particles(ps)
path_map.sample_obstacles(extra_radius=0.0)
# The origin is located on an atom and hence blocked. Thus, there cannot be
# a path to the origin. Hence, unblock sphere around the origin.
path_map.fill_sphere(path_origin, radius=3.0, value=0.0, inverse=False)
path_map.update_tiles()
start_idx = path_map.get_voxel_by_location(path_origin)
path_map.find_path_dijkstra(start_idx, -1) # if the end_idx

t = path_map.get_tiles()
end_idx_1 = 829
path_1 = t[end_idx_1].backtrack_to_path()
print(path_1)

end_idx_2 = 229
path_2 = t[end_idx_2].backtrack_to_path()
Expand Down

0 comments on commit d31045d

Please sign in to comment.