Commit 0aa4aa10 authored by LAMBERT Jean-charles's avatar LAMBERT Jean-charles
Browse files

2dplot updates

parent 5e4f7716
......@@ -5,7 +5,7 @@ import numpy as np
import os,time
import sys
import argparse,textwrap
#sys.path=['/home/jcl/works/GIT/uns_projects/py/modules/']+sys.path
sys.path=['/home/jcl/works/GIT/uns_projects/py/modules/']+sys.path
#from IPython import embed
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......
......@@ -128,6 +128,7 @@ class C2dplot:
uns_snap=data.uns_snap # link to UNS object
ok,time=uns_snap.getData("time")
if self.__vdebug:
print("Core [%d] time <%f>"%(data.core_id,time))
if not contour:
my_dir=self.__movie_dir_std
......@@ -220,6 +221,7 @@ class C2dplot:
for my_dir in (self.__movie_dir_std, self.__movie_dir_contour):
if (not os.path.isdir(my_dir)) :
try:
if self.__vdebug:
print("Core ID ",data.core_id," create directory [%s]\n"%(my_dir))
os.makedirs(my_dir)
......@@ -431,6 +433,7 @@ class C2dplot:
newcy2=math.fabs(cx2[1]-center_xy[1])
best_winsize=max(max(newcx1,newcy1),max(newcx2,newcy2))
if self.__vdebug:
print("BEST =", best_winsize,newcx1,newcy1,newcx2,newcy2)
if best_winsize > xrange_ori:
xrange=best_winsize+0.2*xrange_ori # add 20% of rmax to best_winsize
......@@ -455,12 +458,13 @@ class C2dplot:
inches = 1080./mydpi
w=inches*ncols/nrows
h=inches
if self.__vdebug:
print("w/h=",w,h,w*mydpi,h*mydpi,file=sys.stderr)
# specify figure dimensions
fig=plt.figure(figsize=(w,h),dpi=mydpi)
#fig=plt.figure(figsize=(w,h))
if self.__vdebug:
print ("FIG DPI =",fig.dpi)
# create grid
gs = gridspec.GridSpec(nrows, ncols,wspace=0,hspace=0)#height_ratios=h,width_ratios=w)
......@@ -484,6 +488,7 @@ class C2dplot:
ok_center, center_xy,center_xz,ax,fig,r,contour=contour,nc=nc,
center_cod=center_cod,nopart=nopart)
fig.subplots_adjust(hspace=0.,wspace=0.)
if self.__vdebug:
print("Overall time [%.3f] sec"%(time.clock()-t0),file=sys.stderr)
if (out==''):
plt.show()
......@@ -535,7 +540,7 @@ class C2dplot:
y = pos[:,2] # z coordinates
nbody = x.size
if self.__vdebug:
print("Ok_center [%d] center_cod <%s>"%(ok_center,center_cod))
if ok_center:# it's a merger requested which exist
x -= center_xy[0]
......@@ -621,6 +626,7 @@ class C2dplot:
if self.__vdebug:
print("Sigma re-computed=",sigma)
zd = self.__grid_density_gaussian_filter(view_xmin, view_ymin, view_xmax, view_ymax, width,height, x, y, sigma,rho)
if self.__vdebug:
print("Gaussian filtering : [%.3f] sec"%(time.clock()-t1),file=sys.stderr)
# plot time text
xtext=(view_xmin+0.05*(view_xmax-view_xmin))
......@@ -650,6 +656,7 @@ class C2dplot:
if contour:
tc = time.clock()
plt.contour(zd, origin='lower',levels=np.logspace(np.log(zd.min()),np.log(zd.max()),nc),cmap='winter', norm = matplotlib.colors.LogNorm(),extent=[view_xmin, view_xmax, view_ymin, view_ymax] )
if self.__vdebug:
print("Contour : [%.3f] sec"%(time.clock()-tc),file=sys.stderr)
#plt.contour(zd, origin='lower',levels=np.linspace(np.log(zd.min()),np.log(zd.max()),50),cmap='winter', norm = matplotlib.colors.LogNorm() )
......
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