Example #1
0
mechanism = "LeakyIAF"
parameters = p = {
    'C': 1,         # nF
    'vL': -65,      # mV
    'Isyn': 0.5,    # nA
    'V_reset': -70, # mV
    'theta': -50,   # mV
    't_ref': 5,     # ms
    'gL': 0.01,     # µS
}
initial_values = {'V': -65, 't_spike': -1e9}

def time_to_spike(v_start):
    tau_m = p['C']/p['gL']
    x = p['vL'] + p['Isyn']/p['gL']
    return tau_m*numpy.log((v_start - x)/(p['theta'] - x))
spike1 = time_to_spike(initial_values['V'])
spike2 = spike1 + p['t_ref'] + time_to_spike(p['V_reset'])
expected_output = numpy.array([spike1, spike2])


if __name__ == "__main__":
    configure()
    test = TestCase(mechanism, parameters, initial_values, expected_output)
    run(100.0)
    test.plot("test_leaky_iaf.png")
    errors = test.calculate_errors()
    print test.success and "OK" or "FAIL"

Example #2
0
parameters = {
    'C': 10,
    'V1': -1.2,
    'Isyn': 100,
    'phi': 0.04,
    'V2': 18,
    'g_l': 2,
    'g_ca': 4.4,
    'V3': 2,
    'V4': 30,
    'g_k': 8,
    'theta': 20,
    'V_l': -60,
    'V_ca': 120,
    'V_k': -84,
}
initial_values = {
    'V': -65,
    'W': 0
}
expected_output = numpy.array([ 8.19,  77.90]) # no idea if these are the correct values


if __name__ == "__main__":
    configure()
    test = TestCase(mechanism, parameters, initial_values, expected_output)
    run(100.0)
    test.plot("test_morris-lecar.png")
    errors = test.calculate_errors()
    print test.success and "OK" or "FAIL"
Example #3
0
from single_cell_current_injection import TestCase, configure, run

mechanism = "Izhikevich"
parameters = {
    'a': 0.02,
    'b': 0.2,
    'c': -50,
    'd': 2,
    'Isyn': 15,
    'theta': 0,
}
initial_values = {
    'V': -65,
    'U': 0.2 * -65 
}
expected_output = [# I have no idea if these values are correct
     2.12834641,   3.17733172,   4.31376038,   5.52657414,
     6.85904596,   8.33813478,   9.97419301,  11.85470981,
    14.10067134,  17.04985314,  50.2182681 ,  51.81893091,
    53.63051808,  55.78022398,  58.53731759,  63.57952919,
    97.27780952,  98.87851621]



if __name__ == "__main__":
    configure()
    test = TestCase(mechanism, parameters, initial_values, expected_output)
    run(100.0)
    test.plot("test_izhikevich.png")
    errors = test.calculate_errors()
    print test.success and "OK" or "FAIL"