Exemplo n.º 1
0
def stellar_wind(wdir, number):

    import pyPLUTO as pp

    pp.nlast_info(w_dir=wdir)
    D = pp.pload(number, w_dir=wdir)
    print(D.rho.shape)

    rho = D.rho
    vx1 = D.vx1
    vx2 = D.vx2

    rho = np.transpose(rho)

    vx1 = np.transpose(vx1)
    vx2 = np.transpose(vx2)

    return rho, vx1, vx2
Exemplo n.º 2
0
def stellar_wind(wdir,number):

    import pyPLUTO as pp

    pp.nlast_info(w_dir=wdir)
    D = pp.pload(number,w_dir=wdir)
    print(D.rho.shape)

    rho = D.rho
    vx1 = D.vx1
    vx2 = D.vx2

    rho = np.transpose(rho)

    vx1 = np.transpose(vx1)
    vx2 = np.transpose(vx2)

                    
    return rho,vx1,vx2
Exemplo n.º 3
0
def stellar_wind(pcdata,width,rho_constant,wdir,number,r):

    import pyPLUTO as pp

    nlinf = pp.nlast_info(w_dir=wdir)
    D = pp.pload(number,w_dir=wdir)
    print(D.rho.shape)

    for i in range(width):
        for j in range(width):
            if (i-256)**2+(j-256)**2<r**2:
                pcdata[i,j] = D.rho[i,j]
    return pcdata
Exemplo n.º 4
0
def stellar_wind(pcdata, width, rho_constant, wdir, number, r):

    import pyPLUTO as pp

    nlinf = pp.nlast_info(w_dir=wdir)
    D = pp.pload(number, w_dir=wdir)
    print(D.rho.shape)

    for i in range(width):
        for j in range(width):
            if (i - 256)**2 + (j - 256)**2 < r**2:
                pcdata[i, j] = D.rho[i, j]
    return pcdata
Exemplo n.º 5
0
def stellar_wind(wdir, number):

    import pyPLUTO as pp

    pp.nlast_info(w_dir=wdir)
    D = pp.pload(number, w_dir=wdir)
    print(D.rho.shape)

    rho = D.rho
    bx1 = D.bx1
    bx2 = D.bx2
    bx3 = D.bx3
    vx1 = D.vx1
    vx2 = D.vx2
    vx3 = D.vx3
    rho = np.transpose(rho)
    bx1 = np.transpose(bx1)
    bx2 = np.transpose(bx2)
    bx3 = np.transpose(bx3)
    vx1 = np.transpose(vx1)
    vx2 = np.transpose(vx2)
    vx3 = np.transpose(vx3)

    return rho, bx1, bx2, bx3, vx1, vx2, vx3
Exemplo n.º 6
0
def stellar_wind(wdir,number):

    import pyPLUTO as pp

    pp.nlast_info(w_dir=wdir)
    D = pp.pload(number,w_dir=wdir)
    print(D.rho.shape)

    rho = D.rho
    bx1 = D.bx1
    bx2 = D.bx2
    bx3 = D.bx3
    vx1 = D.vx1
    vx2 = D.vx2
    vx3 = D.vx3
    rho = np.transpose(rho)
    bx1 = np.transpose(bx1)
    bx2 = np.transpose(bx2)
    bx3 = np.transpose(bx3)
    vx1 = np.transpose(vx1)
    vx2 = np.transpose(vx2)
    vx3 = np.transpose(vx3)
                    
    return rho,bx1,bx2,bx3,vx1,vx2,vx3
Exemplo n.º 7
0
def plot_jet():
	set_pretty()
	nlinf = pp.nlast_info()
	D = pp.pload(nlinf['nlast'])
	I = pp.Image()
	I.pldisplay(D, D.rho,x1=D.x1,x2=D.x2,label1='$x$',label2='$y$',
	            title=r'Density $\rho$ [MHD jet]',cbar=(True,'vertical'),figsize=[7,12])

	print (I.pldisplay.__doc__)

	# Code to plot field lines. Requires 2 arrays xarr and yarr as
	# the starting point of integration i.e. x and y co-ordinate of the field point.
	I.myfieldlines(D,linspace(D.x1.min(),D.x1.max(),10),linspace(D.x2.min(),D.x2.min(),10),
               colors='w',ls='-',lw=1.5)

	savefig('jet_final.png') # Only to be saved as either .png or .jpg
