From ea1d18ff286cfcefc40fadf32a5de38713dc5ef7 Mon Sep 17 00:00:00 2001 From: Nicolas Tessore Date: Wed, 28 Feb 2024 13:21:19 +0000 Subject: [PATCH] BUG(fields): infer correct lmax in effective_cls() (#153) Fixes a bug in the `effective_cls()` function that caused the returned arrays to be 1 entry too long when `lmax` was not given explicitly. Closes: #152 Fixed: A bug in `effective_cls()` that caused arrays to be one entry too long if `lmax` was not given explicitly. --- glass/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glass/fields.py b/glass/fields.py index 766d3a15..20defdb4 100644 --- a/glass/fields.py +++ b/glass/fields.py @@ -362,7 +362,7 @@ def effective_cls(cls, weights1, weights2=None, *, lmax=None): # find lmax if not given if lmax is None: - lmax = max(map(len, cls), default=-1) + lmax = max(map(len, cls), default=0) - 1 # broadcast weights1 such that its shape ends in n weights1 = np.asanyarray(weights1)