API
This page documents the supported top-level public API from
drcutils.__all__.
Top-level groups:
Module facades:
brand,data,runtime,vizBrand utilities:
COLORS,flag,watermarkData utility:
convertRuntime helpers:
is_notebook,is_google_colabVisualization helpers:
export_figure,get_figure_preset,visualize_network,visualize_stl
Public package exports for drcutils.
- drcutils.convert(thing_to_convert_from, thing_to_convert_to, from_kwargs=None, to_kwargs=None)[source]
Convert supported files to another supported format.
- Parameters:
thing_to_convert_from – Source file path.
thing_to_convert_to – Target file path.
from_kwargs – Optional keyword args for the input reader.
to_kwargs – Optional keyword args for the output writer.
- Raises:
ValueError – If conversion is unsupported.
- drcutils.export_figure(fig, outpath_stem, *, targets=None, formats=None, dpi=300, transparent=False, tight=True, font_family=None, base_fontsize=None, embed_fonts=True, metadata=None)[source]
Export a Matplotlib figure for publication presets.
- Parameters:
fig – Matplotlib figure object to export.
outpath_stem – Base output path stem.
targets – Preset targets to render.
formats – Output formats such as
pdf,png, orsvg.dpi – Raster resolution for bitmap outputs.
transparent – Whether to export with transparent background.
tight – Whether to save with tight bounding boxes.
font_family – Optional font family override.
base_fontsize – Optional base font size override.
embed_fonts – Whether to configure embedded/export-friendly fonts.
metadata – Optional metadata mapping passed to savefig.
- Returns:
A dictionary containing generated file paths, resolved settings, and warnings.
- drcutils.get_figure_preset(target)[source]
Return figure preset settings for a named target.
- Parameters:
target – One of
one_col,two_col, orslide_16x9.- Returns:
A dictionary with width, height, and font scale.
- Raises:
ValueError – If target is unknown.
- drcutils.is_google_colab()[source]
Determine whether or not the environment is in Google Colab.
- Returns:
Truewhen running in Google Colab.
- drcutils.is_notebook()[source]
Determine whether or not the environment is in a notebook.
- Returns:
Truewhen running in a notebook runtime.
- drcutils.visualize_network(path, height=500, port=8000)[source]
Visualize a neural network with Netron.
- Parameters:
path – Filepath to the saved neural network.
height – Height of the iframe visualization in pixels.
port – Port on which the visualization is served.
- Returns:
None. Opens the visualization in an iframe (notebook) or browser (terminal).