# extract_method_options function

(Shortest import: `from brian2.stateupdaters.base import extract_method_options)`

brian2.stateupdaters.base.extract_method_options(method_options, default_options)

  Helper function to check `method_options` against options understood by this state updater, and setting default values for all unspecified options.

  Parameters:

    method_options : dict or None

    > The options that the user specified for the state update.

    default_options : dict

    > The default option values for this state updater (each admissible option needs to be present in this dictionary). To specify that a state updater does not take any options, provide an empty dictionary as the argument.

  Returns:

    options : dict

    > The final dictionary with all the options either at their default or at the user-specified value.

  Raises

  `KeyError`

    If the user specifies an option that is not understood by this state updater.

  Examples

      >>> options = extract_method_options({'a': True}, default_options={'b': False, 'c': False})
      Traceback (most recent call last):
      ...
      KeyError: 'method_options specifies "a", but this is not an option for this state updater. Avalaible options are: "b", "c".'
      >>> options = extract_method_options({'a': True}, default_options={})
      Traceback (most recent call last):
      ...
      KeyError: 'method_options specifies "a", but this is not an option for this state updater. This state updater does not accept any options.'
      >>> options = extract_method_options({'a': True}, default_options={'a': False, 'b': False})
      >>> sorted(options.items())
      [('a', True), ('b', False)]