-
Notifications
You must be signed in to change notification settings - Fork 1
/
getgroupics.py
27 lines (19 loc) · 1.02 KB
/
getgroupics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# script to get the initial position and size of a group
# This needs the grp file from the group finder at z = 0, and the IC file
# from the volume run
# group = 19686 # the final gid of the group in question
# fileIC = 'runs22.bin'
# fileGRP = 'runs22.000500.fof.grp'
group = 201824 # the final gid of the group in question
fileIC = 'cosmo600.768.tbin'
fileGRP = 'cosmo600p.768.000512.fof.grp'
charm.loadSimulation(fileIC)
charm.readTipsyArray(fileGRP, 'fgid')
print charm.createGroup_AttributeRange('cluster', 'All', 'fgid', group - .5, group + .5)
range = charm.getAttributeRangeGroup('cluster', 'dark', 'position')
# center of bounding box:
print 0.5*(range[0][0] + range[1][0]), 0.5*(range[0][1] + range[1][1]), 0.5*(range[0][2] + range[1][2])
# semi-axes of bounding box:
print 0.5*(range[0][0] - range[1][0]), 0.5*(range[0][1] - range[1][1]), 0.5*(range[0][2] - range[1][2])
# radius of circumscribed sphere:
print (((range[0][0] - range[1][0])**2 + (range[0][1] - range[1][1])**2 + (range[0][2] - range[1][2])**2)**0.5)*0.5