Skip to content

Commit

Permalink
BUG(fields): infer correct lmax in effective_cls() (#153)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ntessore authored Feb 28, 2024
1 parent 1750259 commit ea1d18f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion glass/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ea1d18f

Please sign in to comment.