Exemplo n.º 8
0
def cf(temperature,plot=False):
    '''
    calculate cooling function lambda(T)
    temperature(K), return(erg cm^-3 s^-1)
    array input is accessible
    '''
    cooling = np.loadtxt('cooling.dat')
    if plot:
        plt.loglog(cooling[:,0],cooling[:,1])
        plt.loglog(temperature,np.interp(temperature, cooling[:,0],cooling[:,1]),'o')
    
    return np.interp(temperature, cooling[:,0],cooling[:,1])

wdir = './'
nlinf = pp.nlast_info(w_dir=wdir)

#D = pp.pload(nlinf['nlast'],w_dir=wdir) # Loading the data into a pload object D
D = pp.pload(2,w_dir=wdir)
T= (D.prs*un.Ba/(D.rho*un.cm**-3)/con.k_B*1.67e-6).to('K')
print cf(T.value).shape
#f=open('rho.txt','r+')
#temp=f.read()
#temp=
#imshow(T.value)

I = pp.Image()
I.pldisplay(D, cf(T.value),x1=D.x1,x2=D.x2,label1='x',label2='y',title=r'Density $\rho$ [MHD_Blast test]',cbar=(True,'vertical'))
#savefig('MHD_Blast.png') # Only to be saved as either .png or .jpg
plt.show()
Exemplo n.º 9
0
    
    I = pp.Image()
    flux=D.prs*1.67e-7/D.rho/1000000/1.3806488e-23
#    print flux.shape
#    flux= (flux-np.mean(flux))*5+np.mean(flux)*5.3
#    flux=nd.gaussian_filter(flux,sigma=(4,4),order=0)
    I.pldisplay(D, flux,x1=D.x1, \
                x2=D.x2,label1='l offset (pc)',label2='b offset (pc)',                                    \
                title='Temperature',                        
                cbar=(True,'vertical'))
#    savefig('MHD_Blast.png') # Only to be saved as either .png or .jpg
    plt.show()
#==================================main========================================  
if __name__=='__main__':   
    #font = {'family' : 'serif',  
    #        'weight' : 'normal',  
    #        'size'   : 12,  
    #        }  
    
    choose = 'single' #single or multiple or temp
    ty     = 'flux'    
    t      = 18000   
    E      = 1.3
    rho    = 0.21
    sigma  = 14
    
    wdir = './'
    nlinf = pp.nlast_info(w_dir=wdir)
#    single(ty,t,E,rho,sigma,wdir)
    analyze(ty,t,E,rho,sigma,wdir)
Exemplo n.º 10
0
import os
import sys
from numpy import *
from matplotlib.pyplot import *
import pyPLUTO as pp

#To run this example it is suggested to get data in 2D using pluto_01.ini and set the data in flt datatype instead of dbl.h5

plutodir = os.environ['PLUTO_DIR']
wdir = plutodir + '/Test_Problems/HD/Stellar_Wind/'
nlinf = pp.nlast_info(w_dir=wdir, datatype='float')

D = pp.pload(nlinf['nlast'], w_dir=wdir,
             datatype='float')  # Loading the data into a pload object D.

I = pp.Image()
I.pldisplay(D,
            log10(D.rho),
            x1=D.x1,
            x2=D.x2,
            label1='x',
            label2='y',
            title=r'Log Density $\rho$ [Stellar Wind]',
            cbar=(True, 'vertical'),
            figsize=[8, 12])

# Code to plot arrows. --> Spacing between the arrow can be adjusted by modifying the newdims tuple of conrid function.
T = pp.Tools()
newdims = 2 * (20, )
Xmesh, Ymesh = meshgrid(D.x1.T, D.x2.T)
xcong = T.congrid(Xmesh, newdims, method='linear')
Exemplo n.º 11
0
  max_imy=min(abs(ty1), abs(ty2), abs(ty3))
  
  tx1=sx/(-np.sin(phi))
  tx2=sy/(np.cos(phi))

  max_imx=min(abs(tx1), abs(tx2))

  print("Image size; ")
  print(max_imx, max_imy)
  return (int(max_imx),int( max_imy))


###########################################################################################################
print("################################################################### \n Integration of emission for PLUTO data \nVersion 5.1\n ##########################################################################")

