Changeset 1044 for trunk

Show
Ignore:
Timestamp:
12/22/11 10:59:00 (5 months ago)
Author:
pierre
Message:

Update the tests in order to take into account Nemo (and dt can not be less than 1 with it, so I may change dt in some scenarios to launch it also, and to deal with the new CurrentSource? syntax. Note that I'm not familiar with the Mock objects, so test with the MockDCSource fails.... Add a scenario to check that changing the amplitude of a DC source on the fly is working

Location:
trunk/test
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/test/system/scenarios.py

    r1038 r1044  
    1818 
    1919 
    20 @register() 
     20@register(exclude=["nemo"]) 
    2121def scenario1(sim): 
    2222    """ 
     
    3939    tstop = 1000.0 
    4040    delay = 0.2 
     41    dt    = 0.1 
    4142    weights = { 
    4243        'excitatory': 4.0e-3, 
     
    4546    } 
    4647        
    47     sim.setup(timestep=0.1, threads=n_threads) 
     48    sim.setup(timestep=dt, min_delay=dt, threads=n_threads) 
    4849    all_cells = sim.Population(n_exc+n_inh, sim.IF_cond_exp, cell_params, label="All cells") 
    4950    cells = { 
     
    8384 
    8485 
    85 @register() 
     86@register(exclude=["nemo"]) 
    8687def scenario1a(sim): 
    8788    """ 
     
    104105    pconn_input = 0.01 
    105106    tstop = 1000.0 
    106     delay = 0.3 
     107    delay = 1 
    107108    w_exc = 3.0e-3 
    108109    w_inh = 45.0e-3 
    109110    w_input = 0.12 
     111    dt      = 0.1 
    110112        
    111     sim.setup(timestep=0.1, threads=n_threads) 
     113    sim.setup(timestep=dt, min_delay=dt, threads=n_threads) 
    112114    excitatory_cells = sim.create(sim.IF_cond_alpha, cell_params, n=n_exc) 
    113115    inhibitory_cells = sim.create(sim.IF_cond_alpha, cell_params, n=n_inh) 
     
    134136 
    135137 
    136 @register(exclude=["moose"]) 
     138@register(exclude=["moose", "nemo"]) 
    137139def scenario2(sim): 
    138140    """ 
     
    162164    neurons.initialize('v', 0.0) 
    163165    I = numpy.arange(I0, I0+1.0, 1.0/n) 
    164     currents = [sim.DCSource(start=t_start, stop=t_start+duration, amplitude=amp) 
     166    currents = [sim.DCSource({"start" : t_start, "stop" : t_start+duration, "amplitude" :amp}) 
    165167                for amp in I] 
    166168    for j, (neuron, current) in enumerate(zip(neurons, currents)): 
     
    188190 
    189191 
    190 @register(exclude=["moose", "brian"]) 
     192@register(exclude=["moose", "nemo", "brian"]) 
    191193def scenario3(sim): 
    192194    """ 
     
    277279     
    278280 
    279 @register() 
     281@register(exclude=["nemo"]) 
    280282def ticket166(sim): 
    281283    """ 
     
    292294        pylab.rcParams['interactive'] = interactive 
    293295     
    294     sim.setup(timestep=dt) 
     296    sim.setup(timestep=dt, min_delay=dt) 
    295297     
    296298    spikesources = sim.Population(2, sim.SpikeSourceArray) 
     
    335337    """ 
    336338    repeats = 3 
    337     sim.setup() 
    338     p = sim.Population(1, sim.IF_cond_exp, {"i_offset": 0.1}) 
     339    dt      = 1 
     340    sim.setup(timestep=dt, min_delay=dt) 
     341    p = sim.Population(1, sim.IF_curr_exp, {"i_offset": 0.1}) 
    339342    p.record_v() 
    340343     
     
    351354 
    352355 
    353 @register(exclude=['brian', 'pcsim']) 
     356@register(exclude=['brian', 'pcsim', 'nemo']) 
    354357def test_reset_recording(sim): 
    355358    """ 
     
    384387    n = 3 
    385388    data = [] 
     389    dt   = 1 
    386390 
    387391    for i in range(n): 
    388         sim.setup() 
    389         p = sim.Population(1, sim.IF_cond_exp, {"i_offset": 0.1}) 
     392        sim.setup(timestep=dt, min_delay=dt) 
     393        p = sim.Population(1, sim.IF_curr_exp, {"i_offset": 0.1}) 
    390394        p.record_v() 
    391395        sim.run(10.0) 
     
    398402        assert_arrays_equal(rec, data[0]) 
    399403 
    400 @register(exclude=['pcsim', 'moose']) 
     404@register(exclude=['pcsim', 'moose', 'nemo']) 
    401405def test_EIF_cond_alpha_isfa_ista(sim): 
    402406    sim.setup(timestep=0.01, min_delay=0.1, max_delay=4.0) 
     
    410414    sim.end() 
    411415 
    412 @register(exclude=['pcsim']) 
     416@register(exclude=['pcsim', 'nemo']) 
    413417def test_HH_cond_exp(sim): 
    414418    sim.setup(timestep=0.001, min_delay=0.1) 
     
    437441     
    438442 
    439 @register(exclude=['pcsim', 'moose']) 
     443@register(exclude=['pcsim', 'moose', 'nemo']) 
    440444def test_record_vm_and_gsyn_from_assembly(sim): 
    441445    from pyNN.utility import init_logging 
    442446    init_logging(logfile=None, debug=True) 
    443     dt = 0.1 
     447    dt    = 0.1 
    444448    tstop = 100.0 
    445     sim.setup(timestep=dt) 
     449    sim.setup(timestep=dt, min_delay=dt) 
    446450    cells = sim.Population(5, sim.IF_cond_exp) + sim.Population(6, sim.EIF_cond_exp_isfa_ista) 
    447451    inputs = sim.Population(5, sim.SpikeSourcePoisson, {'rate': 50.0}) 
     
    481485    sim.end() 
    482486 
    483 @register() 
     487@register(exclude=["pcsim", "nemo"]) 
     488def test_changing_electrode(sim): 
     489    """ 
     490    Check that changing the values of the electrodes on the fly is taken into account 
     491    """ 
     492    repeats = 2 
     493    dt      = 0.1 
     494    simtime = 100 
     495    sim.setup(timestep=dt, min_delay=dt) 
     496    p = sim.Population(1, sim.IF_curr_exp) 
     497    c = sim.DCSource({'amplitude' : 0}) 
     498    c.inject_into(p)     
     499    p.record_v() 
     500     
     501    data = [] 
     502    for i in range(repeats): 
     503        sim.run(100.0) 
     504        c.amplitude += 0.1 
     505    data.append(p.get_v()) 
     506         
     507    sim.end() 
     508 
     509    assert data[0][:, 2][simtime/dt] < data[0][:, 2][-1] 
     510 
     511 
     512 
     513@register(exclude=['nemo']) 
    484514def ticket195(sim): 
    485515    """ 
  • trunk/test/unittests/test_neuron.py

    r1042 r1044  
    4242class MockDCSource(object): 
    4343    parameter_names = ['amplitude', 'start', 'stop'] 
    44     parameters      = {'amplitude' : 0, 'start' : 0, 'stop' : 1e12} 
    4544    def __init__(self, parameters): 
    4645        self._devices = []