示例#1
0
 def onShowHalos(self, event):
     nstart,nstop = mys.get_range()
     nstart = nstop #! show only latest snapshot
     for nc in range(nstop-nstart+1):
         nsnap = nc + nstart
         if(not mys.snap_exists(nsnap)):
             continue
         cmd = "vis_AHF_centers.py "+str(nsnap)+" && xview "+mys.d(nsnap)+"ov.dat.png"
         print(cmd)
         my.thread(cmd)
         exit
示例#2
0
 def onFillAHF(self, event):
     nstart,nstop=mys.get_range()
     for nc in range(nstop-nstart+1):
         nsnap = nc + nstart
         if(not mys.snap_exists(nsnap)):
             continue
         cmd = "fill_ahf_to_db.py " + str(nsnap)
         print(cmd)
         my.thread(cmd)
         exit
     my.done()
示例#3
0
 def onFillAHF(self, event):
     nstart, nstop = mys.get_range()
     for nc in range(nstop - nstart + 1):
         nsnap = nc + nstart
         if (not mys.snap_exists(nsnap)):
             continue
         cmd = "fill_ahf_to_db.py " + str(nsnap)
         print(cmd)
         my.thread(cmd)
         exit
     my.done()
示例#4
0
 def onShowHalos(self, event):
     nstart, nstop = mys.get_range()
     nstart = nstop  #! show only latest snapshot
     for nc in range(nstop - nstart + 1):
         nsnap = nc + nstart
         if (not mys.snap_exists(nsnap)):
             continue
         cmd = "vis_AHF_centers.py " + str(nsnap) + " && xview " + mys.d(
             nsnap) + "ov.dat.png"
         print(cmd)
         my.thread(cmd)
         exit
示例#5
0
 def onGenAOI(self, event):
     nstart,nstop=mys.get_range()
     for nc in range(nstop-nstart+1):
         nsnap = nc + nstart
         if(not mys.snap_exists(nsnap)):
             continue
         d  = mys.d(nsnap)
         my.mkdir(d+"stars")
         my.mkdir(d+"dm")
         cmd = "gen_spheres.py "+str(nsnap)+" 2" # 1 at end: centers from AHF. 2: after shrinking sphere
         my.run(cmd)
     my.done()
示例#6
0
 def onGenSpheres(self, event):
     nstart, nstop = mys.get_range()
     for nc in range(nstop - nstart + 1):
         nsnap = nc + nstart
         if (not mys.snap_exists(nsnap)):
             continue
         d = mys.d(nsnap)
         my.mkdir(d + "dm")
         if (not mys.is_dmonly()):
             my.mkdir(d + "stars")
         cmd = "cd " + d + " && gen_spheres.py " + str(nsnap) + " 1"
         my.run(cmd)
     my.done()
示例#7
0
 def onGenSpheres(self, event):
     nstart,nstop=mys.get_range()
     for nc in range(nstop-nstart+1):
         nsnap = nc + nstart
         if(not mys.snap_exists(nsnap)):
             continue
         d  = mys.d(nsnap)
         my.mkdir(d+"dm")
         if(not mys.is_dmonly()):
             my.mkdir(d+"stars");
         cmd = "cd "+d+" && gen_spheres.py "+str(nsnap)+" 1"
         my.run(cmd)
     my.done()
示例#8
0
 def onGenAOI(self, event):
     nstart, nstop = mys.get_range()
     for nc in range(nstop - nstart + 1):
         nsnap = nc + nstart
         if (not mys.snap_exists(nsnap)):
             continue
         d = mys.d(nsnap)
         my.mkdir(d + "stars")
         my.mkdir(d + "dm")
         cmd = "gen_spheres.py " + str(
             nsnap
         ) + " 2"  # 1 at end: centers from AHF. 2: after shrinking sphere
         my.run(cmd)
     my.done()
