yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #19548
Re: [Question #680375]: How to delete 10% percent of small particles?
Question #680375 on Yade changed:
https://answers.launchpad.net/yade/+question/680375
Status: Open => Answered
Robert Caulk proposed the following answer:
I guess it's a python question.
import numpy as np
def delBelowPercentile(a, q):
maxRad = np.percentile(a,q)
for b in bodyRadius:
if b[0].shape.radius <= maxRad:
O.bodies.erase(b[0].id)
bodyRadius = []
for b in O.bodies:
if isinstance(b.shape,Sphere):
bodyRadius.append([b,b.shape.radius])
bodyRadius.sort(key=lambda x: x[1])
delBelowPercentile(bodyRadius,10)
--
You received this question notification because your team yade-users is
an answer contact for Yade.