nr=pp.nlast_info(datatype="vtk") #Reading simulation information
out=[] #Creating an array to store coordinates for integration
sx=0
sy=0
sz=0 

#Read parameters from input file
fp = open('paramsee.dat', 'r')
buffer=fp.read()
bufarr=buffer.splitlines()

buffer1,fr=bufarr[0].split('=')
buffer1,phi=bufarr[1].split('=')
buffer1,theta=bufarr[2].split('=')
buffer1,d_name=bufarr[3].split('=')
buffer1,lengthunit=bufarr[4].split('=')
Exemplo n.º 12
0
import os
import sys
from numpy import *
from matplotlib.pyplot import *
import pyPLUTO as pp

#To run this example it is suggested to get data in 2D using pluto_01.ini and set the data in flt datatype instead of dbl.h5

plutodir = os.environ['PLUTO_DIR']
wdir = plutodir+'/Test_Problems/HD/Stellar_Wind/'
nlinf = pp.nlast_info(w_dir=wdir,datatype='float')

D = pp.pload(nlinf['nlast'],w_dir=wdir,datatype='float') # Loading the data into a pload object D.

I = pp.Image()
I.pldisplay(D, log10(D.rho),x1=D.x1,x2=D.x2,label1='x',label2='y',
            title=r'Log Density $\rho$ [Stellar Wind]',cbar=(True,'vertical'),figsize=[8,12])

# Code to plot arrows. --> Spacing between the arrow can be adjusted by modifying the newdims tuple of conrid function.
T = pp.Tools()
newdims = 2*(20,)
Xmesh, Ymesh = meshgrid(D.x1.T,D.x2.T)
xcong = T.congrid(Xmesh,newdims,method='linear')
ycong = T.congrid(Ymesh,newdims,method='linear')
velxcong = T.congrid(D.vx1.T,newdims,method='linear')
velycong = T.congrid(D.vx2.T,newdims,method='linear')
gca().quiver(xcong, ycong, velxcong, velycong,color='w')

savefig('stellar_wind_1.png')
show()
Exemplo n.º 13
0
    def __init__(self,master):

        # create toplevel window
        frame = Frame(master)
        
        frame.grid(ipadx=10,ipady=10)

        try:
            sys.argv[1]
        except:
            self.datatype = None
        else:
            self.datatype = sys.argv[1].split('--')[1]

        
        self.wdir = os.getcwd() + '/'
        self.I = pp.Image()
        self.Tool = pp.Tools()
        


        self.lb1=Label(frame, text="Nstep").grid(row=0,column=0)
        
        
        
        self.enstep = Entry(frame,width=8)
        self.enstep.grid(row=0,column=1)
        self.enstep.insert(0, "0")

        self.LoadedNstep = StringVar()
        self.PresentTime = StringVar()

        self.myData = self.loaddata()
        self.varkeys = self.myData.get_varinfo(self.datatype)['allvars']
        self.grid_dict= self.myData.grid()
    

        if self.grid_dict["n3"] != 1:
            self.Geom = '3D'
        elif self.grid_dict["n3"] == 1 and self.grid_dict["n2"] != 1:
            self.Geom = '2D'
        else:
            self.Geom = '1D'
            
        

        self.ldatabutton=Button(frame,text="Load data",command=self.loaddata)
        self.ldatabutton.grid(row=0,column=2)

############### MARK THE CUTS #################################

        self.ex1 = Entry(frame,width=5)
        self.ex1.grid(row=2,column=0)
        self.ex1.insert(0, "x1")

        self.ex2 = Entry(frame,width=5)
        self.ex2.grid(row=2,column=1)
        self.ex2.insert(0, "x2")
        
        self.ex3 = Entry(frame,width=5)
        self.ex3.grid(row=2,column=2)
        self.ex3.insert(0, "x3")

        if self.Geom == '2D':
            self.ex3.config(state='disabled')

        if self.Geom == '1D':
            self.ex3.config(state='disabled')
            self.ex2.config(state='disabled')
            self.ex1.config(state='disabled')
        

        # place a graph somewhere here
        self.f = Figure(figsize=(7,7), dpi=100)
        self.a = self.f.add_subplot(111)
        self.canvas = FigureCanvasTkAgg(self.f, master=root)
        self.canvas.show()
        self.canvas.get_tk_widget().grid(row=0,column=3,columnspan=10,rowspan=10,sticky=E)

        #self.toolbar = NavigationToolbar2TkAgg(self.canvas,tl)
        #self.toolbar.update()
        #self.canvas._tkcanvas.grid(row=60,column=15,sticky=E)

        self.v = StringVar()
        self.v.set("None")

