Skip to content

Commit cc5f1b3

Browse files
committed
Update CHIMERA documentation and version and remove unnecessary files
1 parent 9a26b75 commit cc5f1b3

17 files changed

Lines changed: 878373 additions & 388 deletions

CHIMERA/Likelihood.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -451,36 +451,17 @@ def compute(self, lambda_cosmo, lambda_mass, lambda_rate, inspect=False):
451451
like_events = np.empty(self.nevents)
452452

453453
# Compute overall rate normalization given lambda_rate (returns 1. if self.z_det_range is None)
454-
p_z_norm = self.get_p_z_norm(lambda_cosmo, lambda_rate)
455-
fR = self.completeness.get_fR(lambda_cosmo, z_det_range=[0,0.12])
454+
p_z_norm = self._get_p_z_norm(lambda_cosmo, lambda_rate)
456455

457-
# fR_ev = self.get_fR(lambda_cosmo)
456+
fR_ev = self.get_fR(lambda_cosmo)
458457

459458
# Compute like for each event
460459
for e in range(self.nevents):
461460
z_grid = self.z_grids[e]
462461
p_cat = self.p_cat_all[e]
463462

464-
idxs_mask = self.completeness.get_pix2mask(self.pix_conf[e], self.nside[e])
465-
fR_ev = fR[idxs_mask]
466-
compl = self.completeness.P_compl(z_grid, self.pix_conf[e], self.nside[e])
467-
468-
# compl = self.P_compl(z_grid)
469-
470-
p_gal = fR_ev * p_cat + ( (1.-compl)*np.array(self.model_cosmo.dV_dz(z_grid, lambda_cosmo)[:, np.newaxis] ))
471-
472-
# p_gal = fR_ev * p_cat + ( (1.-compl)*np.array(self.model_cosmo.dV_dz(z_grid, lambda_cosmo)))[:, np.newaxis]
473-
474-
if 0:
475-
# print(fR_ev * p_cat )
476-
for pix in range(self.npix_event[e]):
477-
zz = np.linspace(0, 10, 1000)
478-
compl = self.P_compl(z_grid, self.pix_conf[e][pix], self.nside[e])
479-
# print(compl)
480-
fR = np.trapz(self.P_compl(zz, self.pix_conf[e][pix], self.nside[e])*np.array(self.model_cosmo.dV_dz(zz, lambda_cosmo)), zz)
481-
p_gal[:,pix] = fR * p_cat[:,pix] + (1.-compl)*np.array(self.model_cosmo.dV_dz(z_grid, lambda_cosmo))
482-
483-
463+
compl = self.P_compl(z_grid)
464+
p_gal = fR_ev * p_cat + ( (1.-compl)*np.array(self.model_cosmo.dV_dz(z_grid, lambda_cosmo)))[:, np.newaxis]
484465
p_rate = self.gw.model_rate(z_grid, lambda_rate)/(1.+z_grid)
485466
p_z = (p_rate/p_z_norm)[:,np.newaxis] * p_gal
486467
p_gw = self.gw.compute_event(e, z_grid, lambda_cosmo, lambda_mass)

CHIMERA/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.dev58+ge14c507.d20231208"
1+
__version__ = "1.0.0"

CHIMERA/astro/spin.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -64,49 +64,3 @@ def logpdf_G(chi_eff, chi_p, lambda_s):
6464

6565

6666
return logpdf_eff + logpdf_p
67-
68-
69-
70-
71-
72-
73-
74-
75-
76-
77-
78-
79-
80-
81-
class UniformSpinDistChiz(BBHDistFunction):
82-
83-
'''
84-
Uniform distribution in chi1z, chi2z, uncorrelated
85-
'''
86-
87-
def __init__(self, ):
88-
BBHDistFunction.__init__(self)
89-
self.params = ['chiMin', 'chiMax', ] #'rho' ] # For the moment we ignore correlation
90-
91-
self.baseValues = {
92-
93-
'chiMin': -0.75,
94-
'chiMax':0.75,
95-
}
96-
97-
self.names = {
98-
'chiMin':r'$\chi_{ z, Min}$',
99-
'chiMax':r'$\chi_{ z, Max}$', }
100-
101-
self.n_params = len(self.params)
102-
103-
self.maxChi = 1
104-
self.minChi = -1
105-
self.nVars = 2
106-
107-
108-
109-
print('Uniform spin distribution in (chi1z, chi2z) base values: %s' %self.baseValues)
110-
111-
112-

CHIMERA/utils/misc.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def load_data_h5(fname):
136136
from scipy.optimize import fmin
137137

138138

139-
def get_confidence_HDI(post, grid, kde=None, interval=0.683, ax=None, color="k", lab=None, median=False, ls='--'):
139+
def get_confidence_HDI(post, grid, kde=None, interval=0.683, ax=None, color="k", lab="auto", median=False, ls='--'):
140140

