def particle_mask(self):
# Dynamically create the masking array for particles, and get
# the data using standard yt methods.
if self._particle_mask is not None:
return self._particle_mask
# This is from disk.
pid = self.__getitem__('particle_index')
# This is from the sphere.
if self._name == "RockstarHalo":
ds = self.ds.sphere(self.CoM, self._radjust * self.max_radius)
elif self._name == "LoadedHalo":
ds = self.ds.sphere(self.CoM, np.maximum(self._radjust * \
self.ds.quan(self.max_radius, 'code_length'), \
self.ds.index.get_smallest_dx()))
sp_pid = ds['particle_index']
self._ds_sort = sp_pid.argsort()
sp_pid = sp_pid[self._ds_sort]
# This matches them up.
self._particle_mask = np.in1d(sp_pid, pid)
return self._particle_mask
评论列表
文章目录