|
1 | 1 | { |
2 | 2 | "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 | + }, |
3 | 13 | { |
4 | 14 | "cell_type": "markdown", |
5 | 15 | "metadata": {}, |
|
24 | 34 | }, |
25 | 35 | { |
26 | 36 | "cell_type": "code", |
27 | | - "execution_count": 3, |
| 37 | + "execution_count": 33, |
28 | 38 | "metadata": {}, |
29 | 39 | "outputs": [ |
30 | 40 | { |
|
55 | 65 | }, |
56 | 66 | { |
57 | 67 | "cell_type": "code", |
58 | | - "execution_count": 12, |
| 68 | + "execution_count": 34, |
59 | 69 | "metadata": {}, |
60 | 70 | "outputs": [], |
61 | 71 | "source": [ |
|
102 | 112 | }, |
103 | 113 | { |
104 | 114 | "cell_type": "code", |
105 | | - "execution_count": 6, |
| 115 | + "execution_count": 35, |
106 | 116 | "metadata": {}, |
107 | 117 | "outputs": [], |
108 | 118 | "source": [ |
|
168 | 178 | "cell_type": "markdown", |
169 | 179 | "metadata": {}, |
170 | 180 | "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", |
171 | 254 | "## The function starts by checking the values you have supplied" |
172 | 255 | ] |
173 | 256 | }, |
174 | 257 | { |
175 | 258 | "cell_type": "code", |
176 | | - "execution_count": 7, |
| 259 | + "execution_count": 38, |
177 | 260 | "metadata": {}, |
178 | 261 | "outputs": [], |
179 | 262 | "source": [ |
|
215 | 298 | }, |
216 | 299 | { |
217 | 300 | "cell_type": "code", |
218 | | - "execution_count": 9, |
| 301 | + "execution_count": 39, |
219 | 302 | "metadata": {}, |
220 | 303 | "outputs": [], |
221 | 304 | "source": [ |
|
577 | 660 | " * shell_volumes[:n_redshifts_detection] / (1 + redshifts[:n_redshifts_detection])\n" |
578 | 661 | ] |
579 | 662 | }, |
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 | | - }, |
644 | 663 | { |
645 | 664 | "cell_type": "markdown", |
646 | 665 | "metadata": {}, |
|
0 commit comments