141141
if kde is not None:
142142
N_samples = 10**6
@@ -177,10 +177,12 @@ def width(low):
177177
xmax = med
178178
xlow = lo
179179
xup = hi
180-
181-
180+
181+
182182
if ax is not None:
183-
# lab = "$H_0={:.0f}^{{+{:.0f}}}_{{-{:.0f}}}$".format(xmax, xup-xmax, xmax-xlow)
183+
if lab == "auto":
184+
lab = r"$H_0={:.0f}^{{+{:.0f}}}_{{-{:.0f}}}$".format(xmax, xup-xmax, xmax-xlow)
185+
184186
ax.fill_between(xx, 0, yy, where=(xx >= xlow) & (xx <= xup), color=color, alpha=0.2, linewidth=0.0)
185187
ax.plot([xmax,xmax], [0, float(post_int(xmax))/norm], color=color, linestyle=ls, label=lab)
186188
ax.plot(xx, yy, lw=1, color=color, ls="-")

CHIMERA/utils/plotting.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def plot_2Dcoring(like,
4141
event = 0,
4242
do_boundaries = True,
4343
do_KDE = False,
44-
do_gal = True,
44+
do_gal = False,
4545
do_p_gal = True,
4646
do_p_gw = True,
4747
do_p_z = False,
@@ -51,7 +51,7 @@ def plot_2Dcoring(like,
5151
KDE_levels = [0.1,0.8,0.9, 0.99],
5252
lw = 1,
5353
lab_p_gal = "$p_{\mathrm{gal},k}(z)$",
54-
lab_p_gw = "$p_{\mathrm{gw},k}(z)$",
54+
lab_p_gw = "$p_{\mathrm{gw},k}(z|H_0)$",
5555
lab_p_z = "$p_{z,k}(z)$",
5656
ax = None,
5757
):
@@ -75,7 +75,6 @@ def pdf(y):
7575
# Individual galaxies
7676
alpha = misc.remapMinMax(-zgal, a=.2, b=.7)
7777
ax[0].scatter(ragal, decgal, marker='x', c='darkred', s=30, label="Potential hosts", alpha=alpha)
78-
# ax[0].scatter(ragal, decgal, marker='x', c='darkred', s=30, label="All galaxies", alpha=0.5)
7978

8079
if do_boundaries: # Highlight Healpixels
8180
for jpix in pixels:
@@ -101,21 +100,19 @@ def pdf(y):
101100
[ax[1].plot(z_grid, pdf(like.p_gal_all[event][:,pix]), c="darkred", lw=lw, alpha=0.7, label=lab_p_gal if pix==0 else None) for pix in range(len(pixels))]
102101

103102
if do_p_gw: # Plot p(z)_gw for each pixel
104-
[ax[1].plot(z_grid, pdf(like.p_gw_all[iteration][event][:,pix]), c="darkblue", lw=lw, alpha=0.7, label=lab_p_gw if pix==0 else None) for pix in range(len(pixels))]
103+
[ax[1].plot(z_grid, pdf(like.p_gw_all[iteration][:,pix]), c="darkblue", lw=lw, alpha=0.7, label=lab_p_gw if pix==0 else None) for pix in range(len(pixels))]
105104

106105
if do_p_z: # Plot p(z) for each pixel
107106
[ax[1].plot(z_grid, pdf(like.p_z_all[iteration][event][:,pix]), c="teal", lw=lw, alpha=0.7, label=lab_p_z if pix==0 else None) for pix in range(len(pixels))]
108107

109108
ax[0].set_xlabel("RA")
110-
ax[0].set_ylabel("DEC")
109+
ax[0].set_ylabel("Dec")
111110
ax[1].set_xlabel(r"$z$")
112-
ax[1].set_ylabel(r"$p(z)~\textit{renormalized}$" if renorm_all else r"$p(z)$")
111+
ax[1].set_ylabel(r"$p(z)$")
113112
ax[1].set_xlim(*z_lims)
114113
ax[0].legend()
115114
ax[1].legend()
116115

117-
return fig
118-
119116

120117

121118

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The code is designed to be accurate for different scenarios, encompassing bright
1616

1717
## Installation
1818

19-
The code can be easily installed with pip:
19+
The code can be easily installed with pip (available soon):
2020

2121
pip install chimera-gw
2222

@@ -28,7 +28,7 @@ or by cloning the source repository hosted on GitHub
2828

2929
## Documentation
3030

31-
Read the docs at [chimera-gw.readthedocs.io](https://chimera-gw.readthedocs.io)
31+
The full documentation is provided at [chimera-gw.readthedocs.io](https://chimera-gw.readthedocs.io)
3232

3333

3434

docs/_static/CHIMERA_diagram.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/api/GW.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ GW
1212

1313
.. autoclass:: CHIMERA.DataGW.DataLVK
1414
:members:
15-
:inherited-members:
16-
3
15+
:inherited-members:

docs/api/Models.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fLCDM
2424
^^^^^
2525

2626
.. autofunction:: CHIMERA.cosmo.fLCDM.dC
27-
.. autofunction:: CHIMERA.cosmo.fLCDM.d_L
27+
.. autofunction:: CHIMERA.cosmo.fLCDM.dL
2828
.. autofunction:: CHIMERA.cosmo.fLCDM.ddL_dz
2929
.. autofunction:: CHIMERA.cosmo.fLCDM.V
3030
.. autofunction:: CHIMERA.cosmo.fLCDM.dV_dz

docs/index.rst

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,29 @@
1111

1212
<div style="min-height:0.1em;"></div>
1313

14+
1415
*******
1516
CHIMERA
1617
*******
1718

18-
.. .. raw:: html
19-
20-
.. <img src="_static/CHIMERA_logoNB2.svg";" style="width:350px; margin:5px;"/>
21-
22-
.. <br/>
23-
24-
2519
**CHIMERA** (Combined Hierarchical Inference Model for Electromagnetic and gRavitational-wave Analysis), is a flexible Python code to analyze standard sirens with galaxy catalogs, allowing for a joint fitting of the cosmological and astrophysical population parameters within a Hierarchical Bayesian Inference framework.
2620

27-
.. The code is designed to be accurate for different scenarios, encompassing bright, dark, and spectral sirens methods, and computationally efficient in view of next-generation GW observatories and galaxy surveys. It uses the LAX-backend implementation and Just In Time (JIT) computation capabilities of JAX.
28-
2921

3022
.. image:: https://img.shields.io/badge/GitHub-CHIMERA-9e8ed7
3123
:target: https://github.com/CosmoStatGW/CHIMERA/
24+
:alt: GitHub
3225
.. image:: https://img.shields.io/badge/arXiv-2106.14894-28bceb
3326
:target: https://arxiv.org/abs/2106.14894
27+
:alt: arXiv
3428
.. image:: https://readthedocs.org/projects/chimera-gw/badge/?version=latest
35-
:target: https://chimera-gw.readthedocs.io/en/latest/?badge=latest
29+
:target: https://chimera-gw.readthedocs.io/latest/?badge=latest
30+
:alt: Documentation Status
3631
.. image:: https://img.shields.io/badge/license-MIT-fb7e21
3732
:target: https://github.com/CosmoStatGW/CHIMERA/blob/main/LICENSE
33+
:alt: License
3834
.. image:: https://img.shields.io/gitlab/v/release/14528131
3935
:target: https://gitlab.com/mmoresco/CHIMERA/-/tags
36+
:alt: Release
4037

4138
.. raw:: html
4239

@@ -53,7 +50,6 @@ Installation
5350
pip install chimera-gw
5451
5552
56-
5753
License & Attribution
5854
---------------------
5955

@@ -77,44 +73,46 @@ If you find this code useful in your research, please cite the following paper (
7773
}
7874

7975

80-
8176
The team
8277
--------
8378

84-
Main developers:
79+
**Core team**
8580

86-
- `Nicola Borghi (nicola.borghi6@unibo.it) <https://orcid.org/0000-0002-2889-8997>`_
87-
- `Michele Mancarella (michele.mancarella@unimib.it) <https://orcid.org/0000-0002-0675-508X>`_
81+
- `Nicola Borghi <https://orcid.org/0000-0002-2889-8997>`_ (**main developer**, nicola.borghi6@unibo.it)
82+
- `Michele Mancarella <https://orcid.org/0000-0002-0675-508X>`_ (michele.mancarella@unimib.it)
83+
- `Michele Moresco <https://orcid.org/0000-0002-7616-7136>`_ (michele.moresco@unibo.it)
8884

85+
**Contributors**
8986

90-
Contributors:
91-
92-
- `Michele Moresco (michele.moresco@unibo.it) <https://orcid.org/0000-0002-7616-7136>`_
9387
- `Matteo Tagliazucchi <https://orcid.org/0000-0002-2889-8997>`_
94-
- `Francesco Iacovelli <https://orcid.org/0000-0002-4875-5862>`_
9588
- Niccolò Passaleva
96-
89+
- `Francesco Iacovelli <https://orcid.org/0000-0002-4875-5862>`_
9790

9891
The code was developed starting from https://github.com/CosmoStatGW/DarkSirensStat (`Finke et al. 2019 <https://orcid.org/0000-0002-2889-8997>`_) and https://github.com/CosmoStatGW/MGCosmoPop (`Mancarella et al. 2021 <https://orcid.org/0000-0002-2889-8997>`_).
9992

10093

101-
10294
Documentation
10395
-------------
10496

10597
.. toctree::
106-
:maxdepth: 2
98+
:maxdepth: 1
10799
:caption: User Guide
108100

109101
user_guide/installation
110102
user_guide/introduction
111103
user_guide/getting_started
112104
user_guide/framework
105+
user_guide/changelog
113106
user_guide/citing
114107

108+
.. toctree::
109+
:maxdepth: 1
110+
:caption: Tutorials
111+
112+
tutorials/GW170817
115113

116114
.. toctree::
117-
:maxdepth: 2
115+
:maxdepth: 1
118116
:caption: Python APIs
119117

120118
api/MCMC
@@ -125,11 +123,7 @@ Documentation
125123
api/Models
126124

127125

128-
.. .. toctree::
129-
.. :maxdepth: 1
130-
.. :caption: Tutorials
131126

132-
.. tutorials/quickstart
133127

134128

135129
.. Changelog

0 commit comments

Comments
 (0)