################ VARIABLES TO PLOT #################################
        
        for j in range(len(self.varkeys)):
            self.ldata = Radiobutton(frame,text=self.varkeys[j],variable=self.v,value=self.varkeys[j],command=self.getmyvar)
            self.ldata.grid(row=3+j,column=0,sticky=W)
        

################ SLICES CHOICE #################################
            
        self.slvar = StringVar()
        self.slvar.set("Choose Slice")
        if self.Geom == '3D' :
            SliceList = ("Along x1","Along x2","Along x3","Along x1-x2","Along x2-x3","Along x3-x1")
        elif self.Geom == '2D' :
            SliceList = ("Along x1", "Along x2", "Along x1-x2")
        else:
            SliceList = ()

        for j in range(len(SliceList)):
            self.sldata = Radiobutton(frame,text=SliceList[j],variable=self.slvar,value=SliceList[j],command=self.setslice)
            self.sldata.grid(row=3+j,column=1,sticky=W)

############### PLOT PROPERTIES #################################
            
        self.logvar = IntVar()
        self.chkb = Checkbutton(frame,text="Log  ",variable=self.logvar,onvalue=1,offvalue=0,command=self.logchkcall)
        self.chkb.grid(row=3,column=2,sticky=W)#(row=15,column=0,sticky=W)

        self.polarvar = IntVar()
        self.polchkb = Checkbutton(frame,text="Polar",variable=self.polarvar,onvalue=1,offvalue=0,command=self.polchkcall)
        self.polchkb.grid(row=4,column=2,sticky=W)#(row=15,column=1)
        if self.Geom == '1D':
            self.polchkb.config(state='disabled')
            self.polarvar.set(0)

        self.preaspect = IntVar()
        self.aspectb = Checkbutton(frame,text="Aspect",variable=self.preaspect,onvalue=1,offvalue=0,command=self.aspchkcall)
        self.aspectb.grid(row=5,column=2,sticky=W)#(row=15,column=2)
        if self.Geom == '1D':
            self.aspectb.config(state='disabled')

        

        

        
################ X and Y LABELS #################################
        
        self.lb2=Label(frame,text="Labels").grid(row=22,column=0)
    
        self.xlb = Entry(frame,width=15)
        self.xlb.grid(row=22,column=1)
        self.xlb.insert(0, "xlabel")

        self.ylb = Entry(frame,width=15)
        self.ylb.grid(row=22,column=2)
        self.ylb.insert(0, "ylabel")

############### X and Y RANGE#######################

        self.lb2a=Label(frame,text="XRange").grid(row=24,column=0)
        self.lb2b=Label(frame,text="YRange").grid(row=26,column=0)
        self.lb2c=Label(frame,text="VarRange").grid(row=28,column=0)
        
        self.xrmin = Entry(frame,width=15)
        self.xrmin.grid(row=24,column=1)
        self.xrmin.insert(0,'')
        self.xrmax = Entry(frame,width=15)
        self.xrmax.grid(row=24,column=2)
        self.xrmax.insert(0,'')
        
        self.yrmin = Entry(frame,width=15)
        self.yrmin.grid(row=26,column=1)
        self.yrmin.insert(0,'')
        self.yrmax = Entry(frame,width=15)
        self.yrmax.grid(row=26,column=2)
        self.yrmax.insert(0,'')

        self.varmin = Entry(frame,width=15)
        self.varmin.grid(row=28,column=1)
        self.varmin.insert(0,'')
        self.varmax = Entry(frame,width=15)
        self.varmax.grid(row=28,column=2)
        self.varmax.insert(0,'')
        if self.Geom == '1D':
            self.yrmin.config(state='disabled')
            self.yrmax.config(state='disabled')


