Changeset 994 for branches

Show
Ignore:
Timestamp:
10/03/11 15:13:54 (8 months ago)
Author:
apdavison
Message:

Ported r993 to 0.7 branch (ticket:195)

Location:
branches/0.7
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/0.7/setup.py

    r957 r994  
    4141setup( 
    4242    name = "PyNN", 
    43     version = "0.7.1", 
     43    version = "0.7.2", 
    4444    package_dir={'pyNN': 'src'}, 
    4545    packages = ['pyNN','pyNN.nest', 'pyNN.pcsim', 'pyNN.neuron', 'pyNN.brian', 
  • branches/0.7/src/common.py

    r957 r994  
    234234        self.parent._set_cell_initial_value(self, variable, value) 
    235235 
     236    def as_view(self): 
     237        """Return a PopulationView containing just this cell."""  
     238        index = self.parent.id_to_index(self)  
     239        return self.parent[index:index+1]  
    236240 
    237241# ============================================================================= 
     
    329333        """ 
    330334        if isinstance(source, IDMixin): 
    331             source = source.parent 
     335            source = source.as_view() 
    332336        if isinstance(target, IDMixin): 
    333             target = target.parent 
     337            target = target.as_view() 
    334338        connector = connector_class(p_connect=p, weights=weight, delays=delay) 
    335339        return projection_class(source, target, connector, target=synapse_type, rng=rng) 
  • branches/0.7/test/system/scenarios.py

    r917 r994  
    492492 
    493493    sim.end() 
     494 
     495@register() 
     496def ticket195(sim): 
     497    """ 
     498    Check that the `connect()` function works correctly with single IDs (see 
     499    http://neuralensemble.org/trac/PyNN/ticket/195) 
     500    """ 
     501    sim.setup(timestep=0.01) 
     502    pre = sim.Population(10, sim.SpikeSourceArray, cellparams={'spike_times':range(1,10)}) 
     503    post = sim.Population(10, sim.IF_cond_exp) 
     504    sim.connect(pre[0], post[0], weight=0.01, delay=0.1, p=1) 
     505    post.record() 
     506    sim.run(100.0) 
     507    assert_arrays_almost_equal(post.getSpikes(), numpy.array([[0.0, 13.4]]), 0.5) 
     508 
  • branches/0.7/test/unittests/test_lowlevelapi.py

    r858 r994  
    2424     
    2525    class MockID(common.IDMixin): 
    26         def __init__(self): 
    27             self.parent = "parent" 
    28          
     26       def as_view(self): 
     27            return "view" 
     28  
    2929    prj = connect_function(MockID(), MockID(), "weight", "delay", "synapse_type", "p", "rng") 
    30     projection_class.assert_called_with("parent", "parent", "connector", target="synapse_type", rng="rng") 
     30    projection_class.assert_called_with("view", "view", "connector", target="synapse_type", rng="rng") 
    3131     
    3232def test_set():