← Back to team overview

yade-users team mailing list archive

Re: [Question #689914]: How to create spheres with radius varying with gaussian distrubtion

 

Question #689914 on Yade changed:
https://answers.launchpad.net/yade/+question/689914

Jan Stránský posted a new comment:
A MWE:
###
import scipy.stats
mean = 1
variance = .01

def gauss(x,mean,variance): # or using directly the formula if scipy.stats is not an option
   stddev = sqrt(variance)
   return scipy.stats.norm.cdf(x,mean,stddev)

sp = yade.pack.SpherePack()
psdSizes = numpy.linspace(0,4*mean,100)
psdCumm = [gauss(size,mean,variance) for size in psdSizes]
psdCumm[0] = 0
psdCumm[-1] = 1
sp.makeCloud((0,0,0),(10,10,10),num=1000,psdSizes=psdSizes,psdCumm=psdCumm)
sp.toSimulation()
br,bp,bc = yade.utils.psd(bins=50)
for r,p in zip(br,bp):
   print(r,p,gauss(2*r,mean,variance))
###

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.