Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions compas_python_utils/cosmic_integration/ClassCOMPAS.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def setCOMPASDCOmask(
che_mask = np.logical_and.reduce((stellar_type_1_zams == 16, stellar_type_2_zams == 16, che_ms_1 == True, che_ms_2 == True))
che_seeds = sys_seeds[()][che_mask]

self.CHE_mask = np.in1d(dco_seeds, che_seeds) if types == "CHE_BHBH" or types == "NON_CHE_BHBH" else np.repeat(False, len(dco_seeds))
self.CHE_mask = np.isin(dco_seeds, che_seeds) if types == "CHE_BHBH" or types == "NON_CHE_BHBH" else np.repeat(False, len(dco_seeds))

# if user wants to mask on Hubble time use the flag, otherwise just set all to True, use astype(bool) to set masks to bool type
hubble_mask = hubble_flag.astype(bool) if withinHubbleTime else np.repeat(True, len(dco_seeds))
Expand All @@ -118,22 +118,22 @@ def setCOMPASDCOmask(

# get the flags and unique seeds from the Common Envelopes file
ce_seeds = self.get_COMPAS_variables("BSE_Common_Envelopes", "SEED")
dco_from_ce = np.in1d(ce_seeds, dco_seeds)
dco_from_ce = np.isin(ce_seeds, dco_seeds)
dco_ce_seeds = ce_seeds[dco_from_ce]

# if masking on RLOF, get flag and match seeds to dco seeds
if noRLOFafterCEE:
rlof_flag = self.get_COMPAS_variables("BSE_Common_Envelopes", "Immediate_RLOF>CE")[dco_from_ce].astype(bool)
rlof_seeds = np.unique(dco_ce_seeds[rlof_flag])
rlof_mask = np.logical_not(np.in1d(dco_seeds, rlof_seeds))
rlof_mask = np.logical_not(np.isin(dco_seeds, rlof_seeds))
else:
rlof_mask = np.repeat(True, len(dco_seeds))

# if masking on pessimistic CE, get flag and match seeds to dco seeds
if pessimistic:
pessimistic_flag = self.get_COMPAS_variables("BSE_Common_Envelopes", "Optimistic_CE")[dco_from_ce].astype(bool)
pessimistic_seeds = np.unique(dco_ce_seeds[pessimistic_flag])
pessimistic_mask = np.logical_not(np.in1d(dco_seeds, pessimistic_seeds))
pessimistic_mask = np.logical_not(np.isin(dco_seeds, pessimistic_seeds))
else:
pessimistic_mask = np.repeat(True, len(dco_seeds))
else:
Expand Down Expand Up @@ -189,7 +189,7 @@ def setCOMPASData(self):
self.seedsDCO = dco_seeds[self.DCOmask]
if self.initialZ is None:
self.initialZ = initial_Z
maskMetallicity = np.in1d(initial_seeds, self.seedsDCO)
maskMetallicity = np.isin(initial_seeds, self.seedsDCO)
self.metallicitySystems = self.initialZ[maskMetallicity]
self.n_systems = len(initial_seeds)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def from_compas_h5(
"BSE_System_Parameters",
["Mass@ZAMS(1)", "Mass@ZAMS(2)"],
)
dco_mask = xp.in1d(all_seeds, seeds)
dco_mask = xp.isin(all_seeds, seeds)

if m1_min is None or m1_max is None or m2_min is None:
# Infer the sampled mass ranges from system-level ZAMS masses when not provided.
Expand Down Expand Up @@ -165,20 +165,20 @@ def _generate_mask(
# get the flags and unique seeds from the Common Envelopes file
ce_seeds, rlof_flag, optimistic_ce = _load_data(
path, "BSE_Common_Envelopes", ["SEED", "Immediate_RLOF>CE", "Optimistic_CE"])
dco_from_ce = xp.in1d(ce_seeds, dco_seeds)
dco_from_ce = xp.isin(ce_seeds, dco_seeds)
dco_ce_seeds = ce_seeds[dco_from_ce]
del ce_seeds

# mask out all DCOs that have RLOF after CE
rlof_flag = rlof_flag[dco_from_ce].astype(bool)
rlof_seeds = xp.unique(dco_ce_seeds[rlof_flag])
mask_out_with_rlof_seeds = xp.logical_not(xp.in1d(dco_seeds, rlof_seeds))
mask_out_with_rlof_seeds = xp.logical_not(xp.isin(dco_seeds, rlof_seeds))
del rlof_flag, rlof_seeds

# mask out all DCOs that have an "optimistic CE"
optimistic_ce_flag = optimistic_ce[dco_from_ce].astype(bool)
optimistic_ce_seeds = xp.unique(dco_ce_seeds[optimistic_ce_flag])
mask_out_optimistic_ce_seeds = xp.logical_not(xp.in1d(dco_seeds, optimistic_ce_seeds))
mask_out_optimistic_ce_seeds = xp.logical_not(xp.isin(dco_seeds, optimistic_ce_seeds))
del optimistic_ce_flag, optimistic_ce_seeds

lens = dict(
Expand Down
Loading