示例#9
0
 def onRunR2G(self, event):
     nstart, nstop = mys.get_range()
     print('nstart, nstop = ', nstart, nstop)
     for nc in range(nstop - nstart + 1):
         nsnap = nc + nstart
         print('nsnap = ', nsnap)
         if (not mys.snap_exists(nsnap)):
             continue
         d = mys.d(nsnap)
         my.mkdir(d + "/r2g")
         if (mys.is_dmonly()):
             cmd = "mpirun -np 8 r2g -d " + d
         else:
             cmd = "mpirun -np 8 r2g -i " + d
         print(cmd)
         my.thread(cmd)
     self.SetBackgroundColour("darkgreen")
     my.done()
示例#10
0
 def onRunR2G(self, event):
     nstart,nstop=mys.get_range()
     print('nstart, nstop = ', nstart, nstop)
     for nc in range(nstop-nstart+1):
         nsnap = nc + nstart
         print('nsnap = ', nsnap)
         if(not mys.snap_exists(nsnap)):
             continue
         d = mys.d(nsnap)
         my.mkdir(d+"/r2g")
         if(mys.is_dmonly()):
             cmd = "mpirun -np 8 r2g -d "+d
         else:
             cmd = "mpirun -np 8 r2g -i "+d
         print(cmd)
         my.thread(cmd)
     self.SetBackgroundColour("darkgreen")
     my.done()
示例#11
0
 def onShrink(self, event):
     nstart,nstop=mys.get_range()
     # have xs,xs_star set in the end
     for nc in range(nstop-nstart+1):
         nsnap = nc + nstart
         if(not mys.snap_exists(nsnap)):
             continue
         print(mys.get_nhalo(nsnap))
         for i in range(3):#range(mys.get_nhalo(nsnap)):
             if(not mys.exists_snap(nsnap)):
                 print("snapshot "+str(nsnap)+" missing")
                 continue
             cmd = "shrink_sphere.py "+str(nsnap)+" "+str(i+1)
             my.run(cmd)
             if(not mys.is_dmonly()):
                 cmd = "shrink_sphere_stars.py "+str(nsnap)+" "+str(i+1)
                 my.run(cmd)
             # TODO: if empty xs (shrinking sphere algorithm did not succeed: use xc)
     my.done()
示例#12
0
 def onFolderSetup(self, event):
     print(" ")
     print("folder setup")
     nstop = mys.getNmax()
     print('nstop = ',nstop)
     for nc in range(nstop):
         if(not mys.snap_exists(nc+1)):
             continue
         print("generating folders in output ",nc+1)
         d=mys.d(nc+1)
         print(d)
         my.mkdir(d+'amr');    my.mv(d+"amr_*",d+"amr")
         my.mkdir(d+'grav');   my.mv(d+"grav_*",d+'/grav')
         my.mkdir(d+'part');   my.mv(d+'part_*',d+'/part')
         if(not self.dmonly):
             print("create folder hydro as well")
             my.mkdir(d+'hydro');  my.mv(d+"hydro_*",d+'/hydro')
     self.SetBackgroundColour("darkgreen")
     my.done()
示例#13
0
 def onShrink(self, event):
     nstart, nstop = mys.get_range()
     # have xs,xs_star set in the end
     for nc in range(nstop - nstart + 1):
         nsnap = nc + nstart
         if (not mys.snap_exists(nsnap)):
             continue
         print(mys.get_nhalo(nsnap))
         for i in range(3):  #range(mys.get_nhalo(nsnap)):
             if (not mys.exists_snap(nsnap)):
                 print("snapshot " + str(nsnap) + " missing")
                 continue
             cmd = "shrink_sphere.py " + str(nsnap) + " " + str(i + 1)
             my.run(cmd)
             if (not mys.is_dmonly()):
                 cmd = "shrink_sphere_stars.py " + str(nsnap) + " " + str(
                     i + 1)
                 my.run(cmd)
             # TODO: if empty xs (shrinking sphere algorithm did not succeed: use xc)
     my.done()
