Exemplo n.º 1
0
    yhalf = yhalf[::snapsep]
    zhalf = zhalf[::snapsep]
    vmagl = vmagl[::snapsep]
    #	reff = np.sqrt(np.array(yhalf)*np.array(zhalf))
    reff = np.array((xhalf + yhalf + zhalf) / 3.0)
    effsur = np.log10(
        reff * reff * 2.0 * np.pi * 1.425 * 1.425) * 2.5 + vmagl + 34.97
    effsur = np.array(effsur)
    print 'vmagl, effsur', vmagl, effsur
    if haloname[0] == 'f':
        plt.plot(vmagl,
                 effsur,
                 label=labelname,
                 marker=ms,
                 ls='none',
                 mfc=cmaps.plasma(icolor),
                 ms=12)
    else:
        plt.plot(vmagl,
                 effsur,
                 label=labelname,
                 marker=ms,
                 ls='none',
                 mfc=cmaps.plasma(icolor),
                 ms=12)
plt.plot(vmagLG, effsurLG, label='LG', marker='^', ls='none', ms=8)
plt.plot(vmagnb, effsurnb, label='Nearby', marker='*', ls='none', ms=8)
plt.xlabel(r'$M_{\rm V}$')
plt.ylabel(r'$\mu_{\rm mean}$')
plt.ylim([26, 18])
plt.xlim([-12, -17])
Exemplo n.º 2
0
 rlist = emdata['rlist']
 vollist = emdata['vollist']
 Gmlist = emdata['Gmlist']
 Smlist = emdata['Smlist']
 DMmlist = emdata['DMmlist']
 haloinfo = cosmichalo(runtodo)
 labelname = haloinfo['labelname']
 halocolor = haloinfo['halocolor']
 icolor = haloinfo['icolor']
 print 'halocolor', halocolor
 print 'labelname', labelname
 if DMonly == 1:
     plt.plot(rlist,
              DMmlist,
              ls=lsl[icount],
              color=cmaps.plasma(icolor),
              lw=2,
              label='t = ' + str(time) + 'Gyr')
 else:
     plt.plot(rlist,
              Smlist + DMmlist,
              ls=ilsl[icount],
              color=cmaps.plasma(icolor),
              lw=2)
 f = open(
     '/home/tkc004/samsonprogram/data/DMSMenc' + runtodol[0] +
     '_info.txt', 'w')
 for i in range(len(rlist)):
     f.write(
         str(rlist[i]) + '      ' + str(Smlist[i]) + '      ' +
         str(DMmlist[i]) + '  \n')
Exemplo n.º 3
0
 emdata = enclosedmass(runtodo, time, minr, maxr, galcen=galcen)
 rlist = emdata['rlist']
 vollist = emdata['vollist']
 Gmlist = emdata['Gmlist']
 Smlist = emdata['Smlist']
 DMmlist = emdata['DMmlist']
 haloinfo = cosmichalo(runtodo)
 labelname = haloinfo['labelname']
 halocolor = haloinfo['halocolor']
 icolor = haloinfo['icolor']
 print 'halocolor', halocolor
 print 'labelname', labelname
 if DMonly == 1:
     plt.plot(rlist,
              DMmlist,
              color=cmaps.plasma(icolor),
              label=labelname,
              lw=1.5)
 else:
     plt.plot(rlist,
              Smlist + DMmlist,
              color=cmaps.plasma(icolor),
              label=labelname,
              lw=1.5)
 time = runtodol[2]
 emdata = enclosedmass(runtodo, time, minr, maxr, galcen=galcen)
 rlist = emdata['rlist']
 vollist = emdata['vollist']
 Gmlist = emdata['Gmlist']
 Smlist = emdata['Smlist']
 DMmlist = emdata['DMmlist']
plt.savefig('./images/'+name,dpi = 300,margin=25)
plt.clf()

from colormaps import plasma
from matplotlib.cm import get_cmap
grey = get_cmap('Greys')

g = Graph.Barabasi(100,1,directed=False)
g = g.simplify()
d = g.degree()

