本文整理汇总了Python中random.vonmisesvariate函数的典型用法代码示例。如果您正苦于以下问题:Python vonmisesvariate函数的具体用法?Python vonmisesvariate怎么用?Python vonmisesvariate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vonmisesvariate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: generateMesh
def generateMesh(n_points):
points = [] # Simple 2D for initial testing
for i in range(n_points):
r = random.gauss(10,0.05)
theta = random.vonmisesvariate(math.pi,0)
phi = random.vonmisesvariate(math.pi, 0)
x= r * math.sin(theta) * math.cos(phi)
y= r * math.sin(theta) * math.sin(phi)
z= r * math.cos(theta)
points.append([x,y,z])
# Now just to check we have the target number of unique points
nppoints = np.asarray(points)
meshgen = pymesh.tetgen();
meshgen.points = nppoints;
meshgen.merge_coplanar = True
meshgen.coarsening = False
meshgen.verbosity = 0
meshgen.run()
mesh = pymesh.subdivide(meshgen.mesh, order = 5, method="loop")
mesh = meshgen.mesh
return(mesh)
开发者ID:rjames93,项目名称:WorldGen,代码行数:26,代码来源:generateMesh.py
示例2: randlog
def randlog(eps):
"""Return a random complex number, clustered near 0.
The value returned has modulus in [eps, 1], with uniformly distributed logarithm. Its argument is uniformly distributed.
"""
return rect(math.exp(uniform(math.log(eps), 0)), vonmisesvariate(0, 0))
开发者ID:thisrod,项目名称:hamacobian,代码行数:7,代码来源:hypotheses.py
示例3: drop_needle
def drop_needle(l):
x0 = random.random()
a = random.vonmisesvariate(0,0)
xeind = x0+l*math.cos(a)
if xeind <0 or xeind >1:
return True
else:
return False
开发者ID:janwillemvanittersum,项目名称:WISB256,代码行数:8,代码来源:estimate_pi.py
示例4: randline
def randline():
x0 = random.random()
a = random.vonmisesvariate(0,0)
x1 = x0+l*math.sin(a)
if math.floor(x0) != math.floor(x1):
return 1
return 0
开发者ID:KareldeWit,项目名称:WISB256,代码行数:8,代码来源:estimate_pi.py
示例5: naald
def naald(L):
x=random.random()
a=random.vonmisesvariate(0,0)
eind=x+L*math.cos(a)
if eind <= 1 and eind >= 0:
return False
else:
return True
开发者ID:rjmsilf,项目名称:WISB256,代码行数:8,代码来源:estimate_pi.py
示例6: drop_needle
def drop_needle(L):
x0 = random.random()
theta = random.vonmisesvariate(0,0)
x1 = x0 + L*math.cos(theta)
if x1 >= 1 or x1 <= 0:
return True
else:
return False
开发者ID:4172833,项目名称:WISB256,代码行数:8,代码来源:estimate_pi.py
示例7: drop_needle
def drop_needle(L):
x1 = random.random()
hoek = random.vonmisesvariate(0,0)
x2 = x1 + L * math.sin(hoek)
if x2 > 1 or x2 < 0:
return True
else:
return False
开发者ID:marionsnijders,项目名称:WISB256,代码行数:8,代码来源:estimate_pi.py
示例8: drop_needle
def drop_needle(L):
x = random.random()
a = random.vonmisesvariate(0,0)
x2 = (x + L*math.cos(a))
if x2 > 1 or x2 < 0:
return True
else:
return False
开发者ID:laura-ackermans,项目名称:WISB256,代码行数:8,代码来源:estimate_pi.py
示例9: drop_needle
def drop_needle(L):
m=random.random()
#a=2*3.141592653589793*random.random()
a=random.vonmisesvariate(0,0)
if abs(math.ceil(m+L*math.sin(a))-math.ceil(m))>0.1:
return True
else:
return False
开发者ID:DTijsma,项目名称:WISB256,代码行数:8,代码来源:estimate_pi.py
示例10: drop_needle
def drop_needle(L):
x0 = random.random()
a = random.vonmisesvariate(0,0)
x1 = x0 + L*math.cos(a)
if x1>0:
if x1<1:
return False
return True
开发者ID:gvanbeelen,项目名称:WISB256,代码行数:8,代码来源:estimate_pi.py
示例11: update_non_amcl
def update_non_amcl(self, scan, pf):
self.weight_particles(scan, pf)
resampledPoses = []
notAccepted = True
numParticles = len(pf.particlecloud.poses)
#Resamples the poses
for i in range(0,numParticles):
notAccepted = True
while (notAccepted):
index = random.randint(0,numParticles-1)
posX = pf.particlecloud.poses[index].position.x
posY = pf.particlecloud.poses[index].position.y
if (random.uniform(0,1) < particleWeights[index]/totalWeight):
notAccepted = False
resampledPoses.append(pf.particlecloud.poses[index])
cont = True
pArray = PoseArray()
temp = []
val = Pose()
count = 0
#Smudges the poses
while cont:
temp = []
val = resampledPoses[0]
count = 0
#Removes the duplicate poses from the list
for i in range(0, len(resampledPoses)):
if (resampledPoses[i] == val):
count = count + 1
else:
temp.append(resampledPoses[i])
resampledPoses = temp
#Checks that we have allocated all particles to be smudged
if (len(resampledPoses) == 0):
cont = False
#Apply smuding to all but one of the same resampled particle
for i in range(0, count):
if i > 0:
newPose = Pose()
newPose.position.x = random.gauss(val.position.x, 0.35) #TEST THIS
newPose.position.y = random.gauss(val.position.y, 0.35)
newPose.orientation = rotateQuaternion(val.orientation, random.vonmisesvariate(0, 7))
#MAKE SURE TO TEST
pArray.poses.append(newPose)
else:
pArray.poses.append(val)
return pArray
开发者ID:JamesKlee,项目名称:part3,代码行数:58,代码来源:updateParticle.py
示例12: drop_needle
def drop_needle(L) :
x = random.random()
a = random.vonmisesvariate(0,0)
x1 = x + L * math.cos(a)
if x1 <= 0 or x1 >= 1:
return(True)
else:
return(False)
开发者ID:vpeer,项目名称:WISB256,代码行数:9,代码来源:estimate_pi.py
示例13: drop_needle
def drop_needle(integer):
x = random.random()
a = random.vonmisesvariate(0,0)
verschil = math.cos(a)
eindpunt = x + (integer * math.cos(a))
if 0 < eindpunt and eindpunt < 1:
return False
else:
return True
开发者ID:3037444,项目名称:WISB256,代码行数:9,代码来源:estimate_pi.py
示例14: drop_needle
def drop_needle(L):
x_1 = random.random()
hoek = random.vonmisesvariate(0,0)
x_2 = x_1 + l*math.cos(hoek)
if x_2 > 1 or x_2 < 0:
return True
else:
return False
开发者ID:mdelepper,项目名称:WISB256,代码行数:10,代码来源:estimate_pi.py
示例15: drop_neelde
def drop_neelde(L):
x = random.random()
y = random.random()
a = random.vonmisesvariate(0,0)
xEnd = x+L*math.cos(a)
yEnd = y+L*math.sin(a)
if xEnd<0 or xEnd>1:
return True
else:
return False
开发者ID:faust2016,项目名称:WISB256,代码行数:10,代码来源:estimate_pi.py
示例16: drop_needle
def drop_needle(L):
startX = random.random() + L
#startY = random.random()
angle = random.vonmisesvariate(0,0)
endX = startX + L*math.cos(angle)
#endY = startY + L*math.sin(angle)
diffX = abs(int(startX) - int(endX))
#print("xb:", startX, "xe:", endX, "=", diffX)
return diffX > 0
开发者ID:koenz11,项目名称:WISB256,代码行数:10,代码来源:estimate_pi.py
示例17: drop_needle
def drop_needle(L):
needleX = random.random()
angle = random.vonmisesvariate(0,0)
needleX2 = needleX + L* math.cos(angle)
if needleX2 > 1 or needleX2 < 0:
#print(needleX, angle, needleX2)
return True
else:
return False
开发者ID:TimdeJonge,项目名称:WISB256,代码行数:10,代码来源:estimate_pi.py
示例18: drop_needle
def drop_needle(L):
x1=random.random()
phi=random.vonmisesvariate(0,0)
x2=x1+L*math.cos(phi)
if x1==1 or x1==0:
return True
elif x2<=0 or x2>=1:
return True
else:
return False
开发者ID:Hoencamp,项目名称:WISB256,代码行数:10,代码来源:estimate_pi.py
示例19: drop_needle
def drop_needle(L):
# uniform in [0,1]
x1 = random.random()
# uniform in [0,2pi]
a = random.vonmisesvariate(0,0)
x2 = x1+L*math.sin(a)
if x2>=1 or x2<=0:
return True
else:
return False
开发者ID:damienst,项目名称:WISB256-1,代码行数:10,代码来源:estimate_pi.py
示例20: drop_needle
def drop_needle(L):
x0 = random.random()
y0 = random.random()
angle = random.vonmisesvariate(0,0)
punt2 = (x0+L*math.cos(angle),y0+L*math.sin(angle))
if punt2[0]<=0 or punt2[0]>=1:
hit = True
else:
hit = False
return hit
开发者ID:koenstemerdink,项目名称:WISB256,代码行数:10,代码来源:estimate_pi.py
注:本文中的random.vonmisesvariate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论