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. The sympy API is the default and pure python, whereas the symengine API is C++ and requires building the symengine library. It can be 100-200 times faster for many operations, but is less fully featured.

The default is symengine if available else sympy, but 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:

str

exception AlreadyUsedEpsilon[source]#

Bases: Exception

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

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#