def fromListConn (self, preCellsTags, postCellsTags, connParam):
    from .. import sim

    ''' Generates connections between all pre and post-syn cells based list of relative cell ids'''
    if sim.cfg.verbose: print('Generating set of connections from list (rule: %s) ...' % (connParam['label']))

    orderedPreGids = sorted(preCellsTags)
    orderedPostGids = sorted(postCellsTags)

    # list of params that can have a lambda function
    paramsStrFunc = [param for param in [p+'Func' for p in self.connStringFuncParams] if param in connParam] 
    for paramStrFunc in paramsStrFunc:
        # replace lambda function (with args as dict of lambda funcs) with list of values
        connParam[paramStrFunc[:-4]+'List'] = {(orderedPreGids[preId],orderedPostGids[postId]): 
            connParam[paramStrFunc](**{k:v if isinstance(v, Number) else v(preCellsTags[orderedPreGids[preId]], postCellsTags[orderedPostGids[postId]]) 
            for k,v in connParam[paramStrFunc+'Vars'].items()}) for preId,postId in connParam['connList']}

    if 'weight' in connParam and isinstance(connParam['weight'], list): 
        connParam['weightFromList'] = list(connParam['weight'])  # if weight is a list, copy to weightFromList
    if 'delay' in connParam and isinstance(connParam['delay'], list): 
        connParam['delayFromList'] = list(connParam['delay'])  # if delay is a list, copy to delayFromList
    if 'loc' in connParam and isinstance(connParam['loc'], list): 
        connParam['locFromList'] = list(connParam['loc'])  # if delay is a list, copy to locFromList


    for iconn, (relativePreId, relativePostId) in enumerate(connParam['connList']):  # for each postsyn cell
        preCellGid = orderedPreGids[relativePreId]     
        postCellGid = orderedPostGids[relativePostId]
        if postCellGid in self.gid2lid:  # check if postsyn is in this node's list of gids
            
            if 'weightFromList' in connParam: connParam['weight'] = connParam['weightFromList'][iconn] 
            if 'delayFromList' in connParam: connParam['delay'] = connParam['delayFromList'][iconn]
            if 'locFromList' in connParam: connParam['loc'] = connParam['locFromList'][iconn]
    
            if preCellGid != postCellGid: # if not self-connection
                self._addCellConn(connParam, preCellGid, postCellGid)
def fromListConn ( self , preCellsTags , postCellsTags , connParam ) : from . . import sim ''' Generates connections between all pre and post-syn cells based list of relative cell ids''' if sim . cfg . verbose : print ( 'Generating set of connections from list (rule: %s) ...' % ( connParam [ 'label' ] ) ) orderedPreGids = sorted ( preCellsTags ) orderedPostGids = sorted ( postCellsTags ) paramsStrFunc = [ param for param in [ p + 'Func' for p in self . connStringFuncParams ] if param in connParam ] for paramStrFunc in paramsStrFunc : connParam [ paramStrFunc [ : - 4 ] + 'List' ] = { ( orderedPreGids [ preId ] , orderedPostGids [ postId ] ) : connParam [ paramStrFunc ] ( ** { k : v if isinstance ( v , Number ) else v ( preCellsTags [ orderedPreGids [ preId ] ] , postCellsTags [ orderedPostGids [ postId ] ] ) for k , v in connParam [ paramStrFunc + 'Vars' ] . items ( ) } ) for preId , postId in connParam [ 'connList' ] } if 'weight' in connParam and isinstance ( connParam [ 'weight' ] , list ) : connParam [ 'weightFromList' ] = list ( connParam [ 'weight' ] ) if 'delay' in connParam and isinstance ( connParam [ 'delay' ] , list ) : connParam [ 'delayFromList' ] = list ( connParam [ 'delay' ] ) if 'loc' in connParam and isinstance ( connParam [ 'loc' ] , list ) : connParam [ 'locFromList' ] = list ( connParam [ 'loc' ] ) for iconn , ( relativePreId , relativePostId ) in enumerate ( connParam [ 'connList' ] ) : preCellGid = orderedPreGids [ relativePreId ] postCellGid = orderedPostGids [ relativePostId ] if postCellGid in self . gid2lid : if 'weightFromList' in connParam : connParam [ 'weight' ] = connParam [ 'weightFromList' ] [ iconn ] if 'delayFromList' in connParam : connParam [ 'delay' ] = connParam [ 'delayFromList' ] [ iconn ] if 'locFromList' in connParam : connParam [ 'loc' ] = connParam [ 'locFromList' ] [ iconn ] if preCellGid != postCellGid : self . _addCellConn ( connParam , preCellGid , postCellGid )
Generates connections between all pre and post-syn cells based list of relative cell ids