################ CONTOURS #################################

        self.lb3=Label(frame,text="Contours").grid(row=16,column=0)
        
        self.contvar = IntVar()
        self.chkb = Checkbutton(frame,text="Contour",variable=self.contvar,onvalue=1,offvalue=0,command=self.contchkcall)
        self.chkb.grid(row=6,column=2,sticky=W)#(row=16,column=0,sticky=W)

        self.plcont = StringVar()
        self.contkeys = ["None"]
        if "bx1" in self.varkeys:
            for item in self.varkeys:
                self.contkeys.append(item)
            self.contkeys.append("x1*bx3")
            if "Ax3" in self.varkeys:
                self.contkeys.append("x1*Ax3")
        else:
            for item in self.varkeys:
                self.contkeys.append(item)        
        self.plcont.set("None")
        self.contmenu = OptionMenu(frame, self.plcont,*self.contkeys)
        self.contmenu.grid(row=16,column=1)

        self.xlevb = Entry(frame,width=15)
        self.xlevb.grid(row=16,column=2,sticky=W)
        self.xlevb.insert(0, "Levels")
        self.xlevb.config(state='disabled')
        self.contmenu.config(state='disabled')

        if self.Geom == '1D':
            self.chkb.config(state = 'disabled')
        
################ ARROWS #################################

        self.lb4=Label(frame,text="Arrows").grid(row=19,column=0)

        self.arrowvar = IntVar()
        self.arrowchkb = Checkbutton(frame,text="Arrows",variable=self.arrowvar,onvalue=1,offvalue=0,command=self.arrchkcall)
        self.arrowchkb.grid(row=7,column=2,sticky=W)#(row=16,column=0,sticky=W)

        self.arrspb = Entry(frame,width=15)
        self.arrspb.grid(row=19,column=2,sticky=W)
        self.arrspb.insert(0, "20")

    
        self.plarr = StringVar()
        self.arrkeys = ["None"]
        self.arrkeys.append("Vp")
        self.arrkeys.append("Vp_norm")
        if "bx1" in self.varkeys:
            self.arrkeys.append("Bp")
            self.arrkeys.append("Bp_norm")
        self.plarr.set("None")
        self.arrmenu = OptionMenu(frame,self.plarr,*self.arrkeys)
        self.arrmenu.grid(row=19,column=1)
        self.arrmenu.config(state='disabled')
        self.arrspb.config(state='disabled')

        if self.Geom == '1D':
            self.arrowchkb.config(state = 'disabled')
        

                
################ VARIOUS PLOTTING BUTTONS #################################

        self.pltbutton=Button(frame,text="Plot",command=self.plotfinal)
        self.pltbutton.grid(row=36,column=0)
        if self.Geom == '1D':
            self.pltbutton.config(state='active')
        else:
            self.pltbutton.config(state='disabled')

        self.surfbutton=Button(frame,text="Surface",command=self.plotsurface)
        self.surfbutton.grid(row=36,column=1)
        self.surfbutton.config(state='disabled')
        #if self.Geom == '1D':
        #    self.surfbutton.config(state='disabled')
        
        
        self.clrbutton=Button(frame,text="Clear",command=self.plotclear)
        self.clrbutton.grid(row=36,column=2)

################ INFORMATION #################################

        self.lbinf0 =  Label(frame,text="Information",font=("Times",12,"bold"))
        self.lbinf0.grid(row=47,column=0,sticky=W,columnspan=3)

        self.lbinf1a = Label(frame,text="Dir :",font=("Times",10,"bold")).grid(row=49,column=0,sticky=W,columnspan=3)
        self.lbinf1 =  Label(frame,text=self.wdir).grid(row=50,column=0,sticky=W,columnspan=3)
        self.lbinf2a = Label(frame,text="Domain :",font=("Times",10,"bold")).grid(row=51,column=0,sticky=W,columnspan=3)
        self.lbinf2 = Label(frame,text="n1 x n2 x n3 =  %d x %d x %d " % (self.grid_dict.get('n1'),self.grid_dict.get('n2'),self.grid_dict.get('n3'))).grid(row=52,column=0,sticky=W,columnspan=3)
        self.lbinf3a = Label(frame,text="Time Status",font=("Times",10,"bold")).grid(row=53,column=0,sticky=W,columnspan=3)
        self.lbinf4 = Label(frame,text="Nlast = %d"% (pp.nlast_info(datatype=self.datatype).get('nlast'))).grid(row=54,column=0,sticky=W,columnspan=3)
        self.lbinf5 = Label(frame,textvariable = self.LoadedNstep).grid(row=55,column=0,sticky=W,columnspan=3)
        self.lbinf6 = Label(frame,textvariable = self.PresentTime).grid(row=56,column=0,sticky=W,columnspan=3)
