示例#1
0
import matplotlib.pyplot as plt
from math import *
import sys

if len(sys.argv) < 4:
    print 'rtp: not enough parameter!'
    print '\tUsage: rt.py dir_name snap_num radius'
    print '\tExample: rtp.py PKlh-1 0010 20.0'
    sys.exit(-1)

dir_name = sys.argv[1]
snap_num = sys.argv[2]
rsize = float(sys.argv[3])

ntot = 0
ntot, arr = mp.read_dump(mp.prefix, dir_name, snap_num)

r = arr['rad'][:]
T = arr['T'][:]

idw = np.where(arr['type'] == mp.TYPE_WARM)
idc = np.where(arr['type'] == mp.TYPE_COLD)

rc('font', size=17)

plt.xlabel('Radius [kpc]')
plt.ylabel('Temperature [K]')
plt.subplots_adjust(left=0.15, right=0.95, top=0.93, bottom=0.12)
plt.yscale('log')

print 'len of r:', len(r)
示例#2
0
文件: Dsort.py 项目: liulei/pymp
#base_name = '1E3'
#snap_num = '0001'
#nproc = 1

if len(sys.argv) < 4:
	print 'Dsort: not enough parameter!'
	print '\tUsage: Dsort.py dir_name snap_num range'
	print '\tExample: Dsort.py PKc-1 0001 50'
	sys.exit(1)

dir_name = sys.argv[1]
snap_num = sys.argv[2]
size = float(sys.argv[3])

ntot = 0
ntot, rarr = mp.read_dump(mp.prefix, dir_name, snap_num)

print 'Sorting...'
arr = np.sort(rarr, order = 'den')
print 'done!'

x = arr['pos'][:, 0]
y = arr['pos'][:, 1]
z = arr['pos'][:, 2]

den = arr['den'][:]

idw = np.where(arr['type'] == mp.TYPE_WARM)
idc = np.where(arr['type'] == mp.TYPE_COLD)
ids = np.where(arr['type'] == mp.TYPE_STAR_PARAL)