Ejemplo n.º 1
0
def parameterise_leaky_integrate_and_fire(definition=None):
    if definition is None:
        definition = create_leaky_integrate_and_fire()
    comp = ul.DynamicsProperties(
        name='SampleLeakyIntegrateAndFire',
        definition=create_leaky_integrate_and_fire(),
        properties=[ul.Property('tau', 20.0 * un.ms),
                    ul.Property('v_threshold', 20.0 * un.mV),
                    ul.Property('refractory_period', 2.0 * un.ms),
                    ul.Property('v_reset', 10.0 * un.mV),
                    ul.Property('R', 1.5 * un.Mohm)],
        initial_values=[ul.Initial('V', -70 * un.mV)])
    return comp
Ejemplo n.º 2
0
def parameterise_static():

    comp = ul.DynamicsProperties(
        name='SampleAlpha',
        definition=create_static(),
        properties=[ul.Property('weight', 10.0 * un.nA)])
    return comp
Ejemplo n.º 3
0
def build_parameter_set(parameters, shape=None, dimensionless=False):
    parameter_list = []
    for name, value in parameters.items():
        if isinstance(value, larray):
            value.shape = shape
            if value.is_homogeneous:
                value = value.evaluate(simplify=True)
                if isinstance(value, Sequence):
                    value = value.value.tolist()
                elif isinstance(value, bool):
                    value = int(value)
            elif isinstance(value, random.RandomDistribution):
                rand_distr = value
                value = nineml.RandomDistributionComponent(
                    name="%s(%s)" % (rand_distr.name, ",".join(str(p) for p in rand_distr.parameters)),
                    definition=nineml.Definition(random_distribution_url_map[rand_distr.name],
                                                 "random"),
                    parameters=build_parameter_set(map_random_distribution_parameters(rand_distr.name, rand_distr.parameters),
                                                   dimensionless=True))
            else:
                raise Exception("not supported")
        else:
            if isinstance(value, bool):
                value = int(value)
        if dimensionless:
            unit = "dimensionless"
        elif isinstance(value, basestring):
            unit = None
        else:
            unit = infer_units(name)
        parameter_list.append(nineml.Property(name, value, unit))
    return nineml.PropertySet(*parameter_list)
Ejemplo n.º 4
0
def parameterise_alpha():

    comp = ul.DynamicsProperties(name='SampleAlpha',
                                 definition=create_alpha(),
                                 properties=[ul.Property('tau', 20.0 * un.ms)],
                                 initial_values=[
                                     ul.Initial('a', 0.0 * un.pA),
                                     ul.Initial('b', 0.0 * un.pA)
                                 ])
    return comp
Ejemplo n.º 5
0
def parameterise_izhikevich_fast_spiking(definition=None):
    if definition is None:
        definition = create_izhikevich_fast_spiking()
    comp = ul.DynamicsProperties(name='SampleIzhikevichFastSpiking',
                                 definition=create_izhikevich_fast_spiking(),
                                 properties=[
                                     ul.Property('a', 0.2 * un.per_ms),
                                     ul.Property('b',
                                                 0.025 * un.nS / un.mV**2),
                                     ul.Property('c', -45 * un.mV),
                                     ul.Property('k', 1 * un.nS / un.mV),
                                     ul.Property('Vpeak', 25 * un.mV),
                                     ul.Property('Vb', -55 * un.mV),
                                     ul.Property('Cm', 20 * un.pF),
                                     ul.Property('Vr', -55 * un.mV),
                                     ul.Property('Vt', -40 * un.mV)
                                 ],
                                 initial_values=[
                                     ul.Initial('V', -70 * un.mV),
                                     ul.Initial('U', -1.625 * un.mV / un.ms)
                                 ])
    return comp