Exemplo n.º 14
0
import os
import sys
from numpy import *
from matplotlib.pyplot import *
import pyPLUTO as pp

plutodir = os.environ['PLUTO_DIR']
wdir = plutodir+'/Test_Problems/MHD/FARGO/Spherical_Disk/'
nlinf = pp.nlast_info(w_dir=wdir,datatype='vtk')

D = pp.pload(nlinf['nlast'],w_dir=wdir,datatype='vtk') # Loading the data into a pload object D.

I = pp.Image()

f1 = figure(figsize=[15,6],num=1)
ax1=f1.add_subplot(122)
I.pltSphData(D,w_dir=wdir,datatype='vtk',plvar='bx1',logvar=False,rphi=False,x3cut=96)
colorbar(orientation='horizontal')
ax1.set_xlabel(r'Radius')
ax1.set_ylabel(r'Height')
ax1.set_title(r'Magnetic field $B_{\rm x}$')

ax2=f1.add_subplot(121)
I.pltSphData(D,w_dir=wdir,datatype='vtk',plvar='rho',logvar=True,rphi=True,x2cut=24)
colorbar(orientation='vertical')
ax2.set_xlabel(r'x')
ax2.set_ylabel(r'y')
ax2.set_title(r'Log $\rho$')

# Code to plot arrows. --> Spacing between the arrow can be adjusted by 
# modifying the newdims tuple of conrid function.
Exemplo n.º 15
0
    def __init__(self, master):

        # create toplevel window
        frame = Frame(master)

        frame.grid(ipadx=10, ipady=10)

        self.wdir = os.getcwd() + '/'
        self.I = pp.Image()
        self.Tool = pp.Tools()

        self.lb1 = Label(frame, text="Nstep").grid(row=0, column=0)

        self.enstep = Entry(frame, width=8)
        self.enstep.grid(row=0, column=1)
        self.enstep.insert(0, "0")

        self.LoadedNstep = StringVar()
        self.PresentTime = StringVar()

        self.myData = self.loaddata()
        self.varkeys = self.myData.get_varinfo()['allvars']
        self.grid_dict = self.myData.grid()

        if self.grid_dict["n3"] != 1:
            self.Geom = '3D'
        elif self.grid_dict["n3"] == 1 and self.grid_dict["n2"] != 1:
            self.Geom = '2D'
        else:
            self.Geom = '1D'

        self.ldatabutton = Button(frame,
                                  text="Load data",
                                  command=self.loaddata)
        self.ldatabutton.grid(row=0, column=2)

        ############### MARK THE CUTS #################################

        self.ex1 = Entry(frame, width=5)
        self.ex1.grid(row=2, column=0)
        self.ex1.insert(0, "x1")

        self.ex2 = Entry(frame, width=5)
        self.ex2.grid(row=2, column=1)
        self.ex2.insert(0, "x2")

        self.ex3 = Entry(frame, width=5)
        self.ex3.grid(row=2, column=2)
        self.ex3.insert(0, "x3")

        if self.Geom == '2D':
            self.ex3.config(state='disabled')

        if self.Geom == '1D':
            self.ex3.config(state='disabled')
            self.ex2.config(state='disabled')
            self.ex1.config(state='disabled')

        # place a graph somewhere here
        self.f = Figure(figsize=(7, 7), dpi=100)
        self.a = self.f.add_subplot(111)
        self.canvas = FigureCanvasTkAgg(self.f, master=root)
        self.canvas.show()
        self.canvas.get_tk_widget().grid(row=0,
                                         column=3,
                                         columnspan=10,
                                         rowspan=10,
                                         sticky=E)

        #self.toolbar = NavigationToolbar2TkAgg(self.canvas,tl)
        #self.toolbar.update()
        #self.canvas._tkcanvas.grid(row=60,column=15,sticky=E)

        self.v = StringVar()
        self.v.set("None")

        ################ VARIABLES TO PLOT #################################

        for j in range(len(self.varkeys)):
            self.ldata = Radiobutton(frame,
                                     text=self.varkeys[j],
                                     variable=self.v,
                                     value=self.varkeys[j],
                                     command=self.getmyvar)
            self.ldata.grid(row=3 + j, column=0, sticky=W)

