Changeset 374

Show
Ignore:
Timestamp:
06/18/08 15:39:28 (5 months ago)
Author:
apdavison
Message:

Some harmonization of attribute names across simulators.

Files:

Legend:

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

    r342 r374  
    369369        # the node 
    370370        #self.gidlist     = [self.fullgidlist[i+myid] for i in range(0, len(self.fullgidlist),nhost) if i < len(self.fullgidlist)-myid] 
    371         #self.gid_start   = gid 
     371        #self.first_id   = gid 
    372372 
    373373         
     
    468468        for i,s in zip(addr,self.steps): 
    469469            index += i*s 
    470         id = index + self.gid_start 
     470        id = index + self.first_id 
    471471        assert addr == self.locate(id), 'index=%s addr=%s id=%s locate(id)=%s' % (index, addr, id, self.locate(id)) 
    472472        # We return the gid as an ID object. Note that each instance of Populations 
     
    483483        # id should be a gid 
    484484        assert isinstance(id,int), "id is %s, not int" % type(id) 
    485         id -= self.gid_start 
     485        id -= self.first_id 
    486486        if self.ndim == 3: 
    487487            rows = self.dim[1]; cols = self.dim[2] 
  • trunk/src/nest1/__init__.py

    r339 r374  
    427427             
    428428        self.cell = numpy.array([ ID(pynest.getGID(addr)) for addr in self.cell ], ID) 
    429         self.id_start = self.cell.reshape(self.size,)[0] 
     429        self.first_id = self.cell.reshape(self.size,)[0] 
    430430         
    431431        for id in self.cell: 
     
    495495        ###return tuple([a.tolist()[0] for a in numpy.where(self.cell == id)]) 
    496496         
    497         id -= self.id_start 
     497        id -= self.first_id 
    498498        if self.ndim == 3: 
    499499            rows = self.dim[1]; cols = self.dim[2] 
  • trunk/src/nest2/__init__.py

    r373 r374  
    556556        self.cell = numpy.array([ ID(GID) for GID in self.cell ], ID) 
    557557        self.cell_local = self.cell[numpy.array(nest.GetStatus(self.cell.tolist(),'local'))] 
    558         self.id_start = self.cell.reshape(self.size,)[0] 
     558        self.first_id = self.cell.reshape(self.size,)[0] 
    559559 
    560560        for id in self.cell: 
     
    626626        ###return tuple([a.tolist()[0] for a in numpy.where(self.cell == id)]) 
    627627 
    628         id -= self.id_start 
     628        id -= self.first_id 
    629629        if self.ndim == 3: 
    630630            rows = self.dim[1]; cols = self.dim[2] 
     
    12491249                # note that we assume that Population ids are consecutive, which is the case, but we should 
    12501250                # perhaps make an assert in __init__() to really make sure 
    1251                 values[src-self.pre.id_start, tgt-self.post.id_start] = v 
     1251                values[src-self.pre.first_id, tgt-self.post.first_id] = v 
    12521252        return values 
    12531253 
  • trunk/src/neuron/__init__.py

    r372 r374  
    7272            except RuntimeError: 
    7373                print "id:", self 
    74                 print "parent.gid_start:", self.parent.gid_start 
     74                print "parent.first_id:", self.parent.first_id 
    7575                print "len(parent):", len(self.parent) 
    7676                print "hoc_cell_list.count():", hoc_cell_list.count() 
     
    345345            post_label = 'node%d: post_%s.%s' % (myid, self.population.hoc_label, self.variable) 
    346346            id_list = self.population.gidlist 
    347             padding = self.population.gid_start 
     347            padding = self.population.first_id 
    348348             
    349349        def post_data(): 
     
    368368                for dimension in list(self.population.dim)[1:]: 
    369369                    header = "%s\t%d" % (header, dimension) 
    370                 header += "\\n# first_id = %d\\n# last_id = %d\\n" % (self.population.gid_start, self.population.gid_start+self.population.size-1) 
     370                header += "\\n# first_id = %d\\n# last_id = %d\\n" % (self.population.first_id, self.population.first_id+self.population.size-1) 
    371371             
    372372            if self.variable == 'v': 
     
    727727        # the node 
    728728        self.gidlist     = [self.fullgidlist[i+myid] for i in range(0, len(self.fullgidlist), nhost) if i < len(self.fullgidlist)-myid] 
    729         self.gid_start   = gid 
     729        self.first_id   = gid 
    730730 
    731731        # Write hoc commands 
     
    777777        for i, s in zip(addr, self.steps): 
    778778            index += i*s 
    779         id = index + self.gid_start 
     779        id = index + self.first_id 
    780780        assert addr == self.locate(id), 'index=%s addr=%s id=%s locate(id)=%s' % (index, addr, id, self.locate(id)) 
    781781        # We return the gid as an ID object. Note that each instance of Populations 
     
    816816        # id should be a gid 
    817817        assert isinstance(id, int), "id is %s, not int" % type(id) 
    818         id -= self.gid_start 
     818        id -= self.first_id 
    819819        if self.ndim == 3: 
    820820            rows = self.dim[1]; cols = self.dim[2] 
     
    886886            raise common.InvalidDimensionsError, "Population: %s, value_array: %s" % (str(self.dim), 
    887887                                                                                      str(value_array.shape)) 
    888         values = values.take(numpy.array(self.gidlist)-self.gid_start) # take just the values for cells on this machine 
     888        values = values.take(numpy.array(self.gidlist)-self.first_id) # take just the values for cells on this machine 
    889889        assert len(values) == len(self.gidlist) 
    890890         
     
    16261626            for i in xrange(len(self)): 
    16271627                weight = getattr(h, self.hoc_label).object(i).weight[0] 
    1628                 values[self.connections[i][0]-self.pre.gid_start
    1629                        self.connections[i][1]-self.post.gid_start] = weight 
     1628                values[self.connections[i][0]-self.pre.first_id
     1629                       self.connections[i][1]-self.post.first_id] = weight 
    16301630        return values 
    16311631         
     
    17001700                for i in xrange(len(self)): 
    17011701                    weight = getattr(h, self.hoc_label).object(i).weight[0] 
    1702                     weights[self.connections[i][0]-self.pre.gid_start
    1703                             self.connections[i][1]-self.post.gid_start] = weight 
     1702                    weights[self.connections[i][0]-self.pre.first_id
     1703                            self.connections[i][1]-self.post.first_id] = weight 
    17041704                for row in weights: 
    17051705                    f.write(fmt % tuple(row)) 
  • trunk/src/neuron/connectors.py

    r361 r374  
    9595            hoc_commands = [] 
    9696            for tgt in projection.post.gidlist: 
    97                 src = tgt - projection.post.gid_start + projection.pre.gid_start 
     97                src = tgt - projection.post.first_id + projection.pre.first_id 
    9898                if hasattr(weight, 'next'): 
    9999                    w = weight.next() 
  • trunk/src/neuron2/connectors.py

    r367 r374  
    9595            hoc_commands = [] 
    9696            for tgt in projection.post.gidlist: 
    97                 src = tgt - projection.post.gid_start + projection.pre.gid_start 
     97                src = tgt - projection.post.first_id + projection.pre.first_id 
    9898                if hasattr(weight, 'next'): 
    9999                    w = weight.next() 
  • trunk/src/recording.py

    r373 r374  
    4747    """ 
    4848    if population is not None: 
    49         padding = population.id_start 
     49        padding = population.first_id 
    5050         
    5151    if variable == 'spikes': 
     
    7373        if population is not None: 
    7474            result.write("# dimensions =" + "\t".join([str(d) for d in population.dim]) + "\n") 
    75             result.write("# first_id = %d\n" % population.id_start
    76             result.write("# last_id = %d\n" % (population.id_start+len(population)-1,)) 
    77             padding = population.id_start 
     75            result.write("# first_id = %d\n" % population.first_id
     76            result.write("# last_id = %d\n" % (population.first_id+len(population)-1,)) 
     77            padding = population.first_id 
    7878        else: 
    7979            padding = 0