max_d = float(log(max(d)))
g.vs['size'] = 25
for i in range(len(g.vs)):
	node_d = round(log(g.vs[i].degree()),1)
	g.vs[i]['color'] = plasma(node_d/max_d)
	if g.vs[i].degree()<6:
		g.vs[i]['label_color'] = 'white'
	else:
		g.vs[i]['label_color'] = 'black'


g.es['color'] = 'black'
g.vs['label'] = g.degree()
g.vs['label_size']=15

lay = g.layout_fruchterman_reingold()
plot(g,'./images/net_'+name,layout = lay,dpi = 300,bbox = (500,500),margin=50)

########################same but for random network
from collections import Counter
            urcrnrlat=38,
            urcrnrlon=52)
m.fillcontinents(color='lightgrey', lake_color='lightgrey')
m.drawcoastlines(linewidth=0.1)

shpname = './results/primate_vulnerability'
m.readshapefile(shpname, shpname, drawbounds=False)
info = shpname + '_info'
patches = []
vals = []
m_log = 6
for xy, info in zip(getattr(m, shpname), getattr(m, info)):
    if float(info['sv']) > 0:
        col_val = int(round(255 * (log(float(info['sv']) + 1) / m_log)))
        #print col_val
        col = plasma(col_val)
        poly = Polygon(
            xy, facecolor=col, ec=col, alpha=1,
            linewidth=0.0)  #,fill=True,joinstyle='round',rasterized=True)
        plt.gca().add_patch(poly)

cmleg = zeros((1, 7))
for i in range(7):
    cmleg[0, i] = i

cbar = plt.imshow(cmleg, cmap=plasma, aspect=1)
plt.colorbar()

plt.savefig('./results/primate_vulnerability.pdf', dpi=300)

####MAKE OIL PALM SUITABILITY MAP FOR FIG. 1b
Exemplo n.º 6
0
    fig = plt.figure(figsize=(3 * (len(graphs) + 1), 3 * 1.0))
    ax = fig.add_subplot(1, 1, 1)
    ind = 1.0 * np.arange(len(graphs))
    width = 0.9 / len(caches)
    print width
    rects = []
    newind = ind
    i = 0
    for cache in caches:
        print newind
        if myargs.hatch:
            rects += ax.bar(newind,
                            ecg_list[cache],
                            width,
                            color=cmaps.plasma(0.5 + 0.5 * i / len(caches)),
                            hatch=hatchmap[cache],
                            linewidth=2,
                            label=cache)
        else:
            rects += ax.bar(newind,
                            ecg_list[cache],
                            width,
                            color=cmaps.plasma(0.5 + 0.5 * i / len(caches)),
                            linewidth=1,
                            label=cache)
        newind += width
        i += 1
    ax.set_xticks(ind - width * len(caches) / 2)
    ax.set_xticklabels([g.replace("_", "-") for g in graphs])
    ax.grid(False)
Exemplo n.º 7
0
		elif dir=='z':
			ms='o'
			labelname=''
		for line in dars:
			xsd = line.split()
	#		print 'xsd', xsd
			reff=np.append(xhalf, float(xsd[1]))
			bmagl=np.append(bmagl, float(xsd[0]))
			muateff=np.append(muateff, float(xsd[3]))
	#	reff = np.sqrt(np.array(yhalf)*np.array(zhalf))
	#        reff = np.array((xhalf+yhalf+zhalf)/3.0)
	 #       effsur = np.log10(reff*reff*2.0*np.pi*1.425*1.425)*2.5+vmagl+34.97
		muateff = np.array(muateff)
		bmagl = np.array(bmagl)
	#	print 'vmagl, effsur', vmagl, effsur
		plt.plot(bmagl[::snapsep], muateff[::snapsep], label=labelname,marker=ms,ls='none', mfc='none',markeredgecolor=cmaps.plasma(icolor),markersize=8)

	for haloname in attenlist:
		ms='s'
		snapl=[]
		bmagl=[]
		muateff=[]
		xhalf=[]
		yhalf=[]
		zhalf=[]
		flog = open('/home/tkc004/samsonprogram/data/'+haloname+'aB'+dir+'r_galatten_Bband.txt', 'r')
		flog.readline()
		dars = flog.readlines()
		flog.close()
		haloinfo=cosmichalo(haloname)
		beginno=haloinfo['beginno']