From aad1c70e6b443402397cdc5b350836e3c1908746 Mon Sep 17 00:00:00 2001 From: Alexey Bobrick Date: Mon, 9 Feb 2026 11:28:48 +1100 Subject: [PATCH 1/2] Modified the Max Moe sampler (sampleMoeDiStefano.py) and tested that the masses of singles and binary components follow Kroupa, and that the result is identical to the COSMIC code implementation (after the same correction is applied) --- compas_python_utils/preprocessing/sampleMoeDiStefano.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compas_python_utils/preprocessing/sampleMoeDiStefano.py b/compas_python_utils/preprocessing/sampleMoeDiStefano.py index b9f77f982..3a11fee3f 100644 --- a/compas_python_utils/preprocessing/sampleMoeDiStefano.py +++ b/compas_python_utils/preprocessing/sampleMoeDiStefano.py @@ -393,13 +393,15 @@ def createParameterDistributionsAndSampler(testing=False): # Slope = -2.3 for M1 > 1 Msun fM1 = np.power(M1, -2.3) - # Slope = -1.6 for M1 = 0.5 - 1.0 Msun + # Slope = -1.6 for M1 = 0.5 - 1.0 Msun -> Slope = -2.3 ind = np.where(M1 <= 1.) - fM1[ind] = np.power(M1[ind], -1.6) + #fM1[ind] = np.power(M1[ind], -1.6) #The original line + fM1[ind] = np.power(M1[ind], -2.3) #The corrected line # Slope = -0.8 for M1 = 0.15 - 0.5 Msun ind = np.where(M1 <= 0.5) - fM1[ind] = np.power(M1[ind], -0.8) / np.power(0.5, 1.6-0.8) + #fM1[ind] = np.power(M1[ind], -0.8) / np.power(0.5, 1.6-0.8) #The original line + fM1[ind] = np.power(M1[ind], -1.3) / np.power(0.5, 2.3-1.3) #The corrected line # Cumulative primary mass distribution function cumfM1 = np.cumsum(fM1)-fM1[0] From 83b5efcd4ac77e4cdca29d7d31defdaf2a0f6b9a Mon Sep 17 00:00:00 2001 From: Alexey Bobrick Date: Tue, 10 Feb 2026 14:01:30 +1100 Subject: [PATCH 2/2] Cleaned up comments --- .../preprocessing/sampleMoeDiStefano.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compas_python_utils/preprocessing/sampleMoeDiStefano.py b/compas_python_utils/preprocessing/sampleMoeDiStefano.py index 3a11fee3f..caa751884 100644 --- a/compas_python_utils/preprocessing/sampleMoeDiStefano.py +++ b/compas_python_utils/preprocessing/sampleMoeDiStefano.py @@ -393,15 +393,13 @@ def createParameterDistributionsAndSampler(testing=False): # Slope = -2.3 for M1 > 1 Msun fM1 = np.power(M1, -2.3) - # Slope = -1.6 for M1 = 0.5 - 1.0 Msun -> Slope = -2.3 + # Slope = -2.3 for M1 = 0.5 - 1.0 Msun (corrected value; in Mads code slope value was -1.6) ind = np.where(M1 <= 1.) - #fM1[ind] = np.power(M1[ind], -1.6) #The original line - fM1[ind] = np.power(M1[ind], -2.3) #The corrected line + fM1[ind] = np.power(M1[ind], -2.3) - # Slope = -0.8 for M1 = 0.15 - 0.5 Msun + # Slope = -1.3 for M1 = 0.15 - 0.5 Msun (corrected value; in Mads code slope value was -0.8) ind = np.where(M1 <= 0.5) - #fM1[ind] = np.power(M1[ind], -0.8) / np.power(0.5, 1.6-0.8) #The original line - fM1[ind] = np.power(M1[ind], -1.3) / np.power(0.5, 2.3-1.3) #The corrected line + fM1[ind] = np.power(M1[ind], -1.3) / np.power(0.5, 2.3-1.3) # Cumulative primary mass distribution function cumfM1 = np.cumsum(fM1)-fM1[0]