def disruption_mask(cc_satellites, criteria, M, X, Y, Z): """Returns np bool array of shape `cc_satellites` with disruption criteria (None, int, or list) implemented on satellite cores.""" if criteria is None: criteria = [] elif type(criteria) is int: criteria = [criteria] # criterion: (1) core radius is less than 20 kpc/h radius_mask = cc_satellites['radius'] < 20e-3 # criterion: (2) remove merged cores merged_mask = cc_satellites['merged'] != 1 # criterion: (3) cores are distance r >= 0.05*Rvir_0 from central core Rvir_0 = getRvir_0(M) x, y, z = periodic_bcs(cc_satellites['x'], X, BOXSIZE), periodic_bcs( cc_satellites['y'], Y, BOXSIZE), periodic_bcs(cc_satellites['z'], Z, BOXSIZE) distance_mask = dist(x, y, z, X, Y, Z) >= (0.05 * Rvir_0) masks_dict = {1: radius_mask, 2: merged_mask, 3: distance_mask} mask = np.full_like(cc_satellites['x'], True, bool) for i in criteria: mask = mask & masks_dict[i] return mask
def disruption_mask(cc_satellites, criteria, M, X, Y, Z, z): """Returns np bool array of shape `cc_satellites` with disruption criteria (None, int, or list) implemented on satellite cores.""" if criteria is None: criteria = [] elif type(criteria) is int: criteria = [criteria] # criterion: (1) core radius is less than 20 kpc/h radius_mask = cc_satellites['radius'] < CORERADIUSCUT # criterion: (2) remove merged cores merged_mask = cc_satellites['merged'] != 1 # criterion: (3) cores are distance r >= COREDISTANCEPERCENT*Rvir(z) from central core Rvir = getRvir(M, z) x, y, z = periodic_bcs(cc_satellites['x'], X, BOXSIZE), periodic_bcs(cc_satellites['y'], Y, BOXSIZE), periodic_bcs(cc_satellites['z'], Z, BOXSIZE) distance_mask = dist(x, y, z, X, Y, Z) >= (COREDISTANCEPERCENT*Rvir) masks_dict = { 1:radius_mask, 2:merged_mask, 3:distance_mask}#, 4:mergedCoreTag_mask } # criterion: (4) cores with a nonzero `mergedCoreTag` are removed if 4 in criteria: mergedCoreTag_mask = cc_satellites['mergedCoreTag']==0 masks_dict[4] = mergedCoreTag_mask mask = np.full_like(cc_satellites['x'], True, bool) for i in criteria: mask = mask&masks_dict[i] return mask