Changeset 1036

Show
Ignore:
Timestamp:
12/16/11 14:56:15 (5 months ago)
Author:
apdavison
Message:

Removed Population.randomInit(distr) method. Deprecated since 0.7, and replaced by Population.initialize(v, distr)

Location:
trunk
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/populations.py

    r1035 r1036  
    366366            assert rarr.size == self.size, "%s != %s" % (rarr.size, self.size) 
    367367            self.tset(parametername, rarr) 
    368  
    369     def _call(self, methodname, arguments): 
    370         """ 
    371         Call the method methodname(arguments) for every cell in the population. 
    372         e.g. p.call("set_background","0.1") if the cell class has a method 
    373         set_background(). 
    374         """ 
    375         raise NotImplementedError() 
    376  
    377     def _tcall(self, methodname, objarr): 
    378         """ 
    379         `Topographic' call. Call the method methodname() for every cell in the 
    380         population. The argument to the method depends on the coordinates of 
    381         the cell. objarr is an array with the same dimensions as the 
    382         Population. 
    383         e.g. p.tcall("memb_init", vinitArray) calls 
    384         p.cell[i][j].memb_init(vInitArray[i][j]) for all i,j. 
    385         """ 
    386         raise NotImplementedError() 
    387  
    388     #@deprecated("initialize('v', rand_distr)") 
    389     def randomInit(self, rand_distr): 
    390         """ 
    391         Set initial membrane potentials for all the cells in the population to 
    392         random values. 
    393         """ 
    394         warn("The randomInit() method is deprecated, and will be removed in a future release. Use initialize('v', rand_distr) instead.") 
    395         self.initialize('v', rand_distr) 
    396368 
    397369    def initialize(self, variable, value): 
  • trunk/src/space.py

    r957 r1036  
    188188        nx = math.sqrt(n*self.aspect_ratio) 
    189189        if n%nx != 0: 
    190             raise Exception("Invalid size") 
     190            raise Exception("Invalid size: n=%g, nx=%d" % (n, nx)) 
    191191        ny = n/nx 
    192192        return nx, ny 
  • trunk/test/unsorted/generictests.py

    r812 r1036  
    458458        self.assertRaises(errors.NonExistentParameterError, self.p1.set, {'tau_foo': 10.0, 'tau_m': 21.0}) 
    459459             
    460     def testRandomInit(self):         
     460    def test_initialize_v(self):         
    461461        rd = random.RandomDistribution(rng=random.NumpyRNG(seed=98765, num_processes=sim.num_processes()), 
    462462                                       distribution='uniform', 
    463463                                       parameters=[-75,-55]) 
    464         self.p1.randomInit(rd) 
     464        self.p1.initialize('v', rd) 
    465465        #self.assertNotEqual(self.p1[0,0,0].v_init, self.p1[0,0,1].v_init) 
    466466        self.assertNotEqual(self.p1.local_cells[0].get_initial_value('v'), self.p1.local_cells[1].get_initial_value('v')) 
     
    592592        v_thresh = -50.0 
    593593        uniformDistr = random.RandomDistribution(rng=rng, distribution='uniform', parameters=[v_reset, v_thresh]) 
    594         self.pop2.randomInit(uniformDistr) 
     594        self.pop2.initialize('v', uniformDistr) 
    595595        cells_to_record = [self.pop2[0], self.pop2[4]] 
    596596        self.pop2.record_v(cells_to_record) 
     
    10771077        v_thresh = -50.0 
    10781078        uniformDistr = random.RandomDistribution(rng=rng, distribution='uniform', parameters=[v_reset, v_thresh]) 
    1079         self.pop.randomInit(uniformDistr) 
     1079        self.pop.initialize('v', uniformDistr) 
    10801080        self.cells_to_record = [self.pop[0], self.pop[4]] 
    10811081        self.pop.record_v(self.cells_to_record)