Changeset 407

Show
Ignore:
Timestamp:
07/03/08 03:17:50 (5 months ago)
Author:
pierre
Message:

Implement the Gutig rule and the van Rossum rule of plasticity in nest2, and change the old naming. Fix also the meanSpikeCount() function to have directly the spike count from the recorder, and not from the file

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/common.py

    r405 r407  
    15131513    """ 
    15141514    default_parameters = { 
    1515         'w_min':  20.0, 
    1516         'w_max': 20.0, 
    1517         'A_plus': 0.01, 
    1518         'A_minus': 0.01 
     1515        'w_min'  : 0.0, 
     1516        'w_max'  : 1.0, 
     1517        'A_plus' : 0.01, 
     1518        'A_minus': 0.01, 
    15191519    } 
    15201520     
     
    15301530    """ 
    15311531 
    1532     def __init__(self, w_min=0.0, A_plus=0.01, A_minus=0.01): 
     1532    default_parameters = { 
     1533        'w_min'  : 0.0, 
     1534        'w_max'  : 1.0, 
     1535        'A_plus' : 0.01, 
     1536        'A_minus': 0.01, 
     1537    } 
     1538 
     1539    def __init__(self, w_min=0.0,  w_max=1.0, A_plus=0.01, A_minus=0.01): 
    15331540        pass 
    15341541 
    15351542     
    15361543class GutigWeightDependence(STDPWeightDependence): 
    1537     pass 
     1544     
     1545    default_parameters = { 
     1546        'w_min'   : 0.0, 
     1547        'w_max'   : 1.0, 
     1548        'A_plus'  : 0.01, 
     1549        'A_minus' : 0.01, 
     1550        'mu_plus' : 0.5, 
     1551        'mu_minus': 0.5 
     1552    } 
     1553 
     1554    def __init__(self, w_min=0.0,  w_max=1.0, A_plus=0.01, A_minus=0.01,mu_plus=0.5,mu_minus=0.5): 
     1555        pass 
    15381556 
    15391557# Not yet implemented for any module 
  • trunk/src/nest2/__init__.py

    r406 r407  
    765765            tmp_list = record_from 
    766766        else: 
    767             rng = rng or numpy.random 
     767            if not rng: 
     768                rng = numpy.random 
    768769            tmp_list = rng.permutation(numpy.reshape(self.cell, (self.cell.size,)))[0:n_rec] 
    769770 
     
    863864        Returns the mean number of spikes per neuron. 
    864865        """ 
    865         n_spikes = len(self.recorders['spikes'].get(gather)) 
     866        n_spikes = nest.GetStatus(self.recorders['spikes']._device,'n_events')[0] 
    866867        n_rec = len(self.recorders['spikes'].recorded) 
    867868        return float(n_spikes)/n_rec 
  • trunk/src/nest2/synapses.py

    r307 r407  
    8282    """ 
    8383    translations = common.build_translations( 
    84         ('w_max',     'wmax',  1000.0), # unit conversion 
     84        ('w_max',     'Wmax',  1000.0), # unit conversion 
    8585        ('w_min',     'w_min_always_zero_in_NEST'), 
    86         ('A_plus',    'aLTP'), 
     86        ('A_plus',    'lambda'), 
    8787        ('A_minus',   'alpha', 'A_minus/A_plus', 'alpha*lambda'), 
    8888    ) 
     
    9898        self.parameters['mu_plus'] = 1.0 
    9999        self.parameters['mu_minus'] = 1.0 
     100 
     101class AdditivePotentiationMultiplicativeDepression(common.AdditivePotentiationMultiplicativeDepression): 
     102    """ 
     103    The amplitude of the weight change depends on the current weight. 
     104    For depression, Dw propto w-w_min 
     105    For potentiation, Dw propto w_max-w 
     106    """ 
     107    translations = common.build_translations( 
     108        ('w_max',     'Wmax',  1000.0), # unit conversion 
     109        ('w_min',     'w_min_always_zero_in_NEST'), 
     110        ('A_plus',    'lambda'), 
     111        ('A_minus',   'alpha', 'A_minus/A_plus', 'alpha*lambda'), 
     112    ) 
     113    possible_models = set(['stdp_synapse',]) #'stdp_synapse_hom' 
     114         
     115    def __init__(self, w_min=0.0, w_max=1.0, A_plus=0.01, A_minus=0.01): 
     116        if w_min != 0: 
     117            raise Exception("Non-zero minimum weight is not supported by NEST.") 
     118        common.AdditivePotentiationMultiplicativeDepression.__init__(self, w_min, w_max, A_plus, A_minus) 
     119        parameters = locals() 
     120        parameters.pop('self')  
     121        self.parameters = self.translate(parameters) 
     122        self.parameters['mu_plus'] = 0.0 
     123        self.parameters['mu_minus'] = 1.0 
     124 
     125 
     126class GutigWeightDependence(common.GutigWeightDependence): 
     127    """ 
     128    The amplitude of the weight change depends on the current weight. 
     129    For depression, Dw propto w-w_min 
     130    For potentiation, Dw propto w_max-w 
     131    """ 
     132    translations = common.build_translations( 
     133        ('w_max',     'Wmax',  1000.0), # unit conversion 
     134        ('w_min',     'w_min_always_zero_in_NEST'), 
     135        ('A_plus',    'lambda'), 
     136        ('A_minus',   'alpha', 'A_minus/A_plus', 'alpha*lambda'), 
     137        ('mu_plus',   'mu_plus'), 
     138        ('mu_minus',  'mu_minus'), 
     139    ) 
     140    possible_models = set(['stdp_synapse',]) #'stdp_synapse_hom' 
     141         
     142    def __init__(self, w_min=0.0, w_max=1.0, A_plus=0.01, A_minus=0.01,mu_plus=0.5,mu_minus=0.5): 
     143        if w_min != 0: 
     144            raise Exception("Non-zero minimum weight is not supported by NEST.") 
     145        common.AdditivePotentiationMultiplicativeDepression.__init__(self, w_min, w_max, A_plus, A_minus) 
     146        parameters = locals() 
     147        parameters.pop('self')  
     148        self.parameters = self.translate(parameters) 
    100149 
    101150