off = 5
im = Image.new("RGB", (x+2*off, y+2*off), "black")
draw = ImageDraw.Draw(im)
im.paste(inm, (off,off,x+off,y+off))

# assumption: box is across 1Mpc/h, with refinement in the inner 500kpc/h box
# this refinement box gets a scale bar
xstart = off + x/4
xend   = off + 3*x/4
ystart = yend = off + 6*y/8
draw.line((xstart, ystart, xend, yend), fill=0, width=3)


fout = sys.argv[2]
im.save(fout, "PNG")

sn   = sys.argv[3]
aout = float(sys.argv[4])
z    = 1.0/aout - 1.0
#text = "snap "+sn+",  a = "+str(aout) +",  z = "+str(z)
text = "  z = "+"%.2f"%z
my.txt2img(fout,text)

text = sys.argv[5]+" kpc/h"
my.txt2imgpos(fout,text,xstart,ystart)



del draw
Exemple #2
0
off = 5
im = Image.new("RGB", (2*x+x0+4*off,2*y+3*off), "black")
draw = ImageDraw.Draw(im)
im.paste(ul2, (off,off,x0+off,y+off))

im.paste(um2, (x0+2*off,off,x+x0+2*off,y+off))
draw.line((x0+2*off, off+y/2, x+x0+2*off, off+y/2), fill=128)
draw.line((x0+x/2+2*off, off, x0+x/2+2*off, off+y), fill=128)

im.paste(ur2, (x0+x+3*off,off,x0+2*x+3*off,y+off))
draw.line((x0+x+3*off, off+y/2, x0+2*x+3*off, off+y/2), fill=128)
draw.line((x0+1.5*x+3*off, off, x0+1.5*x+3*off, off+y), fill=128)

im.paste(bl2, (off,y+2*off,x0+off,2*y+2*off))
im.paste(bm2, (x0+2*off,y+2*off,x0+x+2*off,2*y+2*off))

im.paste(br2, (x0+x+3*off,y+2*off,x0+2*x+3*off,2*y+2*off))
draw.line((x0+x+3*off, 2*off+1.5*y, x0+2*x+3*off, 2*off+1.5*y), fill=128)
draw.line((x0+1.5*x+3*off, 2*off+y, x0+1.5*x+3*off, 2*off+2*y), fill=128)


fil = sys.argv[7]
sn   = sys.argv[8]
aout = float(sys.argv[9])
z    = 1.0/aout - 1.0
text = "snap "+sn+",  a = "+str(aout) +",  z = "+str(z)
im.save(fil, "PNG")
my.txt2img(fil,text)
del draw
Exemple #3
0
draw.line((x0 + 2 * off, off + y / 2, x + x0 + 2 * off, off + y / 2), fill=128)
draw.line((x0 + x / 2 + 2 * off, off, x0 + x / 2 + 2 * off, off + y), fill=128)

im.paste(ur2, (x0 + x + 3 * off, off, x0 + 2 * x + 3 * off, y + off))
draw.line((x0 + x + 3 * off, off + y / 2, x0 + 2 * x + 3 * off, off + y / 2),
          fill=128)
draw.line((x0 + 1.5 * x + 3 * off, off, x0 + 1.5 * x + 3 * off, off + y),
          fill=128)

im.paste(bl2, (off, y + 2 * off, x0 + off, 2 * y + 2 * off))
im.paste(bm2, (x0 + 2 * off, y + 2 * off, x0 + x + 2 * off, 2 * y + 2 * off))

im.paste(
    br2,
    (x0 + x + 3 * off, y + 2 * off, x0 + 2 * x + 3 * off, 2 * y + 2 * off))
draw.line((x0 + x + 3 * off, 2 * off + 1.5 * y, x0 + 2 * x + 3 * off,
           2 * off + 1.5 * y),
          fill=128)
draw.line((x0 + 1.5 * x + 3 * off, 2 * off + y, x0 + 1.5 * x + 3 * off,
           2 * off + 2 * y),
          fill=128)

fil = sys.argv[7]
sn = sys.argv[8]
aout = float(sys.argv[9])
z = 1.0 / aout - 1.0
text = "snap " + sn + ",  a = " + str(aout) + ",  z = " + str(z)
im.save(fil, "PNG")
my.txt2img(fil, text)
del draw