示例#14
0
    def onRunAHF(self, event):
        nstart, nstop = mys.get_range()
        print('nstart, nstop: ', nstart, nstop)
        for nc in range(nstop - nstart + 1):
            nsnap = nc + nstart
            print('nsnap = ', nsnap)
            if (not mys.snap_exists(nsnap)):
                continue
            d = mys.d(nsnap)
            f = open(d + "AHFinput", "w")

            f.write("[AHF]\n\
\n\
# (stem of the) filename from which to read the data to be analysed\n\
ic_filename       = r2g/r2g.\n\
\n\
# what type of input file (cf. src/libio/io_file.h)\n\
ic_filetype       = 61\n\
\n\
# prefix for the output files\n\
outfile_prefix    = testahf\n\
\n\
# number of grid cells for the domain grid (1D)\n\
LgridDomain       = 4\n\
\n\
# number of grid cells for the domain grid (1D) (limits spatial resolution to BoxSize/LgridMax)\n\
LgridMax          = 16777216\n\
\n\
# refinement criterion on domain grid (#particles/cell)\n\
NperDomCell       = 5.0\n\
\n\
# refinement criterion on all higher resolution grids (#particles/cells)\n\
NperRefCell       = 5.0\n\
\n\
# particles with velocity v > VescTune x Vesc are considered unbound\n\
VescTune          = 1.5\n\
\n\
# minimum number of particles for a halo\n\
NminPerHalo       = 100\n\
\n\
# normalisation for densities (1: RhoBack(z), 0:RhoCrit(z))\n\
RhoVir            = 1\n\
\n\
# virial overdensity criterion (<0: let AHF calculate it); Rvir is defined via M(<Rvir)/Vol = Dvir * RhoVir\n\
Dvir              = 200\n\
#-1\n\
\n\
# maximum radius (in Mpc/h) used when gathering initial set of particles for each halo (should be larger than the largest halo expected)\n\
MaxGatherRad      = 0.2\n\
\n\
# the level on which to perform the domain decomposition (MPI only, 4=16^3, 5=32^3, 6=64^3, 7=128^3, 8=256^3, etc.)\n\
LevelDomainDecomp = 4\n\
\n\
# how many CPU's for reading (MPI only)\n\
NcpuReading       = 16\n\
\n\
############################### FILE SPECIFIC DEFINITIONS ###############################\n\
\n\
# NOTE: all these factors are supposed to transform your internal units to\n\
#           [x] = Mpc/h\n\
#           [v] = km/sec\n\
#           [m] = Msun/h\n\
#           [e] = (km/sec)^2\n\
\n\
[GADGET]\n\
GADGET_LUNIT      = 0.001\n\
GADGET_MUNIT      = 1.0E10\n")
            f.close()

            print("TODO: AHFinput written?")
            cmd = "cd " + d + " && AHF AHFinput"
            cmd += " && mv " + d + "*_halos " + d + "halos"
            cmd += " && mv " + d + "*_centres " + "centres"
            cmd += " && mv " + d + "*_particles " + d + "particles"
            cmd += " && mv " + d + "*_profiles " + d + "profiles"
            cmd += " && rm -f " + d + "halo"
            cmd += " && echo 'done'"
            print(cmd)
            my.thread(cmd)
        my.done()
