symforce.notebook_util module

Helpers for interactive use in a Jupyter notebook with an IPython kernel.

set_notebook_defaults()[source]

Change SymForce defaults to be more friendly for Jupyter notebooks.

  • Use LaTeX-friendly symbols (ops.StorageOps.set_use_latex_friendly_symbols)

Return type:

None

display(*args)[source]

Display the given expressions in latex, or print if not an expression.

Parameters:

args (Any) –

Return type:

None

display_code(code, language=None)[source]

Display code with syntax highlighting.

Parameters:
  • code (str) – Source code

  • language (str | None) – {python, c++, anything supported by pygments}

Return type:

None

display_code_file(path, language)[source]

Display code from a file path with syntax highlighting.

Parameters:
  • path (str | PathLike) – Path to source file

  • language (str) – {python, c++, anything supported by pygments}

Return type:

None

print_expression_tree(expr, assumptions=False)[source]

Print a SymPy expression tree, ignoring node attributes

Parameters:
  • expr (Expr) – The expression to print

  • assumptions (bool) – Whether to include assumption information for nodes. See sympy.printing.tree for more information.

Return type:

None