Changeset 861
- Timestamp:
- 04/02/16 13:44:19 (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/mystic/abstract_solver.py
r858 r861 426 426 return 427 427 428 def SetDistributionInitialPoints(self, dist ):428 def SetDistributionInitialPoints(self, dist, *args): 429 429 """Generate Random Initial Points from Distribution (dist) 430 430 431 431 input:: 432 - dist: a scipy.stats distribution instance""" 432 - dist: a scipy.stats distribution instance (or a numpy.random method) 433 434 note:: 435 this method only accepts numpy.random methods with the keyword 'size'""" 433 436 from mystic.tools import random_state 434 437 prng = random_state(module='numpy.random') 435 for i in range(self.nPop): 436 self.population[i] = dist.rvs(self.nDim, random_state=prng).tolist() 438 if not args and type(dist).__name__ is 'rv_frozen': #from scipy.stats 439 for i in range(self.nPop): 440 self.population[i] = dist.rvs(self.nDim, random_state=prng).tolist() 441 else: #from numpy.random with *args and size in kwds 442 for i in range(self.nPop): 443 self.population[i] = dist(*args, size=self.nDim).tolist() 437 444 return 438 445
Note: See TracChangeset
for help on using the changeset viewer.