示例#15
0
    def onRunAHF(self,event):
        nstart,nstop=mys.get_range()
        print('nstart, nstop: ',nstart, nstop)
        for nc in range(nstop-nstart+1):
            nsnap = nc + nstart
            print('nsnap = ', nsnap)
            if(not mys.snap_exists(nsnap)):
                continue
            d  = mys.d(nsnap)
            f = open(d+"AHFinput","w")

            f.write("[AHF]\n\
\n\
# (stem of the) filename from which to read the data to be analysed\n\
ic_filename       = r2g/r2g.\n\
\n\
# what type of input file (cf. src/libio/io_file.h)\n\
ic_filetype       = 61\n\
\n\
# prefix for the output files\n\
outfile_prefix    = testahf\n\
\n\
# number of grid cells for the domain grid (1D)\n\
LgridDomain       = 4\n\
\n\
# number of grid cells for the domain grid (1D) (limits spatial resolution to BoxSize/LgridMax)\n\
LgridMax          = 16777216\n\
\n\
# refinement criterion on domain grid (#particles/cell)\n\
NperDomCell       = 5.0\n\
\n\
# refinement criterion on all higher resolution grids (#particles/cells)\n\
NperRefCell       = 5.0\n\
\n\
# particles with velocity v > VescTune x Vesc are considered unbound\n\
VescTune          = 1.5\n\
\n\
# minimum number of particles for a halo\n\
NminPerHalo       = 100\n\
\n\
# normalisation for densities (1: RhoBack(z), 0:RhoCrit(z))\n\
RhoVir            = 1\n\
\n\
# virial overdensity criterion (<0: let AHF calculate it); Rvir is defined via M(<Rvir)/Vol = Dvir * RhoVir\n\
Dvir              = 200\n\
#-1\n\
\n\
# maximum radius (in Mpc/h) used when gathering initial set of particles for each halo (should be larger than the largest halo expected)\n\
MaxGatherRad      = 0.2\n\
\n\
# the level on which to perform the domain decomposition (MPI only, 4=16^3, 5=32^3, 6=64^3, 7=128^3, 8=256^3, etc.)\n\
LevelDomainDecomp = 4\n\
\n\
# how many CPU's for reading (MPI only)\n\
NcpuReading       = 16\n\
\n\
############################### FILE SPECIFIC DEFINITIONS ###############################\n\
\n\
# NOTE: all these factors are supposed to transform your internal units to\n\
#           [x] = Mpc/h\n\
#           [v] = km/sec\n\
#           [m] = Msun/h\n\
#           [e] = (km/sec)^2\n\
\n\
[GADGET]\n\
GADGET_LUNIT      = 0.001\n\
GADGET_MUNIT      = 1.0E10\n")
            f.close()

            print("TODO: AHFinput written?")
            cmd = "cd "+d+" && AHF AHFinput"
            cmd += " && mv "+d+"*_halos "+d+"halos"
            cmd += " && mv "+d+"*_centres "+"centres"
            cmd += " && mv "+d+"*_particles "+d+"particles"
            cmd += " && mv "+d+"*_profiles "+d+"profiles"
            cmd += " && rm -f "+d+"halo"
            cmd += " && echo 'done'"
            print(cmd)
            my.thread(cmd)
        my.done()