Ejemplo n.º 6
0
def parameterise_izhikevich(definition=None):
    if definition is None:
        definition = create_izhikevich()
    comp = ul.DynamicsProperties(
        name='SampleIzhikevich',
        definition=create_izhikevich(),
        properties=[
            ul.Property('a', 0.2 * un.per_ms),
            ul.Property('b', 0.025 * un.per_ms),
            ul.Property('c', -75 * un.mV),
            ul.Property('d', 0.2 * un.mV / un.ms),
            ul.Property('theta', -50 * un.mV),
            ul.Property('alpha', 0.04 * un.unitless / (un.mV * un.ms)),
            ul.Property('beta', 5 * un.per_ms),
            ul.Property('zeta', 140.0 * un.mV / un.ms),
            ul.Property('C_m', 1.0 * un.pF)
        ],
        initial_values=[
            ul.Initial('V', -70 * un.mV),
            ul.Initial('U', -1.625 * un.mV / un.ms)
        ])
    return comp
Ejemplo n.º 7
0
def parameterise_hodgkin_huxley(definition=None):
    if definition is None:
        definition = create_hodgkin_huxley()
    comp = ul.DynamicsProperties(
        name='SampleHodgkinHuxley',
        definition=create_hodgkin_huxley(),
        properties=[
            ul.Property('C', 1.0 * un.pF),
            ul.Property('celsius', 20.0 * un.degC),
            ul.Property('ek', -90 * un.mV),
            ul.Property('el', -65 * un.mV),
            ul.Property('ena', 80 * un.mV),
            ul.Property('gkbar', 30.0 * un.nS),
            ul.Property('gl', 0.3 * un.nS),
            ul.Property('gnabar', 130.0 * un.nS),
            ul.Property('v_threshold', -40.0 * un.mV),
            ul.Property('qfactor', 6.3 * un.degC),
            ul.Property('tendegrees', 10.0 * un.degC),
            ul.Property('m_alpha_A', -0.1, old_div(un.unitless,
                                                   (un.ms * un.mV))),
            ul.Property('m_alpha_V0', -40.0 * un.mV),
            ul.Property('m_alpha_K', 10.0 * un.mV),
            ul.Property('m_beta_A', 4.0 * un.per_ms),
            ul.Property('m_beta_V0', -65.0 * un.mV),
            ul.Property('m_beta_K', 18.0 * un.mV),
            ul.Property('h_alpha_A', 0.07 * un.per_ms),
            ul.Property('h_alpha_V0', -65.0 * un.mV),
            ul.Property('h_alpha_K', 20.0 * un.mV),
            ul.Property('h_beta_A', 1.0 * un.per_ms),
            ul.Property('h_beta_V0', -35.0 * un.mV),
            ul.Property('h_beta_K', 10.0 * un.mV),
            ul.Property('n_alpha_A', -0.01,
                        old_div(un.unitless, (un.ms * un.mV))),
            ul.Property('n_alpha_V0', -55.0 * un.mV),
            ul.Property('n_alpha_K', 10.0 * un.mV),
            ul.Property('n_beta_A', 0.125 * un.per_ms),
            ul.Property('n_beta_V0', -65.0 * un.mV),
            ul.Property('n_beta_K', 80.0 * un.mV)
        ],
        initial_values=[
            ul.Initial('V', -70 * un.mV),
            ul.Initial('m', 0.1),
            ul.Initial('n', 0),
            ul.Initial('h', 0.9)
        ])
    return comp
Ejemplo n.º 8
0
def parameterise_adaptive_exponential(definition=None):
    if definition is None:
        definition = create_adaptive_exponential()
    comp = ul.DynamicsProperties(name='SampleAdaptiveExpIntegrateAndFire',
                                 definition=definition,
                                 properties=[
                                     ul.Property('C_m', 1 * un.pF),
                                     ul.Property('g_L', 0.1 * un.nS),
                                     ul.Property('E_L', -65 * un.mV),
                                     ul.Property('Delta', 1 * un.mV),
                                     ul.Property('V_T', -58 * un.mV),
                                     ul.Property('S', 0.1),
                                     ul.Property('tspike', 0.5 * un.ms),
                                     ul.Property('trefractory', 0.25 * un.ms),
                                     ul.Property('tau_w', 4 * un.ms),
                                     ul.Property('a', 1 * un.per_mV),
                                     ul.Property('b', 2)
                                 ],
                                 initial_values=[
                                     ul.Initial('V', -70 * un.mV),
                                     ul.Initial('w', 0.1 * un.mV)
                                 ])
    return comp