Skip to content

Commit df332b6

Browse files
Deploy to GitHub pages
0 parents  commit df332b6

File tree

151 files changed

+28014
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+28014
-0
lines changed

.buildinfo

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 156449e1ebed5c541bc45ca579080211
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

.nojekyll

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Draw samples from the distribution:
2+
#
3+
mu, sigma = 0, 0.1 # mean and standard deviation
4+
s = np.random.normal(mu, sigma, 1000)
5+
#
6+
# Verify the mean and the variance:
7+
#
8+
abs(mu - np.mean(s))
9+
# Expected:
10+
## 0.0 # may vary
11+
#
12+
abs(sigma - np.std(s, ddof=1))
13+
# Expected:
14+
## 0.1 # may vary
15+
#
16+
# Display the histogram of the samples, along with
17+
# the probability density function:
18+
#
19+
import matplotlib.pyplot as plt
20+
count, bins, ignored = plt.hist(s, 30, density=True)
21+
plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
22+
np.exp( - (bins - mu)**2 / (2 * sigma**2) ),
23+
linewidth=2, color='r')
24+
plt.show()
25+
#
26+
# Two-by-four array of samples from the normal distribution with
27+
# mean 3 and standard deviation 2.5:
28+
#
29+
np.random.normal(3, 2.5, size=(2, 4))
30+
# Expected:
31+
## array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random
32+
## [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) # random
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import numpy as np
2+
import matplotlib.pyplot as plt
3+
from scipy import interpolate
4+
x = np.arange(0, 10)
5+
y = np.exp(-x/3.0)
6+
f = interpolate.interp1d(x, y)
7+
#
8+
xnew = np.arange(0, 9, 0.1)
9+
ynew = f(xnew) # use interpolation function returned by `interp1d`
10+
plt.plot(x, y, 'o', xnew, ynew, '-')
11+
plt.show()
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from cosmic.sample.initialbinarytable import InitialBinaryTable
2+
from cosmic.plotting import evolve_and_plot
3+
single_binary = InitialBinaryTable.InitialBinaries(m1=85.543645, m2=84.99784, porb=446.795757, ecc=0.448872, tphysf=13700.0, kstar1=1, kstar2=1, metallicity=0.002)
4+
BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0, 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'grflag' : 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.25, 'ecsn_mlow' : 1.6, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 1, 'bdecayfac' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.014, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0, 'wd_mass_lim': 1}
5+
fig = evolve_and_plot(single_binary, t_min=None, t_max=None, BSEDict=BSEDict, sys_obs={})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Draw samples from the distribution:
2+
#
3+
s = np.random.uniform(-1,0,1000)
4+
#
5+
# All values are within the given interval:
6+
#
7+
np.all(s >= -1)
8+
# Expected:
9+
## True
10+
np.all(s < 0)
11+
# Expected:
12+
## True
13+
#
14+
# Display the histogram of the samples, along with the
15+
# probability density function:
16+
#
17+
import matplotlib.pyplot as plt
18+
count, bins, ignored = plt.hist(s, 15, density=True)
19+
plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
20+
plt.show()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Draw samples from the distribution:
2+
#
3+
mu, sigma = 0, 0.1 # mean and standard deviation
4+
s = np.random.normal(mu, sigma, 1000)
5+
#
6+
# Verify the mean and the variance:
7+
#
8+
abs(mu - np.mean(s))
9+
# Expected:
10+
## 0.0 # may vary
11+
#
12+
abs(sigma - np.std(s, ddof=1))
13+
# Expected:
14+
## 0.1 # may vary
15+
#
16+
# Display the histogram of the samples, along with
17+
# the probability density function:
18+
#
19+
import matplotlib.pyplot as plt
20+
count, bins, ignored = plt.hist(s, 30, density=True)
21+
plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
22+
np.exp( - (bins - mu)**2 / (2 * sigma**2) ),
23+
linewidth=2, color='r')
24+
plt.show()
25+
#
26+
# Two-by-four array of samples from the normal distribution with
27+
# mean 3 and standard deviation 2.5:
28+
#
29+
np.random.normal(3, 2.5, size=(2, 4))
30+
# Expected:
31+
## array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random
32+
## [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) # random
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from cosmic.utils import a_from_p
2+
from cosmic.sample.initialbinarytable import InitialBinaryTable
3+
import pandas as pd
4+
import numpy as np
5+
import matplotlib.pyplot as plt
6+
final_kstar = np.linspace(0,14,15)
7+
colors = {'green' : '#1b9e77', 'purple' : '#d95f02', 'orange' : '#7570b3'}
8+
final_kstar = np.linspace(0,14,15)
9+
initC_mult, m_sin_mult, m_bin_mult, n_sin_mult, n_bin_mult = InitialBinaryTable.sampler('multidim',
10+
final_kstar1=final_kstar,
11+
final_kstar2=final_kstar,
12+
rand_seed=2,
13+
nproc=1,
14+
SF_start=13700.0,
15+
SF_duration=0.0,
16+
met=0.02,
17+
size=100000)
18+
initC_mult['sep'] = a_from_p(p=initC_mult.porb, m1=initC_mult.mass_1, m2=initC_mult.mass_2)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from cosmic.sample.initialbinarytable import InitialBinaryTable
2+
from cosmic.plotting import evolve_and_plot
3+
import numpy as np
4+
np.random.seed(5)
5+
BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0, 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'grflag' : 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.25, 'ecsn_mlow' : 1.6, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 1, 'bdecayfac' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.014, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0, 'wd_mass_lim': 1}
6+
binary_set = InitialBinaryTable.InitialBinaries(m1=[85.543645, 11.171469], m2=[84.99784, 9.67305], porb=[446.795757, 370.758343], ecc=[0.448872, 0.370], tphysf=[13700.0, 13700.0], kstar1=[1, 1], kstar2=[1, 1], metallicity=[0.002, 0.02])
7+
fig = evolve_and_plot(binary_set, t_min=None, t_max=[6.0, 60.0], BSEDict=BSEDict, sys_obs={})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Draw samples from the distribution:
2+
#
3+
s = np.random.uniform(-1,0,1000)
4+
#
5+
# All values are within the given interval:
6+
#
7+
np.all(s >= -1)
8+
# Expected:
9+
## True
10+
np.all(s < 0)
11+
# Expected:
12+
## True
13+
#
14+
# Display the histogram of the samples, along with the
15+
# probability density function:
16+
#
17+
import matplotlib.pyplot as plt
18+
count, bins, ignored = plt.hist(s, 15, density=True)
19+
plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
20+
plt.show()
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
from cosmic.utils import a_from_p
2+
from cosmic.sample.initialbinarytable import InitialBinaryTable
3+
import pandas as pd
4+
import numpy as np
5+
import matplotlib.pyplot as plt
6+
final_kstar = np.linspace(0,14,15)
7+
colors = {'green' : '#1b9e77', 'orange' : '#d95f02', 'purple' : '#7570b3'}
8+
initC_logP, m_sin_logP, m_bin_logP, n_sin_logP, n_bin_logP = InitialBinaryTable.sampler('independent',
9+
final_kstar1=final_kstar,
10+
final_kstar2=final_kstar,
11+
binfrac_model=1.0,
12+
primary_model='kroupa01',
13+
ecc_model='thermal',
14+
porb_model='log_uniform',
15+
qmin=-1,
16+
SF_start=13700.0,
17+
SF_duration=0.0,
18+
met=0.02,
19+
size=100000)
20+
initC_Sana, m_sin_Sana, m_bin_Sana, n_sin_Sana, n_bin_Sana = InitialBinaryTable.sampler('independent',
21+
final_kstar1=final_kstar,
22+
final_kstar2=final_kstar,
23+
binfrac_model=1.0,
24+
primary_model='kroupa01',
25+
ecc_model='sana12',
26+
porb_model='sana12',
27+
qmin=-1,
28+
SF_start=13700.0,
29+
SF_duration=0.0,
30+
met=0.02,
31+
size=100000)
32+
initC_Moe, m_sin_Moe, m_bin_Moe, n_sin_Moe, n_bin_Moe = InitialBinaryTable.sampler('independent',
33+
final_kstar1=final_kstar,
34+
final_kstar2=final_kstar,
35+
binfrac_model=1.0,
36+
primary_model='kroupa01',
37+
ecc_model='sana12',
38+
porb_model='moe19',
39+
qmin=-1,
40+
SF_start=13700.0,
41+
SF_duration=0.0,
42+
met=0.02,
43+
size=100000)
44+
initC_logP['sep'] = a_from_p(p=initC_logP.porb, m1=initC_logP.mass_1, m2=initC_logP.mass_2)
45+
initC_Sana['sep'] = a_from_p(p=initC_Sana.porb, m1=initC_Sana.mass_1, m2=initC_Sana.mass_2)
46+
initC_Moe['sep'] = a_from_p(p=initC_Moe.porb, m1=initC_Moe.mass_1, m2=initC_Moe.mass_2)
47+
fig = plt.figure(figsize = (15,6))
48+
ax1 = plt.subplot(231)
49+
ax2 = plt.subplot(232)
50+
ax3 = plt.subplot(233)
51+
ax4 = plt.subplot(234)
52+
ax5 = plt.subplot(235)
53+
ax6 = plt.subplot(236)
54+
ax1.hist(np.log10(initC_logP.mass_1), bins = 20, histtype='step', density=True,
55+
lw=3, color=colors['purple'], label='independent')
56+
ax1.hist(np.log10(initC_Sana.mass_1), bins = 20, histtype='step', density=True,
57+
lw=3, color=colors['orange'], label='Sana+2012')
58+
ax1.hist(np.log10(initC_Moe.mass_1), bins = 20, histtype='step', density=True,
59+
lw=3, color=colors['green'], label='Moe+2019')
60+
ax1.set_xlabel(r'Log$_{10}$(M$_1$/M$_{\odot}$)', size=18)
61+
ax1.set_ylabel('normalized counts', size=18)
62+
ax1.legend(prop={'size' : 18})
63+
ax2.hist(np.log10(initC_logP.porb), bins = 20, histtype='step', density=True,
64+
lw=3, color=colors['purple'], label='independent')
65+
ax2.hist(np.log10(initC_Sana.porb), bins = 20, histtype='step', density=True,
66+
lw=3, color=colors['orange'], label='Sana+2012')
67+
ax2.hist(np.log10(initC_Moe.porb), bins = 20, histtype='step', density=True,
68+
lw=3, color=colors['green'], label='Moe+2019')
69+
ax2.set_xlabel(r'Log$_{10}$(P$_{\rm{orb}}$/day)', size=18)
70+
ax3.hist(initC_logP.ecc, bins = 10, histtype='step', density=True,
71+
lw=3, color=colors['purple'], label='independent')
72+
ax3.hist(initC_Sana.ecc, bins = 10, histtype='step', density=True,
73+
lw=3, color=colors['orange'], label='Sana+2012')
74+
ax3.hist(initC_Moe.ecc, bins = 10, histtype='step', density=True,
75+
lw=3, color=colors['green'], label='Moe+2019')
76+
ax3.set_xlabel('Eccentricity', size=18)
77+
ax4.hist(initC_logP.mass_2/initC_logP.mass_1, bins = 20, histtype='step', density=True,
78+
lw=3, color=colors['purple'], label='independent')
79+
ax4.hist(initC_Sana.mass_2/initC_Sana.mass_1, bins = 20, histtype='step', density=True,
80+
lw=3, color=colors['orange'], label='Sana+2012')
81+
ax4.hist(initC_Moe.mass_2/initC_Moe.mass_1, bins = 20, histtype='step', density=True,
82+
lw=3, color=colors['green'], label='Moe+2019')
83+
ax4.set_xlabel(r'q=M$_1$/M$_2$', size=18)
84+
ax4.set_ylabel('normalized counts', size=18)
85+
ax5.hist(np.log10(initC_logP.sep), bins = 20, histtype='step', density=True,
86+
lw=3, color=colors['purple'], label='independent')
87+
ax5.hist(np.log10(initC_Sana.sep), bins = 20, histtype='step', density=True,
88+
lw=3, color=colors['orange'], label='Sana+2012')
89+
ax5.hist(np.log10(initC_Moe.sep), bins = 20, histtype='step', density=True,
90+
lw=3, color=colors['green'], label='Moe+2019')
91+
ax5.set_xlabel(r'Log$_{10}$(a/R$_{\odot}$)', size=18)
92+
ax6.hist(np.log10(initC_logP.sep*(1-initC_logP.ecc)), bins = 20, histtype='step', density=True,
93+
lw=3, color=colors['purple'], label='independent')
94+
ax6.hist(np.log10(initC_Sana.sep*(1-initC_Sana.ecc)), bins = 20, histtype='step', density=True,
95+
lw=3, color=colors['orange'], label='Sana+2012')
96+
ax6.hist(np.log10(initC_Moe.sep*(1-initC_Moe.ecc)), bins = 20, histtype='step', density=True,
97+
lw=3, color=colors['green'], label='Moe+2019')
98+
ax6.set_xlabel(r'Log$_{10}$(a(1-e)/R$_{\odot}$)', size=18)
99+
fig.tight_layout()
100+
fig.show()
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from cosmic.sample.initialbinarytable import InitialBinaryTable
2+
from cosmic.plotting import evolve_and_plot
3+
single_binary = InitialBinaryTable.InitialBinaries(m1=85.543645, m2=84.99784, porb=446.795757, ecc=0.448872, tphysf=13700.0, kstar1=1, kstar2=1, metallicity=0.002)
4+
BSEDict = {'xi': 1.0, 'bhflag': 1, 'neta': 0.5, 'windflag': 3, 'wdflag': 1, 'alpha1': 1.0, 'pts1': 0.001, 'pts3': 0.02, 'pts2': 0.01, 'epsnov': 0.001, 'hewind': 0.5, 'ck': 1000, 'bwind': 0.0, 'lambdaf': 0.0, 'mxns': 3.0, 'beta': -1.0, 'tflag': 1, 'acc2': 1.5, 'grflag' : 1, 'remnantflag': 4, 'ceflag': 0, 'eddfac': 1.0, 'ifflag': 0, 'bconst': 3000, 'sigma': 265.0, 'gamma': -2.0, 'pisn': 45.0, 'natal_kick_array' : [[-100.0,-100.0,-100.0,-100.0,0.0], [-100.0,-100.0,-100.0,-100.0,0.0]], 'bhsigmafrac' : 1.0, 'polar_kick_angle' : 90, 'qcrit_array' : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], 'cekickflag' : 2, 'cehestarflag' : 0, 'cemergeflag' : 0, 'ecsn' : 2.25, 'ecsn_mlow' : 1.6, 'aic' : 1, 'ussn' : 0, 'sigmadiv' :-20.0, 'qcflag' : 1, 'eddlimflag' : 0, 'fprimc_array' : [2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0,2.0/21.0], 'bhspinflag' : 0, 'bhspinmag' : 0.0, 'rejuv_fac' : 1.0, 'rejuvflag' : 0, 'htpmb' : 1, 'ST_cr' : 1, 'ST_tide' : 1, 'bdecayfac' : 1, 'rembar_massloss' : 0.5, 'kickflag' : 0, 'zsun' : 0.014, 'bhms_coll_flag' : 0, 'don_lim' : -1, 'acc_lim' : -1, 'rtmsflag' : 0, 'wd_mass_lim': 1}
5+
fig = evolve_and_plot(single_binary, t_min=None, t_max=6.0, BSEDict=BSEDict, sys_obs={})
Binary file not shown.
Binary file not shown.
15.4 KB

_images/cosmic-sample-cmc-elson-2.png

6.22 KB

_images/cosmic-sample-cmc-king-1.png

11.1 KB
16.1 KB

_images/cosmic-sample-cmc-king-3.png

6.22 KB

_images/index-1.png

41.1 KB

_images/index-11.png

57.1 KB

_images/index-2.png

59.4 KB

_images/index-3_00.png

59.4 KB

_images/index-3_01.png

56 KB

_sources/api/cosmic.Match.rst.txt

+4

_sources/api/cosmic.bse_utils.rst.txt

+19
+4

_sources/api/cosmic.evolve.rst.txt

+4

_sources/api/cosmic.filter.rst.txt

+4

_sources/api/cosmic.plotting.rst.txt

+4

_sources/api/cosmic.rst.txt

+32
+19

0 commit comments

Comments
 (0)