示例#16
0
    def OnPlot(self, event):
        print("plot")
        f=1 # scaling of sphere wrt rvir
        vis  = True; show = True; run  = True;
        my.mkdir(mys.simdir()+"/ana")
        ddm  = mys.simdir() + "/ana/dm/";    my.mkdir(ddm)
        dgas = mys.simdir() + "/ana/gas/";   my.mkdir(dgas)
        dstar= mys.simdir() + "/ana/stars/"; my.mkdir(dstar)
        dpd  = mys.simdir() + "/phasediag/"; my.mkdir(dpd)
        nstart,nstop=mys.get_range()
        x,y,z,r,snap=mys.getxyzrsnap(nstop)#TODO: nstart,nstop
        xs,ys,zs,rs,snap=mys.getxyzrsnap_stars(nstart,nstop)
        #x,y,z,r,snap=mys.mt_xyzrsnap(nstart,nstop)
        #xs,ys,zs,rs,snap=mys.mt_xyzrsnap_stars(nstart,nstop)
        for i in range(nstop-nstart+1):
            nc = nstop-i
            if(not mys.snap_exists(nc)):
                continue
            stri=str(nc).zfill(5)
            print("nc = ",nc)
            print(x[i], xs[i])
            print(y[i], ys[i])
            print(z[i], zs[i])
            print(r[i], rs[i])
            d = mys.d(nc)
            # scale
            if self.fix:
                r[i]=0.002; rs[i]=0.002;

            sx = str(x[i])
            sy = str(y[i])
            sz = str(z[i])
            sr = str(r[i])
            ssx= str(sx[i])
            ssy= str(ys[i])
            ssz= str(sz[i])
            ssr= str(rs[i])
            lma = str(mys.get_lma())
            bndry  = " "+sx+" "+sy+" "+sz+" "+sr+" "
            bndryc =" -xc "+sx+" -yc "+sy+" -zc "+sz+" -rc "+sr+" "

            #calc all pix, dep. on which option was clicked
            if self.radio==0:
                print("gas density")
                ofname = dgas+"gas_boxall_"+stri+".png"
                cmd1 = amr2map+" -typ 1 -lma "+lma+" -inp "+d+" -out "+dgas+"gas_boxall_"+stri
                cmd1 = cmd1 +".dat -dir z "+bndryc
                cmd2 = "map2img.py -l --colormap=hot "+dgas+"gas_boxall_"+stri+".dat "
                cmd2 = cmd2+"-o "+ofname+" && xview "+ofname
                print(dgas+"gas_boxall_"+stri+".png")
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)

            if self.radio==1:
                print("gas pressure")
                if(mys.is_dmonly()):
                    print("not available, dm only simulation!")
                    exit
                cmd1 = amr2map + " -typ 5 -lma "+lma+" -inp "+d
                cmd1 = cmd1+" -out "+dgas+"p_"+stri+".dat "+"-dir z "+bndryc
                cmd2 = "map2img.py -l --colormap=hot "+dgas+"p_"+stri+".dat "
                ofname = dgas+"p_"+stri+".png"
                cmd2 = cmd2+" -o "+ofname+" && xview "+ofname
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)

            if self.radio==2:
                print("gas temperature")
                cmd1 = amr2map+" -typ 18 -lma "+lma+" -inp "+d
                cmd1 = cmd1+" -out "+dgas+"temp_"+stri+".dat "+"-dir z "+bndryc
                cmd2 = "map2img.py -l --colormap=hot "+dgas+"temp_"+stri+".dat "
                ofname = dgas+"temp_"+stri+".png"
                cmd2 = cmd2+" -o "+ofname+" && xview "+ofname
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)

            if self.radio==3:
                print("DM contours")
                # get DM particle positions for each halo
                cmd1 = "get_sphere_dm -inp "+d+bndryc+" > "+ddm+"dm_"+stri+".dat"
                cmd1+= "&& octreef "+ddm+"dm_"+stri+".dat > "+ddm+"rho_"+stri+".dat"
                cmd2 ="vis_part_proj_dm.py "+bndry+" "\
                       +ddm+"dm_"+stri+".dat "+ddm+"dm_part_"+stri+".png"
                ofname=ddm+"rho_"+stri+".dat "+ddm+"contour_"+stri+".png"
                cmd2+="; vis_dm_contour.py "+bndry+" "\
                       +ofname+" && xview "+ofname
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)

            if self.radio==4:
                print("metallicity")
                #cmd = "vis_parts.py stars.part"
                #cmd = "get_sphere_stars -inp "+d\
                #+" -xc "+sx+" -yc "+sy+" -zc "+sz+" -r "+sr+">ana/stars/stars_"+stri
                cmd1 = "metal2map -inp "+d+" -out "+dstar+"stars_"+stri+".dat "
                cmd1 = cmd1+"-nx 512 -ny 512 -dir z "+bndryc
                cmd2 = "map2img.py -l --colormap=jet "+dstar+"stars_"+stri+".dat "
                ofname = dstar+"stars_"+stri+".png"
                cmd2 = cmd2+"-o "+ofname+" && xview "+ofname
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)

            if self.radio==5:
                print("phase diagram")
                fn = dpd+"temp_"+str(nc).zfill(5)
                cmd1 = "get_temp -inp "+d+" -out "+fn
                cmd1+=  " -lma "+lma+" -typ 18"
                ofname=fn+".png"
                cmd2 = "plot_temp_rho.py "+fn+" "+ofname+" && xview "+ofname
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)

            if self.radio==6:
                print("rho_dm(r)")
                cmd1 = "gen_prof_dm.py "+str(nc)+" "+sx+" "+sy+" "+sz+" "+sr;
                ofname = ddm+"prof_"+stri+".png "
                cmd2 = "plot_prof_sph.py "+ddm+"prof_"+stri+".dat "\
                       +ddm+"rho_"+stri+".dat "\
                       +ofname+sx+" "+sy+" "+sz+" "+str(mys.get_z(nc))+"&& xview "+ofname
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)


            if self.radio==7:
                print("rho_gas(r)")
                cmd1 = "gen_prof_gas.py "+str(nc)+" "+sx+" "+sy+" "+sz+" "+sr+" "+lma;
                ofname = dgas+"prof_"+stri+".png "
                cmd2 = "plot_prof_sph.py "+dgas+"prof_"+stri+".dat "\
                       +dgas+"rho_"+stri+".dat "\
                       +ofname+sx+" "+sy+" "+sz+" && xview "+ofname
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)


            if self.radio==8:
                print("rho_star(r)")
                cmd1 = "gen_prof_stars.py "+str(nc)+" "+sx+" "+sy+" "+sz+" "+sr;
                ofname = dstar+"prof_"+stri+".png "
                cmd2 = "plot_prof_sph.py "+dstar+"prof_"+stri+".dat "\
                       +dstar+"rho_"+stri+".dat "\
                       +ofname+sx+" "+sy+" "+sz+" && xview "+ofname
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)

            if self.radio==9:
                print("SFR")
                cmd1 = "count_stars -inp "+d+bndryc+" >> "+dstar+"star_counts.dat"
                #cmd2 = "plot_columns.py star_counts.dat 1 4"
                cmd2 = "calc_sfr.py "+dstar+"star_counts.dat 0 4"
                my.threadif(cmd1,cmd2,self.calc,vis,show,run)

            if(not self.loop):
                break
        my.done()
示例#17
0
    def OnPlot(self, event):
        print("plot")
        f = 1  # scaling of sphere wrt rvir
        vis = True
        show = True
        run = True
        my.mkdir(mys.simdir() + "/ana")
        ddm = mys.simdir() + "/ana/dm/"
        my.mkdir(ddm)
        dgas = mys.simdir() + "/ana/gas/"
        my.mkdir(dgas)
        dstar = mys.simdir() + "/ana/stars/"
        my.mkdir(dstar)
        dpd = mys.simdir() + "/phasediag/"
        my.mkdir(dpd)
        nstart, nstop = mys.get_range()
        x, y, z, r, snap = mys.getxyzrsnap(nstop)  #TODO: nstart,nstop
        xs, ys, zs, rs, snap = mys.getxyzrsnap_stars(nstart, nstop)
        #x,y,z,r,snap=mys.mt_xyzrsnap(nstart,nstop)
        #xs,ys,zs,rs,snap=mys.mt_xyzrsnap_stars(nstart,nstop)
        for i in range(nstop - nstart + 1):
            nc = nstop - i
            if (not mys.snap_exists(nc)):
                continue
            stri = str(nc).zfill(5)
            print("nc = ", nc)
            print(x[i], xs[i])
            print(y[i], ys[i])
            print(z[i], zs[i])
            print(r[i], rs[i])
            d = mys.d(nc)
            # scale
            if self.fix:
                r[i] = 0.002
                rs[i] = 0.002

            sx = str(x[i])
            sy = str(y[i])
            sz = str(z[i])
            sr = str(r[i])
            ssx = str(sx[i])
            ssy = str(ys[i])
            ssz = str(sz[i])
            ssr = str(rs[i])
            lma = str(mys.get_lma())
            bndry = " " + sx + " " + sy + " " + sz + " " + sr + " "
            bndryc = " -xc " + sx + " -yc " + sy + " -zc " + sz + " -rc " + sr + " "

            #calc all pix, dep. on which option was clicked
            if self.radio == 0:
                print("gas density")
                ofname = dgas + "gas_boxall_" + stri + ".png"
                cmd1 = amr2map + " -typ 1 -lma " + lma + " -inp " + d + " -out " + dgas + "gas_boxall_" + stri
                cmd1 = cmd1 + ".dat -dir z " + bndryc
                cmd2 = "map2img.py -l --colormap=hot " + dgas + "gas_boxall_" + stri + ".dat "
                cmd2 = cmd2 + "-o " + ofname + " && xview " + ofname
                print(dgas + "gas_boxall_" + stri + ".png")
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 1:
                print("gas pressure")
                if (mys.is_dmonly()):
                    print("not available, dm only simulation!")
                    exit
                cmd1 = amr2map + " -typ 5 -lma " + lma + " -inp " + d
                cmd1 = cmd1 + " -out " + dgas + "p_" + stri + ".dat " + "-dir z " + bndryc
                cmd2 = "map2img.py -l --colormap=hot " + dgas + "p_" + stri + ".dat "
                ofname = dgas + "p_" + stri + ".png"
                cmd2 = cmd2 + " -o " + ofname + " && xview " + ofname
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 2:
                print("gas temperature")
                cmd1 = amr2map + " -typ 18 -lma " + lma + " -inp " + d
                cmd1 = cmd1 + " -out " + dgas + "temp_" + stri + ".dat " + "-dir z " + bndryc
                cmd2 = "map2img.py -l --colormap=hot " + dgas + "temp_" + stri + ".dat "
                ofname = dgas + "temp_" + stri + ".png"
                cmd2 = cmd2 + " -o " + ofname + " && xview " + ofname
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 3:
                print("DM contours")
                # get DM particle positions for each halo
                cmd1 = "get_sphere_dm -inp " + d + bndryc + " > " + ddm + "dm_" + stri + ".dat"
                cmd1 += "&& octreef " + ddm + "dm_" + stri + ".dat > " + ddm + "rho_" + stri + ".dat"
                cmd2 ="vis_part_proj_dm.py "+bndry+" "\
                       +ddm+"dm_"+stri+".dat "+ddm+"dm_part_"+stri+".png"
                ofname = ddm + "rho_" + stri + ".dat " + ddm + "contour_" + stri + ".png"
                cmd2+="; vis_dm_contour.py "+bndry+" "\
                       +ofname+" && xview "+ofname
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 4:
                print("metallicity")
                #cmd = "vis_parts.py stars.part"
                #cmd = "get_sphere_stars -inp "+d\
                #+" -xc "+sx+" -yc "+sy+" -zc "+sz+" -r "+sr+">ana/stars/stars_"+stri
                cmd1 = "metal2map -inp " + d + " -out " + dstar + "stars_" + stri + ".dat "
                cmd1 = cmd1 + "-nx 512 -ny 512 -dir z " + bndryc
                cmd2 = "map2img.py -l --colormap=jet " + dstar + "stars_" + stri + ".dat "
                ofname = dstar + "stars_" + stri + ".png"
                cmd2 = cmd2 + "-o " + ofname + " && xview " + ofname
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 5:
                print("phase diagram")
                fn = dpd + "temp_" + str(nc).zfill(5)
                cmd1 = "get_temp -inp " + d + " -out " + fn
                cmd1 += " -lma " + lma + " -typ 18"
                ofname = fn + ".png"
                cmd2 = "plot_temp_rho.py " + fn + " " + ofname + " && xview " + ofname
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 6:
                print("rho_dm(r)")
                cmd1 = "gen_prof_dm.py " + str(
                    nc) + " " + sx + " " + sy + " " + sz + " " + sr
                ofname = ddm + "prof_" + stri + ".png "
                cmd2 = "plot_prof_sph.py "+ddm+"prof_"+stri+".dat "\
                       +ddm+"rho_"+stri+".dat "\
                       +ofname+sx+" "+sy+" "+sz+" "+str(mys.get_z(nc))+"&& xview "+ofname
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 7:
                print("rho_gas(r)")
                cmd1 = "gen_prof_gas.py " + str(
                    nc) + " " + sx + " " + sy + " " + sz + " " + sr + " " + lma
                ofname = dgas + "prof_" + stri + ".png "
                cmd2 = "plot_prof_sph.py "+dgas+"prof_"+stri+".dat "\
                       +dgas+"rho_"+stri+".dat "\
                       +ofname+sx+" "+sy+" "+sz+" && xview "+ofname
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 8:
                print("rho_star(r)")
                cmd1 = "gen_prof_stars.py " + str(
                    nc) + " " + sx + " " + sy + " " + sz + " " + sr
                ofname = dstar + "prof_" + stri + ".png "
                cmd2 = "plot_prof_sph.py "+dstar+"prof_"+stri+".dat "\
                       +dstar+"rho_"+stri+".dat "\
                       +ofname+sx+" "+sy+" "+sz+" && xview "+ofname
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if self.radio == 9:
                print("SFR")
                cmd1 = "count_stars -inp " + d + bndryc + " >> " + dstar + "star_counts.dat"
                #cmd2 = "plot_columns.py star_counts.dat 1 4"
                cmd2 = "calc_sfr.py " + dstar + "star_counts.dat 0 4"
                my.threadif(cmd1, cmd2, self.calc, vis, show, run)

            if (not self.loop):
                break
        my.done()