Skip to content

Commit 9b61902

Browse files
authored
Merge pull request #590 from jeffriley/dev
Post-review updates to PR#589
2 parents 0a4c836 + fde12ed commit 9b61902

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

postProcessing/Folders/CosmicIntegration/PythonScripts/ClassCOMPAS.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def __init__(
3838
self.BBHmask = None
3939
self.DNSmask = None
4040
self.BHNSmask = None
41+
self.CHE_mask = None
4142
self.CHE_BBHmask = None
4243
self.NonCHE_BBHmask = None
4344
self.initialZ = None
@@ -75,21 +76,14 @@ def setCOMPASDCOmask(
7576
stellar_type_1, stellar_type_2, hubble_flag, dco_seeds = \
7677
self.get_COMPAS_variables("BSE_Double_Compact_Objects", ["Stellar_Type(1)", "Stellar_Type(2)", "Merges_Hubble_Time", "SEED"])
7778

78-
if types == "CHE_BBH":
79+
if types == "CHE_BBH" or types == "NON_CHE_BBH":
7980
stellar_type_1_zams, stellar_type_2_zams, che_ms_1, che_ms_2, sys_seeds = \
8081
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]
8185

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]
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))
9387

9488
# if user wants to mask on Hubble time use the flag, otherwise just set all to True
9589
hubble_mask = hubble_flag.astype(bool) if withinHubbleTime else np.repeat(True, len(dco_seeds))
@@ -100,9 +94,9 @@ def setCOMPASDCOmask(
10094
"BBH": np.logical_and(stellar_type_1 == 14, stellar_type_2 == 14),
10195
"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)),
10296
"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))
10597
}
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))
106100

107101
# if the user wants to make RLOF or optimistic CEs
108102
if noRLOFafterCEE or pessimistic:

0 commit comments

Comments
 (0)