# Brian (software)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Brian_(software)
> Markdown URL: https://mediated.wiki/source/Brian_(software).md
> Source: https://en.wikipedia.org/wiki/Brian_(software)
> Source revision: 1343746372
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Infobox software
| name                   = Brian
| developer              = Romain Brette, Dan Goodman, Marcel Stimberg
| programming language   = [Python](/source/Python_(programming_language))
| latest release version = {{wikidata|property|edit|reference|P348}}
| latest release date    = {{start date and age|{{wikidata|qualifier|P348|P577}}}}
| operating_system       = [Cross-platform](/source/Cross-platform)
| genre                  = [Neural network software](/source/Neural_network_software)
| license                = [CeCILL](/source/CeCILL)
| website                = {{URL|https://briansimulator.org/}}
}}
{{Portal|Free and open-source software}}
'''Brian''' is an open source [Python](/source/Python_(programming_language)) package for developing simulations of networks of spiking neurons.

==Details==
Brian is aimed at researchers developing models based on networks of [spiking neuron](/source/spiking_neuron)s. The general design is aimed at maximising flexibility, simplicity and users' development speed.<ref name="Goodman">Goodman and Brette 2009</ref> Users specify neuron models by giving their [differential equation](/source/differential_equation)s in standard mathematical form as [strings](/source/String_(computer_science)), create groups of neurons and connect them via [synapse](/source/synapse)s. This is in contrast to the approach taken by many neural simulators in which users select from a predefined set of neuron models.

Brian is written in Python. Computationally, it is based around the concept of code generation: users specify the model in Python but behind the scenes Brian generates, compiles and runs code in one of several languages (including Python, [Cython](/source/Cython) and [C++](/source/C%2B%2B)). In addition there is a "standalone" mode in which Brian generates an entire C++ [source code](/source/source_code) tree with no dependency on Brian, allowing models to be run on platforms where Python is not available.

==Example==
The following code defines, runs and plots a randomly connected network of [leaky integrate and fire neurons](/source/Biological_neuron_model) with exponential inhibitory and excitatory currents.

thumb|Sample raster plot from randomly connected network of integrate and fire neurons with exponential inhibitory and excitatory currents

<syntaxhighlight lang="python">
from brian2 import *

eqs = """
dv/dt  = (ge+gi-(v+49*mV))/(20*ms) : volt
dge/dt = -ge/(5*ms)                : volt
dgi/dt = -gi/(10*ms)               : volt
"""
P = NeuronGroup(4000, eqs, threshold="v>-50*mV", reset="v=-60*mV")
P.v = -60 * mV
Pe = P[:3200]
Pi = P[3200:]
Ce = Synapses(Pe, P, on_pre="ge+=1.62*mV")
Ce.connect(p=0.02)
Ci = Synapses(Pi, P, on_pre="gi-=9*mV")
Ci.connect(p=0.02)
M = SpikeMonitor(P)
run(1 * second)
plot(M.t / ms, M.i, ".")
show()
</syntaxhighlight>

==Comparison to other simulators==
Brian is primarily, although not solely, aimed at single compartment neuron models. Simulators focused on multi-compartmental models include [Neuron](/source/Neuron_(software)), [GENESIS](/source/GENESIS_(software)), and its derivatives.

The focus of Brian is on flexibility and ease of use, and only supports simulations running on a single machine. The [NEST](/source/NEST_(software)) simulator includes facilities for distributing simulations across a cluster.<ref>{{Cite web | url=http://www.nest-initiative.org/ |title = NEST Initiative}}</ref>

==Awards==
* 2023 [Open Science Award for Open Source Research Software](/source/Open_Science_Award_for_Open_Source_Research_Software) in the category "Documentation" <ref>{{Cite web |date=2023-11-30 |title=The 2023 Open Science Free Research Software Awards |url=https://www.ouvrirlascience.fr/the-2023-open-science-free-research-software-awards/ |access-date=2025-12-04 |website=Ouvrir la Science |language=en}}</ref>

==Footnotes==
{{Reflist|2}}

==References==
* {{cite journal | last1 = Goodman | first1 = D. | last2 = Brette | first2 = R. | year = 2008 | title = Brian: a simulator for spiking neural networks in Python | url = http://frontiersin.org/neuroinformatics/paper/10.3389/neuro.11/005.2008/ | journal = Front. Neuroinform. | volume = 2 | issue = | page = 5 | doi = 10.3389/neuro.11.005.2008 | pmid = 19115011 | pmc = 2605403 | doi-access=free }}
* {{cite journal | last1 = Goodman | first1 = D.F.M. | last2 = Brette | first2 = R. | year = 2009 | title = The Brian simulator | url = http://frontiersin.org/neuroscience/paper/10.3389/neuro.01/026.2009/ | journal = Front. Neurosci. | volume =  3| issue = | pages =  192–197| doi = 10.3389/neuro.01.026.2009 | doi-access=free | hdl = 10044/1/40622 | hdl-access = free | pmc = 2751620 }}

==External links==
* {{Official website|https://briansimulator.org/}}

Category:Computational neuroscience
Category:Scientific simulation software
Category:Free science software
Category:Neuroscience software
Category:Python (programming language) libraries
Category:Software using the CeCILL license

{{Science-software-stub}}
{{Programming-software-stub}}

---
Adapted from the Wikipedia article [Brian (software)](https://en.wikipedia.org/wiki/Brian_(software)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Brian_(software)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
