Commit 8f91b7b8 authored by jclamber's avatar jclamber

accuracy fix for COM with python

git-svn-id: http://svn.oamp.fr/repos/unsio/trunk@187 ce2cc22f-6084-46ce-a062-084b172ee5dc
parent 4e6e0b94
#
nemocvs:
rsync -CRav --exclude-from=exclude.txt CMakeLists.txt INSTALL LICENSE 3rdparty cmake man src scripts template test_src py ${NEMO}/usr/jcl/unsio
rsync -Racv src/*.{f,F,cc,h} test_src/*.{f,F,cc,h} CMakeLists.txt cmake/*.cmake doc/*.{odp,pdf,txt} INSTALL mmakefile man/man3/* 3rdparty/nemolight/build/CMakeLists.txt 3rdparty/nemolight/src/*.{c,h} 3rdparty/nemolight/src/inc/*.{c,h} 3rdparty/nemolight/src/inc/snapshot/*.{c,h} 3rdparty/nemolight/src/fortran_old_gcc/*.{c,h} template/uns_devel/cmake/*.cmake template/uns_devel/README template/uns_devel/CMakeLists.txt template/uns_devel/src/*.{c,cc,F} template/uns_devel/lib/src/*.{c,cc,F} scripts/perl/lib/Tools/*.pm scripts/perl/mains/*.pl scripts/sql/*.sql scripts/sql/README ${NEMO}/usr/jcl/unsio
tar :
......
......@@ -172,9 +172,14 @@ def compute(file,out,component,times,xrange,sigma):
## rho = z
# center according COM
x -= np.average(x,weights=mass)
y -= np.average(y,weights=mass)
z -= np.average(z,weights=mass)
xcom=np.average(x.astype(np.float64),weights=mass)
ycom=np.average(y.astype(np.float64),weights=mass)
zcom=np.average(z.astype(np.float64),weights=mass)
print "COM = ",xcom,ycom,zcom
x -= xcom
y -= ycom
z -= zcom
if xrange>0:
xmin = -xrange
......@@ -209,13 +214,20 @@ def compute(file,out,component,times,xrange,sigma):
# xlvis.append(x[i])
# ylvis.append(y[i])
fig = plt.figure()#figsize=(1024,1024))
fig = plt.figure(figsize=(20,20),dpi=150)#figsize=(1024,1024))
DPI = fig.get_dpi()
print "DPI:", DPI
DefaultSize = fig.get_size_inches()
print "Default size in Inches", DefaultSize
print "Which should result in a %i x %i Image"%(DPI*DefaultSize[0], DPI*DefaultSize[1])
# gaussian filter
t0 = time.clock()
zd = grid_density_gaussian_filter(view_xmin, view_ymin, view_xmax, view_ymax, 1024,1024, x, y, sigma,rho)
plt.title(uns.getFileName())
print "Filename = ",uns.getFileName()
# plot component text
## xtext=(view_xmin+0.85*(view_xmax-view_xmin))
## ytext=(view_ymin+0.90*(view_ymax-view_ymin))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment