Extract 2D cross-sections from the 3D sphere pack.
Hi All,
I modified the GravityDepositi
def checkUnbalanced():
if unbalancedForce() < .1:
sp.
O.run();
if (len(O.bodies) > 100):# and (unbalancedForce() < .1): #O.bodies.
O.run();
if unbalancedForce() < .1:
O.pause()
### Write cross-sections to image files. ###
X,Y,Z = np.meshgrid(
F = np.zeros(X.shape);
print len(O.bodies)
for i in range(len(
b = O.bodies[i]
if isinstance(
a = b.state.pos
idx = (np.sqrt((X - a[0])**2 + (Y - a[1])**2 + (Z - a[2])**2) <= b.shape.
F[idx] = 128;
Xres = np.arange(
from scipy.interpolate import griddata
I = griddata(
In the above code, I have difficulty (or am getting errors) reproducing the assignment of F and the correct way to pass arguments to 'griddata' function. Could anyone please point out the correct way to do it?
** Following are the error messages**
Corresponding to assignment of 'idx' in my Python code, I get following error:
--> 132 idx = (np.sqrt((X - spherePos[i,0])**2 + (Y - spherePos[i,1])**2 + (Z - spherePos[i,2])**2) <= sphereRad[
133 F[idx] = 128;
134 Xres = np.arange(
TypeError: 'float' object has no attribute '__getitem__'
If I comment the lines involving assignment of 'idx' and 'F' in my Python code, I get following error:
/usr/
177 xi, = xi
178 # Sort points/values together, necessary as input for interp1d
--> 179 idx = np.argsort(points)
180 points = points[idx]
181 values = values[idx]
/usr/
873 except AttributeError:
874 return _wrapit(a, 'argsort', axis, kind, order)
--> 875 return argsort(axis, kind, order)
876
877
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Question information
- Language:
- English Edit question
- Status:
- Expired
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: