# brian2 package

Brian 2

Functions

`check_cache`(target) |

`clear_cache`(target) | Clears the on-disk cache with the compiled files for a given code generation target.

## `_version` module

Exported members: `__version__`, `__version_tuple__`, `version`, `version_tuple`

## `hears` module

This is only a bridge for using Brian 1 hears with Brian 2.

Deprecated since version 2.2.2.2: Use the brian2hears package instead.

NOTES:

- Slicing sounds with Brian 2 units doesn’t work, you need to either use Brian 1 units or replace calls to `sound[:20*ms]` with `sound.slice(None, 20*ms)`, etc.

TODO: handle properties (e.g. sound.duration)

Not working examples:

- time_varying_filter1 (care with units)

Exported members: `convert_unit_b1_to_b2`, `convert_unit_b2_to_b1`

Classes

`BridgeSound`() | We add a new method slice because slicing with units can't work with Brian 2 units.

`FilterbankGroup`(*args, **kw) |

`Sound` | alias of `BridgeSound`

`WrappedSound` | alias of `new_class`

Functions

`convert_unit_b1_to_b2`(val) |

`convert_unit_b2_to_b1`(val) |

`modify_arg`(arg) | Modify arguments to make them compatible with Brian 1.

`wrap_units`(f) | Wrap a function to convert units into a form that Brian 1 can handle.

`wrap_units_class`(_C) | Wrap a class to convert units into a form that Brian 1 can handle in all methods

`wrap_units_property`(p) |

## `numpy_` module

A dummy package to allow importing numpy and the unit-aware replacements of numpy functions without having to know which functions are overwritten.

This can be used for example as `import brian2.numpy_ as np`

Exported members: `False_`, `ScalarType`, `True_`, `__array_namespace_info__`, `__version__`, `abs`, `absolute`, `acos`, `acosh`, `add`, `all`, `allclose`, `amax`, `amin`, `angle`, `any`, `append`, `apply_along_axis`, `apply_over_axes`, `arange()`, `arange()`, `arccos()`, `arccos()`, `arccosh()`, `arccosh()` … (504 more members)

## `only` module

A dummy package to allow wildcard import from brian2 without also importing the pylab (numpy + matplotlib) namespace.

Usage: `from brian2.only import *`

Exported members: `BinomialFunction`, `BrianLogger`, `BrianObject`, `BrianObjectException`, `BrianPreference`, `Clock`, `CodeRunner`, `Cylinder`, `CythonCodeObject`, `DEFAULT_CONSTANTS`, `DEFAULT_FUNCTIONS`, `DEFAULT_FUNCTIONS`, `DEFAULT_UNITS`, `DimensionMismatchError`, `Equations`, `EventMonitor`, `ExplicitStateUpdater`, `Expression`, `Function`, `Gamp`, `Gcoulomb`, `Gfarad`, `Ggram`, `Ggramme`, `Ghertz` … (305 more members)

Functions

`restore_initial_state`() | Restores internal Brian variables to the state they are in when Brian is imported

## Subpackages

- codegen package
  - `_prefs` module
  - `codeobject` module
  - `cpp_prefs` module
  - `get_cpu_flags` module
  - `optimisation` module
  - `permutation_analysis` module
  - `statements` module
  - `targets` module
  - `templates` module
  - `translation` module
  - Subpackages
- core package
  - Built-in preferences
  - `base` module
  - `clocks` module
  - `core_preferences` module
  - `functions` module
  - `magic` module
  - `names` module
  - `namespace` module
  - `network` module
  - `operations` module
  - `preferences` module
  - `spikesource` module
  - `tracking` module
  - `variables` module
- devices package
  - `device` module
  - Subpackages
- equations package
  - `codestrings` module
  - `equations` module
  - `refractory` module
  - `unitcheck` module
- groups package
  - `group` module
  - `neurongroup` module
  - `subgroup` module
- importexport package
  - `dictlike` module
  - `importexport` module
- input package
  - `binomial` module
  - `poissongroup` module
  - `poissoninput` module
  - `spikegeneratorgroup` module
  - `timedarray` module
- memory package
  - `dynamicarray` module
- monitors package
  - `ratemonitor` module
  - `spikemonitor` module
  - `statemonitor` module
- parsing package
  - `bast` module
  - `dependencies` module
  - `expressions` module
  - `functions` module
  - `rendering` module
  - `statements` module
  - `sympytools` module
- spatialneuron package
  - `morphology` module
  - `spatialneuron` module
- stateupdaters package
  - `GSL` module
  - `base` module
  - `exact` module
  - `explicit` module
  - `exponential_euler` module
- synapses package
  - `parse_synaptic_generator_syntax` module
  - `spikequeue` module
  - `synapses` module
- units package
  - `allunits` module
  - `constants` module
  - `fundamentalunits` module
  - `stdunits` module
  - `unitsafefunctions` module
- utils package
  - `arrays` module
  - `caching` module
  - `environment` module
  - `filelock` module
  - `filetools` module
  - `logger` module
  - `stringtools` module
  - `topsort` module