Skip to content

Commit 7bfe143

Browse files
authored
Merge pull request #589 from TeamCOMPAS/AddDCOtypes
PostProcessing: Adds 'CHE_BBH' and 'NON_CHE_BBH' to selectable DCO types for ClassCOMPAS
2 parents 390fa92 + 9b61902 commit 7bfe143

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

postProcessing/Folders/CosmicIntegration/PythonScripts/ClassCOMPAS.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ def __init__(
3838
self.BBHmask = None
3939
self.DNSmask = None
4040
self.BHNSmask = None
41+
self.CHE_mask = None
42+
self.CHE_BBHmask = None
43+
self.NonCHE_BBHmask = None
4144
self.initialZ = None
4245
self.sw_weights = None
4346
self.n_systems = None
@@ -69,9 +72,19 @@ def setCOMPASDCOmask(
6972
# By default, we mask for BBHs that merge within a Hubble time, assumming
7073
# the pessimistic CEE prescription (HG donors cannot survive a CEE) and
7174
# not allowing immediate RLOF post-CEE
75+
7276
stellar_type_1, stellar_type_2, hubble_flag, dco_seeds = \
7377
self.get_COMPAS_variables("BSE_Double_Compact_Objects", ["Stellar_Type(1)", "Stellar_Type(2)", "Merges_Hubble_Time", "SEED"])
7478

79+
if types == "CHE_BBH" or types == "NON_CHE_BBH":
80+
stellar_type_1_zams, stellar_type_2_zams, che_ms_1, che_ms_2, sys_seeds = \
81+
self.get_COMPAS_variables("BSE_System_Parameters", ["Stellar_Type@ZAMS(1)", "Stellar_Type@ZAMS(2)", "CH_on_MS(1)", "CH_on_MS(2)", "SEED"])
82+
83+
che_mask = np.logical_and.reduce((stellar_type_1_zams == 16, stellar_type_2_zams == 16, che_ms_1 == True, che_ms_2 == True))
84+
che_seeds = sys_seeds[()][che_mask]
85+
86+
self.CHE_mask = np.in1d(dco_seeds, che_seeds) if types == "CHE_BBH" or types == "NON_CHE_BBH" else np.repeat(False, len(dco_seeds))
87+
7588
# if user wants to mask on Hubble time use the flag, otherwise just set all to True
7689
hubble_mask = hubble_flag.astype(bool) if withinHubbleTime else np.repeat(True, len(dco_seeds))
7790

@@ -82,6 +95,8 @@ def setCOMPASDCOmask(
8295
"BHNS": np.logical_or(np.logical_and(stellar_type_1 == 14, stellar_type_2 == 13), np.logical_and(stellar_type_1 == 13, stellar_type_2 == 14)),
8396
"BNS": np.logical_and(stellar_type_1 == 13, stellar_type_2 == 13),
8497
}
98+
type_masks["CHE_BBH"] = np.logical_and(self.CHE_mask, type_masks["BBH"]) if types == "CHE_BBH" else np.repeat(False, len(dco_seeds))
99+
type_masks["NON_CHE_BBH"] = np.logical_and(np.logical_not(self.CHE_mask), type_masks["BBH"]) if types == "NON_CHE_BBH" else np.repeat(True, len(dco_seeds))
85100

86101
# if the user wants to make RLOF or optimistic CEs
87102
if noRLOFafterCEE or pessimistic:
@@ -115,6 +130,8 @@ def setCOMPASDCOmask(
115130
self.BBHmask = type_masks["BBH"] * hubble_mask * rlof_mask * pessimistic_mask
116131
self.BHNSmask = type_masks["BHNS"] * hubble_mask * rlof_mask * pessimistic_mask
117132
self.DNSmask = type_masks["BNS"] * hubble_mask * rlof_mask * pessimistic_mask
133+
self.CHE_BBHmask = type_masks["CHE_BBH"] * hubble_mask * rlof_mask * pessimistic_mask
134+
self.NonCHE_BBHmask = type_masks["NON_CHE_BBH"] * hubble_mask * rlof_mask * pessimistic_mask
118135
self.allTypesMask = type_masks["all"] * hubble_mask * rlof_mask * pessimistic_mask
119136
self.optimisticmask = pessimistic_mask
120137

0 commit comments

Comments
 (0)