exposing the indices that has values <10 and >1000
print [(i,value) for i, value in enumerate(RelDist) if value<=10 ]
>>> [(261, 7.8062749), (389, 8.9522991), (409, 8.4432831), (525, 0.29229844),
(592, 9.6027441), (695, 0.70973402), (739, 9.7886152), (831, 9.9757767),
(882, 8.1458836), (1211, 7.2971973)]
print [(i,value) for i, value in enumerate(RelDist) if value>=1000 ]
>>> [(2, 1295.8337), (6, 1083.9229), (23, 1191.9043)]
So I now just filters these out.
RelDist = filter(lambda x: 10 <= x <= 1000, RelDist)
Trying to now index back to the subhalo catalog
firstSub = halos['GroupFirstSub'][RelDist]
Now this is where the problem is, when i print out the list of my new subhalo catalog,
But, when I do remove the indices manually (the correct values),
mask = (
( halos['Group_M_TopHat200'] > Mmin*h0/1e+10 ) & ( halos['Group_M_TopHat200'] < Mmax*h0/1e+10 )
).nonzero()[0]
remove_indices = [2, 6, 23, 261,389,409, 525, 592, 695, 739, 831, 882, 1211]
mask = [i for j, i in enumerate(mask) if j not in remove_indices]
firstSub = halos['GroupFirstSub'][mask]
firstSub = firstSub.astype('int32')
print firstSub
>>> [330938 332508 338209 ..., 460330 462088 463247]
Which are not at all the same.
Any advice on how to fix my first method?
Dylan Nelson
16 Jan '17
Sorry I don't think I'll be able to follow the code, maybe you can describe it more abstractly?
Perhaps I interpret this: you have a list of subhalo indices list_A. Then you go to their parent halos indexed by list_B and select on some property of those halos, giving you list_C of halo indices which is a subset of list_B. Then you take GroupFirstSub[list_C] which gives you a list of subhalo indices list_D which is a subset of the original list_A. I'm not sure what then? You should be able to access the properties of those subhalos with list_D.
Hi Dylan,
Like the title says, im trying to index back into the
GroupFirstSub
field after removing the indexes of subhalos that are not necessary in my analysisThis is the portion of my analysis that I find values that are unnecessary
exposing the indices that has values <10 and >1000
So I now just filters these out.
Trying to now index back to the subhalo catalog
Now this is where the problem is, when i print out the list of my new subhalo catalog,
But, when I do remove the indices manually (the correct values),
Which are not at all the same.
Any advice on how to fix my first method?
Sorry I don't think I'll be able to follow the code, maybe you can describe it more abstractly?
Perhaps I interpret this: you have a list of subhalo indices
list_A
. Then you go to their parent halos indexed bylist_B
and select on some property of those halos, giving youlist_C
of halo indices which is a subset oflist_B
. Then you takeGroupFirstSub[list_C]
which gives you a list of subhalo indiceslist_D
which is a subset of the originallist_A
. I'm not sure what then? You should be able to access the properties of those subhalos withlist_D
.