New question #688690 on Yade:
https://answers.launchpad.net/yade/+question/688690
Hi. I have a file of spherical particles saved by function of
pack.SpherePack().save(). It has the format as follows,
0.000919246 0.000859971 0.000602774 1.20067e-05 -1
0.000959836 0.00055149 0.000975021 2.11065e-05 -1
.....
I want to translate all the particles in x direction and conduct it by the
following python code,
=======================================
=======================================
import numpy as np
data = np.loadtxt('initial_spheres.txt', delimiter=' ', skiprows=0)
with open('initial_spheres_translate_x.txt','w') as fd:
for i in range(len(data)):
fd.write('%.9f %.9f %.9f %.5e %d\n' % (data[i,0]+0.5e-3, data[i,1],
data[i,2], data[i,3], -1))
=======================================
=======================================
and i got the data as this,
0.001919246 0.000859971 0.000602774 1.20067e-05 -1
0.001959836 0.000551490 0.000975021 2.11065e-05 -1
The format seems the same, however, there is an format error when reading the
file by pack.SpherePack().load() function.
By the way, i have tried the delimiter as space and tab and both don't work.
Thanks.
--
You received this question notification because your team yade-users is
an answer contact for Yade.
_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp