Ejemplo n.º 1
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()
Ejemplo n.º 2
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
Ejemplo n.º 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()
Ejemplo n.º 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
Ejemplo n.º 5
0
 def onMtree(self, event):
     nstart,nstop=mys.get_range()
     if(nstart==nstop):
         ns = str(nstart)
         cmd = "substructure.py "+ns
         my.thread(cmd)
     else:
         for nc in range(nstop-nstart+1):
             cmd = "merger_tree.py "+str(nstop-nc)+" "+str(nstop-1-nc)
             cmd+= "&& substructure.py "+str(nstop-nc)
             my.thread(cmd)
     my.done()
Ejemplo n.º 6
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()
Ejemplo n.º 7
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()
Ejemplo n.º 8
0
#print(len(xcl))

for i in range(3):
    xc=str(xcl[i]);       xs=str(xsl[i]);
    yc=str(ycl[i]);       ys=str(ysl[i]);
    zc=str(zcl[i]);       zs=str(zsl[i]);
    r=str(rvirl[i]*facr); rs=str(rsl[i]*facr*0.9);
    sj=str(i+1)

    # Dark Matter only
    cmd  = gsd+" -inp "+sim
    cmd +=" -xc "+xc+" -yc "+yc+" -zc "+zc+" -rc "+r
    cmd +=">"+sim+"dm/dm_"+sj+".dat && "
    cmd +="octreef "+sim+"dm/dm_"+sj+".dat > "+sim+"dm/rho_"+sj+".dat"
    if(show): print(cmd)
    if(run): my.thread(cmd)

    if(mys.is_dmonly):
        continue

    # stars only
    cmd = gss+" -inp "+sim
    # center on star center, but with virial radius
    if(typ==1):
        cmd +=" -xc "+xc+" -yc "+yc+" -zc "+zc+" -rc "+r
    if(typ==2): # second step: use shrinked sphere value for centering
        cmd +=" -xc "+xs+" -yc "+ys+" -zc "+zs+" -rc "+r
    cmd +=">"+sim+"stars/stars_"+sj+".dat"
    if(show): print(cmd)
    if(run): my.thread(cmd)
Ejemplo n.º 9
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()
Ejemplo n.º 10
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()