<commit_before>"""
cell/NML2SpikeSource.py 

Contains pointCell class 

Contributors: <EMAIL>
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from neuron import h # Import NEURON
from .compartCell import CompartCell
from ..specs import Dict


###############################################################################
#
# NeuroML2 SPIKE SOURCE CLASS 
#
###############################################################################

class NML2SpikeSource (CompartCell):
    ''' Class for NeuroML2 spiking neuron models: based on CompartCell,
        but the NetCon connects to the mechanism on the one section whose NET_RECEIVE
        block will emit events
    '''
        
    def associateGid (self, threshold = 10.0):
        from .. import sim
        
        if sim.cfg.createNEURONObj: 
            sim.pc.set_gid2node(self.gid, sim.rank) # this is the key call that assigns cell gid to a particular node
         
            nc = h.NetCon(self.secs['soma']['pointps'][self.tags['cellType']].hPointp, None)
                
            #### nc.threshold = threshold  # not used....
            sim.pc.cell(self.gid, nc, 1)  # associate a particular output stream of events
            del nc # discard netcon
        sim.net.gid2lid[self.gid] = len(sim.net.gid2lid)
        
    def initRandom(self):
        from .. import sim
        
        rand = h.Random()
        self.stims.append(Dict())  # add new stim to Cell object
        randContainer = self.stims[-1]
        randContainer['hRandom'] = rand 
        randContainer['type'] = self.tags['cellType'] 
        seed = sim.cfg.seeds['stim']
        randContainer['seed'] = seed 
        self.secs['soma']['pointps'][self.tags['cellType']].hPointp.noiseFromRandom(rand)  # use random number generator 
        sim._init_stim_randomizer(rand, self.tags['pop'], self.tags['cellLabel'], seed)
        randContainer['hRandom'].negexp(1)
        #print("Created Random: %s with %s (%s)"%(rand,seed, sim.cfg.seeds))
    <commit_msg>hPointp -> hObj<commit_after>"""
cell/NML2SpikeSource.py 

Contains pointCell class 

Contributors: <EMAIL>
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from neuron import h # Import NEURON
from .compartCell import CompartCell
from ..specs import Dict


###############################################################################
#
# NeuroML2 SPIKE SOURCE CLASS 
#
###############################################################################

class NML2SpikeSource (CompartCell):
    ''' Class for NeuroML2 spiking neuron models: based on CompartCell,
        but the NetCon connects to the mechanism on the one section whose NET_RECEIVE
        block will emit events
    '''
        
    def associateGid (self, threshold = 10.0):
        from .. import sim
        
        if sim.cfg.createNEURONObj: 
            sim.pc.set_gid2node(self.gid, sim.rank) # this is the key call that assigns cell gid to a particular node
           
            nc = h.NetCon(self.secs['soma']['pointps'][self.tags['cellType']].hObj, None)
                
            #### nc.threshold = threshold  # not used....
            sim.pc.cell(self.gid, nc, 1)  # associate a particular output stream of events
            del nc # discard netcon
        sim.net.gid2lid[self.gid] = len(sim.net.gid2lid)
        
    def initRandom(self):
        from .. import sim
        
        rand = h.Random()
        self.stims.append(Dict())  # add new stim to Cell object
        randContainer = self.stims[-1]
        randContainer['hRandom'] = rand 
        randContainer['type'] = self.tags['cellType'] 
        seed = sim.cfg.seeds['stim']
        randContainer['seed'] = seed 
        self.secs['soma']['pointps'][self.tags['cellType']].hObj.noiseFromRandom(rand)  # use random number generator 
        sim._init_stim_randomizer(rand, self.tags['pop'], self.tags['cellLabel'], seed)
        randContainer['hRandom'].negexp(1)
        #print("Created Random: %s with %s (%s)"%(rand,seed, sim.cfg.seeds))
    
{'fraction_non_alphanumeric': 0.1724137931034483, 'fraction_numerical': 0.005977011494252874, 'mean_word_length': 3.0064456721915285, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4715912', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1221, 'n_words': 329}