Changeset 1017 for trunk

Show
Ignore:
Timestamp:
11/28/11 14:15:15 (6 months ago)
Author:
pierre
Message:

The IF_curr_exp benchmark is almost passed for Nemo when dt=1ms, even if some discrepancies are still there. Need to continue to explore. Bug in the recording of variables, since they are recorded twice

Location:
trunk/src/nemo
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/nemo/__init__.py

    r1014 r1017  
    136136        elif isinstance(celltype, cells.IF_curr_exp): 
    137137            init = celltype.default_initial_values 
    138             for idx in self.all_cells: 
    139                 ntype = simulator.state.net.add_neuron_type('IF_curr_exp') 
     138            for idx in self.all_cells:                 
     139                ntype = simulator.state.net.add_neuron_type('IF_curr_exp')                
    140140                simulator.state.net.add_neuron(ntype, int(idx), 
    141141                        params['v_rest'], 
     142                        params['v_reset'], 
    142143                        params['cm'], 
    143                         params['tau_m'], 
     144                        params['tau_m'],                     
    144145                        params['t_refrac'], 
    145146                        params['tau_syn_E'], 
    146147                        params['tau_syn_I'], 
    147                         params['i_offset'], 
    148                         params['v_reset'], 
    149148                        params['v_thresh'], 
    150                         init['v'], 0., 0., 1000.) 
     149                        params['i_offset'],                         
     150                        init['v'], 0., 0., -1.) 
    151151        else:             
    152152            init = celltype.default_initial_values 
     
    162162        if not hasattr(value, "__len__"): 
    163163            value = value*numpy.ones((len(self),)) 
    164  
     164        for cell, val in zip(self, value): 
     165            cell.set_initial_value(variable, val) 
    165166 
    166167class Projection(common.Projection): 
  • trunk/src/nemo/recording.py

    r1000 r1017  
    2121        __doc__ = recording.Recorder.__doc__ 
    2222        recording.Recorder.__init__(self, variable, population, file) 
    23         simulator.recorder_list.append(self) 
     23        self._simulator.recorder_list.append(self) 
    2424        self.data  = {}     
    25         self.times = []     
    26      
     25        self.times = [] 
     26 
    2727    def record(self, ids): 
    2828        """Add the cells in `ids` to the set of recorded cells.""" 
     
    4646    def _add_vm(self, time): 
    4747        for id in list(self.recorded): 
    48             self.data[id] += [simulator.state.sim.get_membrane_potential(int(id))] 
     48            self.data[id] += [self._simulator.state.sim.get_membrane_potential(int(id))] 
    4949        self.times += [time] 
    5050 
  • trunk/src/nemo/simulator.py

    r998 r1017  
    6060        self.simulation    = None 
    6161        self.stdp          = None 
    62         self.verbose       = True 
     62        self.verbose       = False 
    6363 
    6464    def progressbar(self, N): 
     
    8787 
    8888    def run(self, simtime): 
     89         
    8990        self.simulation = nemo.Simulation(self.net, self.conf) 
    9091        if self.verbose: 
     
    111112                    spikes += [source] 
    112113             
    113             #for currents in current_sources: 
    114             #    currents. 
    115114            fired = numpy.sort(self.sim.step(spikes, currents))  
    116115 
     
    118117                self.simulation.apply_stdp(1.0) 
    119118 
    120             for recorder in recorder_list: 
     119            for recorder in recorder_list[1:]: 
    121120                if recorder.variable is "spikes": 
    122121                    recorder._add_spike(fired, self.t) 
     
    179178             
    180179    def set_initial_value(self, variable, value): 
    181         indices = self.celltype.indices.items() 
     180        indices = self.celltype.initial_indices 
    182181        if state.simulation is None: 
    183182            state.net.set_neuron_state(self, indices[variable], value)  
  • trunk/src/nemo/standardmodels/cells.py

    r1013 r1017  
    4141 
    4242    indices = {'a' : 0, 'b' : 1, 'c' : 2, 'd' : 3} 
    43  
    4443    initial_indices = {'u' : 0, 'v' : 1} 
    4544 
     
    152151    indices = { 
    153152            'v_rest' : 0, 
    154             'cm' : 1, 
    155             'tau_m' : 2, 
    156             't_refrac' : 3, 
    157             'tau_syn_E' : 4, 
    158             'tau_syn_I' : 5, 
    159             'i_offset' : 6, 
    160             'v_reset' : 7, 
    161             'v_thresh' : 8 
     153            'cm' : 2, 
     154            'tau_m' : 3, 
     155            't_refrac' : 4, 
     156            'tau_syn_E' : 5, 
     157            'tau_syn_I' : 6, 
     158            'i_offset' : 8, 
     159            'v_reset' : 1, 
     160            'v_thresh' : 7 
    162161        } 
     162 
    163163    initial_indices = {'v' : 0} 
    164164