Skip to content

Commit 3089ae7

Browse files
author
Lieke van Son
committed
implemented comments from Pull Request
1 parent c041da3 commit 3089ae7

File tree

7 files changed

+243
-165
lines changed

7 files changed

+243
-165
lines changed

postProcessing/Folders/CosmicIntegration/0_CosmicIntegrationOverview.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"### [Setting the Data:](./1_ClassCOMPAS.ipynb)\n",
4343
"Set the required columns and other information.\n",
4444
"\n",
45-
"### [Setting the MSSFR:](./2_MSSFR.ipynb)\n",
45+
"### [Setting the MSSFR:](./2_MSSFR-or-SFRD-prescriptions.ipynb)\n",
4646
"Choose a model and plot it.\n",
4747
"\n",
4848
"### [Setting the Selection Effects:](./3_SelectionEffects.ipynb)\n",
@@ -52,7 +52,11 @@
5252
"Combine data, MSSFR, and selection effects.\n",
5353
"\n",
5454
"### [Rate as function of redshift:](./5_MergersAsFunctionOfRedhisft.ipynb)\n",
55-
"Set the integral and combine results."
55+
"Set the integral and combine results.\n",
56+
"\n",
57+
"\n",
58+
"### [Fast Cosmic Integration:](./6_FastCosmicIntegrator.ipynb)\n",
59+
"Do the whole routine in one go, using the phenomenological variation of the MSSFR and SFRD"
5660
]
5761
},
5862
{

postProcessing/Folders/CosmicIntegration/2_MSSFR-or-SFRD-prescriptions.ipynb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 23,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"# Magic function to set the backend of matplotlib to the 'inline' backend\n",
10+
"%matplotlib inline"
11+
]
12+
},
313
{
414
"attachments": {
515
"SFRD_cartoon-1.png": {
@@ -52,7 +62,7 @@
5262
},
5363
{
5464
"cell_type": "code",
55-
"execution_count": 1,
65+
"execution_count": 24,
5666
"metadata": {},
5767
"outputs": [],
5868
"source": [
@@ -72,7 +82,7 @@
7282
},
7383
{
7484
"cell_type": "code",
75-
"execution_count": 2,
85+
"execution_count": 25,
7686
"metadata": {},
7787
"outputs": [],
7888
"source": [

postProcessing/Folders/CosmicIntegration/4_MergersAtSingleRedshift.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 19,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"# Magic function to set the backend of matplotlib to the 'inline' backend\n",
10+
"%matplotlib inline"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {},

postProcessing/Folders/CosmicIntegration/5_MergersAsFunctionOfRedhisft.ipynb

Lines changed: 39 additions & 41 deletions
Large diffs are not rendered by default.

postProcessing/Folders/CosmicIntegration/6_FastCosmicIntegrator.ipynb

Lines changed: 88 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 32,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"# Magic function to set the backend of matplotlib to the 'inline' backend\n",
10+
"%matplotlib inline"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"metadata": {},
@@ -24,7 +34,7 @@
2434
},
2535
{
2636
"cell_type": "code",
27-
"execution_count": 3,
37+
"execution_count": 33,
2838
"metadata": {},
2939
"outputs": [
3040
{
@@ -55,7 +65,7 @@
5565
},
5666
{
5767
"cell_type": "code",
58-
"execution_count": 12,
68+
"execution_count": 34,
5969
"metadata": {},
6070
"outputs": [],
6171
"source": [
@@ -102,7 +112,7 @@
102112
},
103113
{
104114
"cell_type": "code",
105-
"execution_count": 6,
115+
"execution_count": 35,
106116
"metadata": {},
107117
"outputs": [],
108118
"source": [
@@ -168,12 +178,85 @@
168178
"cell_type": "markdown",
169179
"metadata": {},
170180
"source": [
181+
"# This means you can do all the heavy lifting at once by running find_detection_rate()!\n"
182+
]
183+
},
184+
{
185+
"cell_type": "code",
186+
"execution_count": 36,
187+
"metadata": {},
188+
"outputs": [
189+
{
190+
"name": "stderr",
191+
"output_type": "stream",
192+
"text": [
193+
"/Users/lieke/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:10: UserWarning: Maximum chirp mass used for detectability calculation is below maximum binary chirp mass * (1+maximum redshift for detectability calculation)\n",
194+
" # Remove the CWD from sys.path while we load stuff.\n"
195+
]
196+
}
197+
],
198+
"source": [
199+
"detection_rate, formation_rate, merger_rate, redshifts, COMPAS = CI.find_detection_rate(pathData, filename=\"COMPAS_Output.h5\", dco_type=\"BBH\", weight_column=None,\n",
200+
" merges_hubble_time=True, pessimistic_CEE=True, no_RLOF_after_CEE=True,\n",
201+
" max_redshift=10.0, max_redshift_detection=1.0, redshift_step=0.001, z_first_SF = 10,\n",
202+
" m1_min=5 * u.Msun, m1_max=150 * u.Msun, m2_min=0.1 * u.Msun, fbin=0.7,\n",
203+
" aSF = 0.01, bSF = 2.77, cSF = 2.90, dSF = 4.70,\n",
204+
" mu0=0.035, muz=-0.23, sigma0=0.39,sigmaz=0., alpha=0.0, \n",
205+
" min_logZ=-12.0, max_logZ=0.0, step_logZ=0.01,\n",
206+
" sensitivity=\"O1\", snr_threshold=8, \n",
207+
" Mc_max=300.0, Mc_step=0.1, eta_max=0.25, eta_step=0.01,\n",
208+
" snr_max=1000.0, snr_step=0.1)\n",
209+
"\n"
210+
]
211+
},
212+
{
213+
"cell_type": "code",
214+
"execution_count": 37,
215+
"metadata": {},
216+
"outputs": [
217+
{
218+
"name": "stdout",
219+
"output_type": "stream",
220+
"text": [
221+
"[[5.28563339e-50 3.85383633e-49 1.08943946e-48 ... 0.00000000e+00\n",
222+
" 0.00000000e+00 0.00000000e+00]\n",
223+
" [8.70000173e-54 6.21978672e-53 1.72404790e-52 ... 0.00000000e+00\n",
224+
" 0.00000000e+00 0.00000000e+00]\n",
225+
" [1.76147119e-53 1.25912752e-52 3.48964813e-52 ... 0.00000000e+00\n",
226+
" 0.00000000e+00 0.00000000e+00]\n",
227+
" ...\n",
228+
" [1.41699892e-06 9.94766453e-06 2.70167194e-05 ... 0.00000000e+00\n",
229+
" 0.00000000e+00 0.00000000e+00]\n",
230+
" [1.57402650e-06 1.10488807e-05 2.99984986e-05 ... 0.00000000e+00\n",
231+
" 0.00000000e+00 0.00000000e+00]\n",
232+
" [4.67614310e-06 3.28503643e-05 8.90491132e-05 ... 0.00000000e+00\n",
233+
" 0.00000000e+00 0.00000000e+00]]\n"
234+
]
235+
}
236+
],
237+
"source": [
238+
"print(detection_rate)"
239+
]
240+
},
241+
{
242+
"cell_type": "code",
243+
"execution_count": null,
244+
"metadata": {},
245+
"outputs": [],
246+
"source": []
247+
},
248+
{
249+
"cell_type": "markdown",
250+
"metadata": {},
251+
"source": [
252+
"# We will now spend the rest of this notebook breaking this function down piece by piece, to actually understand what is going on :) \n",
253+
"\n",
171254
"## The function starts by checking the values you have supplied"
172255
]
173256
},
174257
{
175258
"cell_type": "code",
176-
"execution_count": 7,
259+
"execution_count": 38,
177260
"metadata": {},
178261
"outputs": [],
179262
"source": [
@@ -215,7 +298,7 @@
215298
},
216299
{
217300
"cell_type": "code",
218-
"execution_count": 9,
301+
"execution_count": 39,
219302
"metadata": {},
220303
"outputs": [],
221304
"source": [
@@ -577,70 +660,6 @@
577660
" * shell_volumes[:n_redshifts_detection] / (1 + redshifts[:n_redshifts_detection])\n"
578661
]
579662
},
580-
{
581-
"cell_type": "markdown",
582-
"metadata": {},
583-
"source": [
584-
"# You can do all of the above at once by running find_detection_rate()!\n"
585-
]
586-
},
587-
{
588-
"cell_type": "code",
589-
"execution_count": 27,
590-
"metadata": {},
591-
"outputs": [
592-
{
593-
"name": "stderr",
594-
"output_type": "stream",
595-
"text": [
596-
"/Users/lieke/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:10: UserWarning: Maximum chirp mass used for detectability calculation is below maximum binary chirp mass * (1+maximum redshift for detectability calculation)\n",
597-
" # Remove the CWD from sys.path while we load stuff.\n"
598-
]
599-
}
600-
],
601-
"source": [
602-
"detection_rate, formation_rate, merger_rate, redshifts, COMPAS = CI.find_detection_rate(pathData, filename=\"COMPAS_Output.h5\", dco_type=\"BBH\", weight_column=None,\n",
603-
" merges_hubble_time=True, pessimistic_CEE=True, no_RLOF_after_CEE=True,\n",
604-
" max_redshift=10.0, max_redshift_detection=1.0, redshift_step=0.001, z_first_SF = 10,\n",
605-
" m1_min=5 * u.Msun, m1_max=150 * u.Msun, m2_min=0.1 * u.Msun, fbin=0.7,\n",
606-
" aSF = 0.01, bSF = 2.77, cSF = 2.90, dSF = 4.70,\n",
607-
" mu0=0.035, muz=-0.23, sigma0=0.39,sigmaz=0., alpha=0.0, \n",
608-
" min_logZ=-12.0, max_logZ=0.0, step_logZ=0.01,\n",
609-
" sensitivity=\"O1\", snr_threshold=8, \n",
610-
" Mc_max=300.0, Mc_step=0.1, eta_max=0.25, eta_step=0.01,\n",
611-
" snr_max=1000.0, snr_step=0.1)\n",
612-
"\n"
613-
]
614-
},
615-
{
616-
"cell_type": "code",
617-
"execution_count": 28,
618-
"metadata": {},
619-
"outputs": [
620-
{
621-
"name": "stdout",
622-
"output_type": "stream",
623-
"text": [
624-
"[[5.26801580e-50 3.84099108e-49 1.08580824e-48 ... 0.00000000e+00\n",
625-
" 0.00000000e+00 0.00000000e+00]\n",
626-
" [8.67100368e-54 6.19905550e-53 1.71830146e-52 ... 0.00000000e+00\n",
627-
" 0.00000000e+00 0.00000000e+00]\n",
628-
" [1.75560002e-53 1.25493072e-52 3.47801675e-52 ... 0.00000000e+00\n",
629-
" 0.00000000e+00 0.00000000e+00]\n",
630-
" ...\n",
631-
" [1.41227591e-06 9.91450788e-06 2.69266698e-05 ... 0.00000000e+00\n",
632-
" 0.00000000e+00 0.00000000e+00]\n",
633-
" [1.56878010e-06 1.10120536e-05 2.98985103e-05 ... 0.00000000e+00\n",
634-
" 0.00000000e+00 0.00000000e+00]\n",
635-
" [4.66055701e-06 3.27408705e-05 8.87523029e-05 ... 0.00000000e+00\n",
636-
" 0.00000000e+00 0.00000000e+00]]\n"
637-
]
638-
}
639-
],
640-
"source": [
641-
"print(detection_rate)"
642-
]
643-
},
644663
{
645664
"cell_type": "markdown",
646665
"metadata": {},

postProcessing/Folders/CosmicIntegration/PythonScripts/ClassCOMPAS.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class COMPASData(object):
99
def __init__(
1010
self,
1111
path=None,
12-
fileName="COMPAS_output.h5",
12+
fileName="COMPAS_Output.h5",
1313
lazyData=True,
1414
Mlower=None,
1515
Mupper=None,

0 commit comments

Comments
 (0)