Skip to content

Commit f018b20

Browse files
authored
Add new DES-Dovekie SN release (#465)
* Create desdovekie.py Initial commit for updated SN-likelihood for use in DES-Dovekie. * Update sn.py Added a new method to read new updated inverse covariance matrices for SN * Initial slate of corrections to get DES-Dovekie to work * sn.py updated to point at sn_data v1.8 * Update test_cosmo_sn.py
1 parent 0b01e17 commit f018b20

5 files changed

Lines changed: 77 additions & 1 deletion

File tree

cobaya/cosmo_input/input_database.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,11 @@
838838
"theory": theory,
839839
"likelihood": {"sn.desy5": None},
840840
},
841+
"DESDovekie": {
842+
"desc": "Supernovae data from the updated DES-Dovekie Y5 sample",
843+
"theory": theory,
844+
"likelihood": {"sn.desdovekie": None},
845+
},
841846
"Pantheon": {
842847
"desc": "Supernovae data from the Pantheon sample",
843848
"theory": theory,

cobaya/likelihoods/base_classes/sn.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SN(DataSetLikelihood):
5353

5454
install_options = {
5555
"github_repository": "CobayaSampler/sn_data",
56-
"github_release": "v1.6",
56+
"github_release": "v1.8",
5757
}
5858

5959
use_abs_mag: bool = False
@@ -228,6 +228,18 @@ def get_requirements(self):
228228
reqs["Mb"] = None
229229
return reqs
230230

231+
def _read_inv_covmat(self, filename):
232+
d = np.load(filename)
233+
n = d[d.files[0]][0]
234+
inv_cov = np.zeros((n, n))
235+
inv_cov[np.triu_indices(n)] = d[d.files[1]]
236+
237+
# Reflect to lower triangular part to make it symmetric
238+
i_lower = np.tril_indices(n, -1)
239+
inv_cov[i_lower] = inv_cov.T[i_lower]
240+
241+
return inv_cov
242+
231243
def _read_covmat(self, filename):
232244
cov = np.loadtxt(filename)
233245
if np.isscalar(cov[0]) and cov[0] ** 2 + 1 == len(cov):
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
3+
from .pantheonplus import PantheonPlus
4+
5+
6+
class DESDovekie(PantheonPlus):
7+
"""
8+
Likelihood for DES-Dovekie type Ia supernovae sample.
9+
10+
Reference
11+
---------
12+
https://arxiv.org/abs/2511.07517
13+
"""
14+
15+
def _read_data_file(self, data_file):
16+
file_cols = ['idsurvey', 'zhd', 'zhel', 'mu', 'muerr', 'muerr_vpec', 'muerr_sys', 'probia_beams']
17+
self.cols = ['idsurvey', 'zcmb', 'zhel', 'mag', 'magerr', 'magerr_vpec', 'magerr_sys', 'probia_beams']
18+
self._read_cols(data_file, file_cols, sep=",")
19+
20+
21+
def init_params(self, ini):
22+
23+
self.twoscriptmfit = False
24+
data_file = os.path.normpath(os.path.join(self.path, ini.string("data_file")))
25+
self._read_data_file(data_file)
26+
self.covs = {}
27+
for name in ["mag"]:
28+
self.log.debug("Reading inverse covmat for: %s " % name)
29+
self.invcov = self._read_inv_covmat(
30+
os.path.join(self.path, ini.string("%s_covmat_file" % name))
31+
)
32+
self.alphabeta_covmat = False
33+
self.configure()
34+
if not self.use_abs_mag:
35+
self._marginalize_abs_mag()
36+
self.marginalize = False
37+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Settings for the DES-Dovekie SN Ia analysis.
2+
3+
# Path to the data: where the sn_data has been cloned
4+
path: null
5+
# .dataset file with settings
6+
dataset_file: DES-Dovekie/config.dataset
7+
# Overriding of .dataset parameters
8+
dataset_params:
9+
# field: value
10+
# Aliases for automatic covariance matrix
11+
aliases: [DESDovekie]
12+
# Use absolute magnitude
13+
use_abs_mag: False
14+
# Speed in evaluations/second
15+
speed: 100

tests/test_cosmo_sn.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ def test_sn_desy5_camb(packages_path, skip_not_installed):
115115
_test_sn(packages_path, skip_not_installed, "sn.desy5")
116116

117117

118+
def test_sn_desdovekie_camb(packages_path, skip_not_installed):
119+
_test_sn(packages_path, skip_not_installed, "sn.desdovekie")
120+
121+
122+
118123
# BEST FIT AND REFERENCE VALUES ##########################################################
119124

120125
best_fit = deepcopy(params_lowTEB_highTTTEEE)
@@ -130,4 +135,6 @@ def test_sn_desy5_camb(packages_path, skip_not_installed):
130135
"sn.pantheonplusshoes": 1496.97,
131136
"sn.union3": 26.31,
132137
"sn.desy5": 1644.94,
138+
"sn.desdovekie":1632.35,
139+
133140
}

0 commit comments

Comments
 (0)