symforce package¶

The top-level symforce package

Importing this by itself performs minimal initialization configuration, and the functions here are mostly for configuration purposes.

In particular, this primarily performs configuration that you might need before importing symforce.symbolic.

set_log_level(log_level)[source]¶

Set symforce logger level.

The default is INFO, but can be set by one of:

  1. The SYMFORCE_LOGLEVEL environment variable

  2. Calling this function before any other symforce imports

Parameters:

log_level (str) – {DEBUG, INFO, WARNING, ERROR, CRITICAL}

Return type:

None

exception InvalidSymbolicApiError(api)[source]¶

Bases: Exception

Parameters:

api (str) –

set_symbolic_api(name)[source]¶

Set the symbolic API for symforce

See the SymPy tutorial for information on the symbolic APIs that can be used: https://symforce.org/tutorials/sympy_tutorial.html

By default, SymForce will use the symengine API if it is available. If the symbolic API is set to sympy it will use that. If symengine is not available and the symbolic API was not set, it will emit a warning and use the sympy API.

The symbolic API can be set by one of:

  1. The SYMFORCE_SYMBOLIC_API environment variable

  2. Calling this function before any other symforce imports

Parameters:

name (str) – {sympy, symengine}

Return type:

None

get_symbolic_api()[source]¶

Return the current symbolic API as a string.

Return type:

Literal[‘sympy’, ‘symengine’]

exception AlreadyUsedEpsilon[source]¶

Bases: Exception

Exception thrown on attempting to modify the default epsilon after it has been used elsewhere

class SymbolicEpsilon(name)[source]¶

Bases: object

An indicator that SymForce should use a symbolic epsilon

Parameters:

name (str) –

name: str¶
set_epsilon_to_symbol(name='epsilon')[source]¶

Set the default epsilon for Symforce to a Symbol.

This must be called before symforce.symbolic or other symbolic libraries have been imported. See symforce.symbolic.epsilon() for more information.

Parameters:

name (str) – The name of the symbol for the new default epsilon to use

Return type:

None

set_epsilon_to_number(value=2.220446049250313e-15)[source]¶

Set the default epsilon for Symforce to a number.

This must be called before symforce.symbolic or other symbolic libraries have been imported. See symforce.symbolic.epsilon() for more information.

Parameters:

value (Any) – The new default epsilon to use

Return type:

None

set_epsilon_to_zero()[source]¶

Set the default epsilon for Symforce to zero.

This must be called before symforce.symbolic or other symbolic libraries have been imported. See symforce.symbolic.epsilon() for more information.

Return type:

None

set_epsilon_to_invalid()[source]¶

Set the default epsilon for SymForce to None. Should not be used to actually create expressions or generate code.

This is useful if you’ve forgotten to pass an epsilon somewhere, but are not sure where - using this epsilon in an expression should throw a TypeError near the location where you forgot to pass an epsilon.

This must be called before symforce.symbolic or other symbolic libraries have been imported. See symforce.symbolic.epsilon() for more information.

Return type:

None

Subpackages¶

Submodules¶