################ SLICES CHOICE #################################

        self.slvar = StringVar()
        self.slvar.set("Choose Slice")
        if self.Geom == '3D':
            SliceList = ("Along x1", "Along x2", "Along x3", "Along x1-x2",
                         "Along x2-x3", "Along x3-x1")
        elif self.Geom == '2D':
            SliceList = ("Along x1", "Along x2", "Along x1-x2")
        else:
            SliceList = ()

        for j in range(len(SliceList)):
            self.sldata = Radiobutton(frame,
                                      text=SliceList[j],
                                      variable=self.slvar,
                                      value=SliceList[j],
                                      command=self.setslice)
            self.sldata.grid(row=3 + j, column=1, sticky=W)

############### PLOT PROPERTIES #################################

        self.logvar = IntVar()
        self.chkb = Checkbutton(frame,
                                text="Log  ",
                                variable=self.logvar,
                                onvalue=1,
                                offvalue=0,
                                command=self.logchkcall)
        self.chkb.grid(row=3, column=2, sticky=W)  #(row=15,column=0,sticky=W)

        self.polarvar = IntVar()
        self.polchkb = Checkbutton(frame,
                                   text="Polar",
                                   variable=self.polarvar,
                                   onvalue=1,
                                   offvalue=0,
                                   command=self.polchkcall)
        self.polchkb.grid(row=4, column=2, sticky=W)  #(row=15,column=1)
        if self.Geom == '1D':
            self.polchkb.config(state='disabled')
            self.polarvar.set(0)

        self.preaspect = IntVar()
        self.aspectb = Checkbutton(frame,
                                   text="Aspect",
                                   variable=self.preaspect,
                                   onvalue=1,
                                   offvalue=0,
                                   command=self.aspchkcall)
        self.aspectb.grid(row=5, column=2, sticky=W)  #(row=15,column=2)
        if self.Geom == '1D':
            self.aspectb.config(state='disabled')

################ X and Y LABELS #################################

        self.lb2 = Label(frame, text="Labels").grid(row=22, column=0)

        self.xlb = Entry(frame, width=15)
        self.xlb.grid(row=22, column=1)
        self.xlb.insert(0, "xlabel")

        self.ylb = Entry(frame, width=15)
        self.ylb.grid(row=22, column=2)
        self.ylb.insert(0, "ylabel")

        ############### X and Y RANGE#######################

        self.lb2a = Label(frame, text="XRange").grid(row=24, column=0)
        self.lb2b = Label(frame, text="YRange").grid(row=26, column=0)
        self.lb2c = Label(frame, text="VarRange").grid(row=28, column=0)

        self.xrmin = Entry(frame, width=15)
        self.xrmin.grid(row=24, column=1)
        self.xrmin.insert(0, '')
        self.xrmax = Entry(frame, width=15)
        self.xrmax.grid(row=24, column=2)
        self.xrmax.insert(0, '')

        self.yrmin = Entry(frame, width=15)
        self.yrmin.grid(row=26, column=1)
        self.yrmin.insert(0, '')
        self.yrmax = Entry(frame, width=15)
        self.yrmax.grid(row=26, column=2)
        self.yrmax.insert(0, '')

        self.varmin = Entry(frame, width=15)
        self.varmin.grid(row=28, column=1)
        self.varmin.insert(0, '')
        self.varmax = Entry(frame, width=15)
        self.varmax.grid(row=28, column=2)
        self.varmax.insert(0, '')
        if self.Geom == '1D':
            self.yrmin.config(state='disabled')
            self.yrmax.config(state='disabled')

################ CONTOURS #################################

        self.lb3 = Label(frame, text="Contours").grid(row=16, column=0)

        self.contvar = IntVar()
        self.chkb = Checkbutton(frame,
                                text="Contour",
                                variable=self.contvar,
                                onvalue=1,
                                offvalue=0,
                                command=self.contchkcall)
        self.chkb.grid(row=6, column=2, sticky=W)  #(row=16,column=0,sticky=W)

        self.plcont = StringVar()
        self.contkeys = ["None"]
        if "b1" in self.varkeys:
            for item in self.varkeys:
                self.contkeys.append(item)
            self.contkeys.append("x1*b3")
            self.contkeys.append("x1*A3")
        else:
            for item in self.varkeys:
                self.contkeys.append(item)
        self.plcont.set("None")
        self.contmenu = OptionMenu(frame, self.plcont, *self.contkeys)
        self.contmenu.grid(row=16, column=1)

        self.xlevb = Entry(frame, width=15)
        self.xlevb.grid(row=16, column=2, sticky=W)
        self.xlevb.insert(0, "Levels")
        self.xlevb.config(state='disabled')
        self.contmenu.config(state='disabled')

        if self.Geom == '1D':
            self.chkb.config(state='disabled')

