autoray.lazy.draw
¶
Visualizations for LazyArray
computational graphs.
Module Contents¶
Functions¶
|
Set the seed for the random color generator. |
|
|
|
Generate a random color for a string |
|
|
|
|
|
|
|
Return a rotated set of points. |
|
Return the vertical span of the points. |
|
Rotate a position dict's points to cover a small vertical span |
|
|
|
|
|
Plot the computational graph of this |
|
|
Wrap a function or method to use the neutral style by default. |
|
|
Plot the memory footprint throughout this computation. |
|
Plot the functions used throughout this computation, color coded, as |
|
Attributes¶
- autoray.lazy.draw.COLORING_SEED = 1¶
- autoray.lazy.draw.set_coloring_seed(seed)[source]¶
Set the seed for the random color generator.
- Parameters:
seed (int) – The seed to use.
- autoray.lazy.draw.hash_to_color(s, hmin=0.0, hmax=1.0, smin=0.3, smax=0.8, vmin=0.8, vmax=1.0)[source]¶
Generate a random color for a string
s
.- Parameters:
s (str) – The string to generate a color for.
hmin (float, optional) – The minimum hue value.
hmax (float, optional) – The maximum hue value.
smin (float, optional) – The minimum saturation value.
smax (float, optional) – The maximum saturation value.
vmin (float, optional) – The minimum value value.
vmax (float, optional) – The maximum value value.
- Returns:
color – A tuple of floats in the range [0, 1] representing the RGB color.
- Return type:
tuple
- autoray.lazy.draw.massage_pos(pos, nangles=180, flatten=False)[source]¶
Rotate a position dict’s points to cover a small vertical span
- autoray.lazy.draw.HAS_FA2¶
- autoray.lazy.draw.HAS_PYGRAPHVIZ¶
- autoray.lazy.draw.get_nice_pos(G, *, dim=2, layout='auto', initial_layout='auto', iterations='auto', k=None, use_forceatlas2=False, flatten=False, **layout_opts)[source]¶
- autoray.lazy.draw.plot_graph(self, variables=None, dim=2, layout='auto', initial_layout='auto', iterations='auto', k=None, use_forceatlas2=False, color_by='function', colors=None, connectionstyle='arc3,rad=-0.05', arrowsize=6, edge_color=(0.5, 0.5, 0.5), edge_alpha=0.3, var_color=(0, 0.5, 0.25), const_color=(0, 0.5, 1.0), root_color=(1, 0, 0.5), node_shape='s', node_scale=1.0, node_alpha=1.0, show_labels=True, label_color=(0.5, 0.5, 0.5), label_alpha=1.0, font_size=8, label_rotation=45, figsize=None, ax=None, show_and_close=True, **layout_opts)[source]¶
Plot the computational graph of this
LazyArray
.
- autoray.lazy.draw.plot_circuit(self, color_by='function', colors=None, layout='balanced', linewidth=None, linewidth_scale=1, linealpha=1.0, fontsize=None, fontsize_scale=1, figsize=None, ax=None, show_and_close=True)[source]¶
- autoray.lazy.draw.NEUTRAL_STYLE¶
- autoray.lazy.draw.default_to_neutral_style(fn)[source]¶
Wrap a function or method to use the neutral style by default.
- autoray.lazy.draw.plot_history_size_footprint(self, log=None, figsize=(8, 2), color='purple', alpha=0.5, rasterize=4096, rasterize_dpi=300, ax=None, show_and_close=True)[source]¶
Plot the memory footprint throughout this computation.
- Parameters:
log (None or int, optional) – If not None, display the sizes in base
log
.figsize (tuple, optional) – Size of the figure.
color (str, optional) – Color of the line.
alpha (float, optional) – Alpha of the line.
ax (matplotlib.axes.Axes, optional) – Axes to plot on, will be created if not provided.
return_fig (bool, optional) – If True, return the figure object, else just show and close it.
- autoray.lazy.draw.plot_history_functions(self, *, fn=None, log=None, colors=None, kind='scatter', scatter_size=5, scatter_marker='s', lines_width=5, image_alpha_pow=2 / 3, image_aspect=4, legend=True, legend_ncol=None, legend_bbox_to_anchor=None, legend_loc=None, rasterize=4096, rasterize_dpi=300, ax=None, figsize=(8, 2), show_and_close=True)[source]¶
Plot the functions used throughout this computation, color coded, as either a scatter plot or an image, showing the size of the that individual intermediate as well.