# Description of problem

I am a newbie to working with Brian and with Python. I wish to apply our lab’s recorded data to a neural network by assigning different values for a parameter, e.g. “a”, to different subgroups. I am afraid I don’t know coding well enough to solve this probably simple task. Thanks to anyone for helping out!

# Minimal code to reproduce problem

```
#Relevant Parameters (only)
N=1000
a=0.0012/ms
#Neuron Group PYR
PYR = NeuronGroup(N, model=eqs_pyr, reset= reset, threshold='v >= vpeak', method = 'euler')
#My attempt to assign different values of a to different subsets:
PYR1=PYR[500:]
PYR2=PYR[:500]
if PYR1:
a=0.0012/ms
if PYR2:
a=0.005/ms
```

This is clearly not accomplishing the task, since however large/small the two subgroups, the behavior of neurons in the different subgroups is the same.

Hi @MitchG_HunterCollege. In Brian, variables that are defined outside the model equations (such as `a`

in your example) have a single, global value. Also – but this is how Python works, not specific to Brian – these lines

```
if PYR1:
a=0.0012/ms
if PYR2:
a=0.005/ms
```

will only have the effect of overwriting the value of `a`

twice, and only the final value can be taken into account by Brian. If you use an object directly in an `if`

condition, it will be converted to a boolean value. For container types (lists, etc.), this will usually be “`False`

if empty, `True`

otherwise”. So in this specific case, your code is equivalent to writing

```
a = 0.0012/ms
a = 0.005/ms
```

and therefore doesn’t have the desired effect.

Long story short, to have a parameter that is different across neurons, you need to include it in the model equations. The parameter is then available as an attribute of the `NeuronGroup`

object. Here’s a minimal example with a `NeuronGroup`

that does not actually define any neuronal model, but only the parameter:

```
PYR = NeuronGroup(10, model="a : 1/second (constant)")
PYR1 = PYR[:5]
PYR2 = PYR[5:]
PYR1.a = 0.0012/ms
PYR2.a = 0.005/ms
print(PYR.a[:])
```

prints

```
[1.2 1.2 1.2 1.2 1.2 5. 5. 5. 5. 5. ] Hz
```

showing that it has assigned the values to the respective subpopulations. Hope that makes things clearer!