Ejemplo n.º 1
0
	def proposal(self, guess, step):
		# Trial object
		Try = Sample() 
		Try.prior  = guess + step * ( 2. * uniform(len(self)) - 1. )  # |move| < step
		Try.prior -= np.floor(Try.prior)                     # wraparound to stay within (0,1)
	    	Try.pos    = 4.* Try.prior  - 2.
		return Try
Ejemplo n.º 2
0
	def proposal(self, guess, step):
		# Trial object
		Try = Sample() 
		Try.prior  = guess + step * ( 2. * uniform(len(self)) - 1. )  # |move| < step
		Try.prior -= np.floor(Try.prior)                     # wraparound to stay within (0,1)
	    	Try.pos    = np.array( [4.0, 2.0] ) * Try.prior  - np.array( [2.0, 0.0]) 
		return Try
Ejemplo n.º 3
0
	def fromPrior(self):
		"""
		Draw the parameters from the prior
		"""
		Obj = Sample()
	    	#Random position between [-2,2] x [0,2]
	    	Obj.prior = uniform( len(self) ) # uniform in (0,1)
	    	Obj.pos   = np.array( [4.0, 2.0] ) * Obj.prior  - np.array( [2.0, 0.0]) 
	    	Obj.logL  = self.lnp( Obj.pos )
		return Obj
Ejemplo n.º 4
0
	def fromPrior(self):
		"""
		Draw the parameters from the prior
		"""
		Obj = Sample()
	    	#Random position between [-2,2] x [0,2]
	    	Obj.prior = uniform( len(self) ) # uniform in (0,1)
	    	Obj.pos   = 4. * Obj.prior -2.
	    	Obj.logL  = self.lnp( Obj.pos )
		return Obj