################ ARROWS #################################

        self.lb4 = Label(frame, text="Arrows").grid(row=19, column=0)

        self.arrowvar = IntVar()
        self.arrowchkb = Checkbutton(frame,
                                     text="Arrows",
                                     variable=self.arrowvar,
                                     onvalue=1,
                                     offvalue=0,
                                     command=self.arrchkcall)
        self.arrowchkb.grid(row=7, column=2,
                            sticky=W)  #(row=16,column=0,sticky=W)

        self.arrspb = Entry(frame, width=15)
        self.arrspb.grid(row=19, column=2, sticky=W)
        self.arrspb.insert(0, "20")

        self.plarr = StringVar()
        self.arrkeys = ["None"]
        self.arrkeys.append("Vp")
        self.arrkeys.append("Vp_norm")
        if "b1" in self.varkeys:
            self.arrkeys.append("Bp")
            self.arrkeys.append("Bp_norm")
        self.plarr.set("None")
        self.arrmenu = OptionMenu(frame, self.plarr, *self.arrkeys)
        self.arrmenu.grid(row=19, column=1)
        self.arrmenu.config(state='disabled')
        self.arrspb.config(state='disabled')

        if self.Geom == '1D':
            self.arrowchkb.config(state='disabled')

################ VARIOUS PLOTTING BUTTONS #################################

        self.pltbutton = Button(frame, text="Plot", command=self.plotfinal)
        self.pltbutton.grid(row=36, column=0)
        if self.Geom == '1D':
            self.pltbutton.config(state='active')
        else:
            self.pltbutton.config(state='disabled')

        self.surfbutton = Button(frame,
                                 text="Surface",
                                 command=self.plotsurface)
        self.surfbutton.grid(row=36, column=1)
        self.surfbutton.config(state='disabled')
        #if self.Geom == '1D':
        #    self.surfbutton.config(state='disabled')

        self.clrbutton = Button(frame, text="Clear", command=self.plotclear)
        self.clrbutton.grid(row=36, column=2)

        ################ INFORMATION #################################

        self.lbinf0 = Label(frame,
                            text="Information",
                            font=("Times", 12, "bold"))
        self.lbinf0.grid(row=47, column=0, sticky=W, columnspan=3)

        self.lbinf1a = Label(frame, text="Dir :",
                             font=("Times", 10, "bold")).grid(row=49,
                                                              column=0,
                                                              sticky=W,
                                                              columnspan=3)
        self.lbinf1 = Label(frame, text=self.wdir).grid(row=50,
                                                        column=0,
                                                        sticky=W,
                                                        columnspan=3)
        self.lbinf2a = Label(frame,
                             text="Domain :",
                             font=("Times", 10, "bold")).grid(row=51,
                                                              column=0,
                                                              sticky=W,
                                                              columnspan=3)
        self.lbinf2 = Label(
            frame,
            text="n1 x n2 x n3 =  %d x %d x %d " %
            (self.grid_dict.get('n1'), self.grid_dict.get('n2'),
             self.grid_dict.get('n3'))).grid(row=52,
                                             column=0,
                                             sticky=W,
                                             columnspan=3)
        self.lbinf3a = Label(frame,
                             text="Time Status",
                             font=("Times", 10, "bold")).grid(row=53,
                                                              column=0,
                                                              sticky=W,
                                                              columnspan=3)
        self.lbinf4 = Label(frame,
                            text="Nlast = %d" %
                            (pp.nlast_info().get('nlast'))).grid(row=54,
                                                                 column=0,
                                                                 sticky=W,
                                                                 columnspan=3)
        self.lbinf5 = Label(frame,
                            textvariable=self.LoadedNstep).grid(row=55,
                                                                column=0,
                                                                sticky=W,
                                                                columnspan=3)
        self.lbinf6 = Label(frame,
                            textvariable=self.PresentTime).grid(row=56,
                                                                column=0,
                                                                sticky=W,
                                                                columnspan=3)