Source code for linking

import numpy as np

from yt.funcs import mylog







  
[docs]def create_sublists(obj): """Create sublists of objects. Will create the sublists: - central_galaxies - satellite_galaxies - unassigned_galaxies (those without a halo) Parameters ---------- obj : :class:`main.CAESAR` Object containing halos and galaxies lists already linked. """ if not obj._has_galaxies: return mylog.info('Creating sublists') obj.central_galaxies = [] obj.satellite_galaxies = [] # assign halo sub lists for halo in obj.halos: halo.central_galaxy = -1 for galaxy in halo.galaxies: if galaxy.central: halo.central_galaxy = galaxy.GroupID # else: # halo.satellite_galaxies.append(galaxy) # assign galaxy sub lists for galaxy in obj.galaxies: if galaxy.central and galaxy.halo is not None: # galaxy.satellites = galaxy.halo.satellite_galaxies obj.central_galaxies.append(galaxy) elif galaxy.halo is not None: # galaxy.satellites = [] obj.satellite_galaxies.append(galaxy) else: if not hasattr(obj, 'unassigned_galaxies'): obj.unassigned_galaxies = [] obj.unassigned_galaxies.append(galaxy)