Skip to content

Commit 0a4c836

Browse files
authored
Merge pull request #588 from jeffriley/dev
PostProcessing: Adds 'CHE_BBH' and 'NON_CHE_BBH' to selectable DCO types for ClassCOMPAS
2 parents 390fa92 + 87d32b3 commit 0a4c836

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

postProcessing/Folders/CosmicIntegration/PythonScripts/ClassCOMPAS.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def __init__(
3838
self.BBHmask = None
3939
self.DNSmask = None
4040
self.BHNSmask = None
41+
self.CHE_BBHmask = None
42+
self.NonCHE_BBHmask = None
4143
self.initialZ = None
4244
self.sw_weights = None
4345
self.n_systems = None
@@ -69,9 +71,26 @@ def setCOMPASDCOmask(
6971
# By default, we mask for BBHs that merge within a Hubble time, assumming
7072
# the pessimistic CEE prescription (HG donors cannot survive a CEE) and
7173
# not allowing immediate RLOF post-CEE
74+
7275
stellar_type_1, stellar_type_2, hubble_flag, dco_seeds = \
7376
self.get_COMPAS_variables("BSE_Double_Compact_Objects", ["Stellar_Type(1)", "Stellar_Type(2)", "Merges_Hubble_Time", "SEED"])
7477

78+
if types == "CHE_BBH":
79+
stellar_type_1_zams, stellar_type_2_zams, che_ms_1, che_ms_2, sys_seeds = \
80+
self.get_COMPAS_variables("BSE_System_Parameters", ["Stellar_Type@ZAMS(1)", "Stellar_Type@ZAMS(2)", "CH_on_MS(1)", "CH_on_MS(2)", "SEED"])
81+
82+
che_1_mask = np.logical_and(np.logical_and(stellar_type_1_zams, 16), (che_ms_1 == True))
83+
che_2_mask = np.logical_and(np.logical_and(stellar_type_2_zams, 16), (che_ms_2 == True))
84+
che_seeds = sys_seeds[()][che_1_mask & che_2_mask]
85+
86+
if types == "NON_CHE_BBH":
87+
stellar_type_1_zams, stellar_type_2_zams, che_ms_1, che_ms_2, sys_seeds = \
88+
self.get_COMPAS_variables("BSE_System_Parameters", ["Stellar_Type@ZAMS(1)", "Stellar_Type@ZAMS(2)", "CH_on_MS(1)", "CH_on_MS(2)", "SEED"])
89+
90+
non_che_1_mask = np.logical_or(np.logical_not(np.logical_and(stellar_type_1_zams, 16)), np.logical_and(np.logical_and(stellar_type_1_zams, 16), (che_ms_1 == False)))
91+
non_che_2_mask = np.logical_or(np.logical_not(np.logical_and(stellar_type_1_zams, 16)), np.logical_and(np.logical_and(stellar_type_2_zams, 16), (che_ms_2 == False)))
92+
non_che_seeds = sys_seeds[()][non_che_1_mask & non_che_2_mask]
93+
7594
# if user wants to mask on Hubble time use the flag, otherwise just set all to True
7695
hubble_mask = hubble_flag.astype(bool) if withinHubbleTime else np.repeat(True, len(dco_seeds))
7796

@@ -81,6 +100,8 @@ def setCOMPASDCOmask(
81100
"BBH": np.logical_and(stellar_type_1 == 14, stellar_type_2 == 14),
82101
"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)),
83102
"BNS": np.logical_and(stellar_type_1 == 13, stellar_type_2 == 13),
103+
"CHE_BBH": np.logical_and(np.in1d(dco_seeds, che_seeds), np.logical_and(stellar_type_1 == 14, stellar_type_2 == 14)) if types == "CHE_BBH" else np.repeat(False, len(dco_seeds)),
104+
"NON_CHE_BBH": np.logical_and(np.in1d(dco_seeds, non_che_seeds), np.logical_and(stellar_type_1 == 14, stellar_type_2 == 14)) if types == "NON_CHE_BBH" else np.repeat(True, len(dco_seeds))
84105
}
85106

86107
# if the user wants to make RLOF or optimistic CEs
@@ -115,6 +136,8 @@ def setCOMPASDCOmask(
115136
self.BBHmask = type_masks["BBH"] * hubble_mask * rlof_mask * pessimistic_mask
116137
self.BHNSmask = type_masks["BHNS"] * hubble_mask * rlof_mask * pessimistic_mask
117138
self.DNSmask = type_masks["BNS"] * hubble_mask * rlof_mask * pessimistic_mask
139+
self.CHE_BBHmask = type_masks["CHE_BBH"] * hubble_mask * rlof_mask * pessimistic_mask
140+
self.NonCHE_BBHmask = type_masks["NON_CHE_BBH"] * hubble_mask * rlof_mask * pessimistic_mask
118141
self.allTypesMask = type_masks["all"] * hubble_mask * rlof_mask * pessimistic_mask
119142
self.optimisticmask = pessimistic_mask
120143

0 commit comments

Comments
 (0)