# SynapticPathway class

(Shortest import: `from brian2.synapses.synapses import SynapticPathway)`

class brian2.synapses.synapses.SynapticPathway(*args, **kw)

  Bases: `CodeRunner`, `Group`

  The `CodeRunner` that applies the pre/post statement(s) to the state variables of synapses where the pre-/postsynaptic group spiked in this time step.

  Parameters:

    synapses : `Synapses`

    > Reference to the main `Synapses` object

    prepost : {‘pre’, ‘post’}

    > Whether this object should react to pre- or postsynaptic spikes

    objname : str, optional

    > The name to use for the object, will be appendend to the name of `synapses` to create a name in the sense of `Nameable`. If `None` is provided (the default), `prepost` will be used.

    delay : `Quantity`, optional

    > A scalar delay (same delay for all synapses) for this pathway. If not given, delays are expected to vary between synapses.

  Attributes

  `_initialise_queue_codeobj` | The `CodeObject` initalising the `SpikeQueue` at the begin of a run
  `queue` | The `SpikeQueue`

  Methods

  `before_run`(run_namespace) | Optional method to prepare the object before a run.
  `check_variable_write`(variable) | Function that can be overwritten to raise an error if writing to a variable should not be allowed.
  `create_code_objects`(run_namespace) |
  `initialise_queue`() |
  `push_spikes`() |
  `update_abstract_code`([run_namespace, level]) | Update the abstract code for the code object.

  Details

  _initialise_queue_codeobj

    The `CodeObject` initalising the `SpikeQueue` at the begin of a run

  queue

    The `SpikeQueue`

  before_run(run_namespace)

    Optional method to prepare the object before a run.

    Called by `Network.after_run` before the main simulation loop starts.

  check_variable_write(variable)

    Function that can be overwritten to raise an error if writing to a variable should not be allowed. Note that this does not deal with incorrect writes that are general to all kind of variables (incorrect units, writing to a read-only variable, etc.). This function is only used for type-specific rules, e.g. for raising an error in `Synapses` when writing to a synaptic variable before any `connect` call.

    By default this function does nothing.

    Parameters:

      variable : `Variable`

      > The variable that the user attempts to set.

  create_code_objects(run_namespace)
  initialise_queue()
  push_spikes()
  update_abstract_code(run_namespace=None, level=0)

    Update the abstract code for the code object. Will be called in `before_run` and should update the `CodeRunner.abstract_code` attribute.

    Does nothing by default.