braincell.quad.get_integrator

Contents

braincell.quad.get_integrator#

braincell.quad.get_integrator(method)[source]#

Resolve a numerical integrator from a string name or a callable.

Parameters:

method (str | Callable) – Either the registered name (canonical or alias) of an integrator or a step function to use directly.

Returns:

The integrator step function corresponding to method.

Return type:

Callable

Raises:
  • ValueError – If method is a string that does not match any registered integrator. The error message includes a “did you mean …?” suggestion when a close match exists.

  • TypeError – If method is neither a string nor a callable.

Examples

>>> from braincell.quad import get_integrator
>>> get_integrator('euler')
<function euler_step at ...>
>>> get_integrator('explicit') is get_integrator('euler')
True
>>> get_integrator('stagger') is get_integrator('staggered')
True