hd.TIME_FACTOR = 2000 hd.TIME_STEP = 1e-5 hd.ALGORITHM = "forward" matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 circles = [] circles.append(Circle(origin=[.1, .0], radius=0.1)) circles.append(Circle(origin=[.1, .25], radius=0.05)) circles.append(Circle(origin=[.2, .25], radius=0.05)) circles.append(Circle(origin=[.0, .25], radius=0.05)) workspace = Workspace() workspace.obstacles = circles renderer = WorkspaceDrawer(workspace, rows=ROWS, cols=COLS) x_source = np.array([0.2, 0.15]) # ------------------------------------------------------------------------------ iterations = ROWS * COLS U = hd.heat_diffusion(workspace, x_source, iterations) for i in range(iterations): renderer.set_drawing_axis(i) renderer.draw_ws_obstacles() renderer.draw_ws_point([x_source[0], x_source[1]], color='r', shape='o') renderer.background_matrix_eval = False renderer.draw_ws_img(U[i], interpolate="bicubic", color_style=plt.cm.tab20c) renderer.show()
# PERFORMANCE OF THIS SOFTWARE. # # Jim Mainprice on Wed January 22 2019 from demos_common_imports import * from pyrieef.geometry.workspace import * from pyrieef.geometry import heat_diffusion from pyrieef.rendering.workspace_renderer import WorkspaceDrawer import matplotlib.pyplot as plt ROWS = 1 COLS = 2 heat_diffusion.NB_POINTS = 101 heat_diffusion.TIME_FACTOR = 50 heat_diffusion.ALGORITHM = "forward" iterations = 10 workspace = Workspace() source = [0, 0] renderer = WorkspaceDrawer(workspace, rows=ROWS, cols=COLS) U = heat_diffusion.heat_diffusion(workspace, source, iterations) U_e = heat_diffusion.compare_with_kernel(U[-1], 9.020E-03, workspace) for i in range(2): renderer.set_drawing_axis(i) renderer.draw_ws_obstacles() renderer.draw_ws_point(source, color='k', shape='o') renderer.background_matrix_eval = False renderer.draw_ws_img(U[-1] if i == 0 else U_e, interpolate="none", color_style=plt.cm.gray) renderer.show()