Skip to content

Commit a5b8892

Browse files
cailmdaleyclaude
andcommitted
feat: add ell_step parameter for linear NaMaster binning
Replaces hardcoded step=10 with configurable ell_step parameter. - n_ell_bins: number of bins (for powspace binning) - ell_step: bin width Δℓ (for linear binning) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 60d3e9f commit a5b8892

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/sp_validation/cosmo_val.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ class CosmologyValidation:
8282
power : float, default 0.5
8383
Exponent for power-law binning when binning='powspace'.
8484
n_ell_bins : int, default 32
85-
Number of ell bins for pseudo-C_ell analysis.
85+
Number of ell bins for pseudo-C_ell analysis (used with binning='powspace').
86+
ell_step : int, default 10
87+
Bin width in ell for linear binning (used with binning='linear').
8688
pol_factor : bool, default True
8789
Apply polarization correction factor in pseudo-C_ell calculations.
8890
nrandom_cell : int, default 10
@@ -205,6 +207,7 @@ def __init__(
205207
binning="powspace",
206208
power=1 / 2,
207209
n_ell_bins=32,
210+
ell_step=10,
208211
pol_factor=True,
209212
cell_method='map',
210213
nrandom_cell=10,
@@ -229,6 +232,7 @@ def __init__(
229232
self.binning = binning
230233
self.power = power
231234
self.n_ell_bins = n_ell_bins
235+
self.ell_step = ell_step
232236
self.pol_factor = pol_factor
233237
self.nrandom_cell = nrandom_cell
234238
self.cell_method = cell_method
@@ -2634,8 +2638,7 @@ def calculate_pseudo_cl_eb_cov(self):
26342638
b_lmax = lmax - 1
26352639

26362640
if self.binning == 'linear':
2637-
step = 10
2638-
b = nmt.NmtBin.from_nside_linear(self.nside, step)
2641+
b = nmt.NmtBin.from_nside_linear(self.nside, self.ell_step)
26392642
elif self.binning == 'powspace':
26402643
ells = np.arange(lmin, lmax+1)
26412644

@@ -3030,8 +3033,7 @@ def get_pseudo_cls_map(self, map, wsp=None):
30303033
b_lmax = lmax - 1
30313034

30323035
if self.binning == 'linear':
3033-
step = 10
3034-
b = nmt.NmtBin.from_nside_linear(self.nside, step)
3036+
b = nmt.NmtBin.from_nside_linear(self.nside, self.ell_step)
30353037
elif self.binning == 'powspace':
30363038
ells = np.arange(lmin, lmax+1)
30373039

@@ -3070,8 +3072,7 @@ def get_pseudo_cls_catalog(self, catalog, params, wsp=None):
30703072
b_lmax = lmax - 1
30713073

30723074
if self.binning == 'linear':
3073-
step = 10
3074-
b = nmt.NmtBin.from_nside_linear(self.nside, step)
3075+
b = nmt.NmtBin.from_nside_linear(self.nside, self.ell_step)
30753076
elif self.binning == 'powspace':
30763077
ells = np.arange(lmin, lmax+1)
30773078

0 commit comments

Comments
 (0)