Skip to content

Commit d6e6fc1

Browse files
authored
Lmax docstring fix (#224)
* Lmax docs fixed, test added
1 parent 2b89ae3 commit d6e6fc1

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
channel-priority: strict
4949
show-channel-urls: true
5050
miniforge-version: latest
51-
miniforge-variant: Mambaforge
51+
miniforge-variant: Miniforge3
5252

5353
- name: Set current date as environment variable
5454
run: echo "TODAY=$(date +'%Y.%m.%d')" >> $GITHUB_ENV

pymaster/field.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ class NmtField(object):
7070
:meth:`~pymaster.utils.get_default_params`,
7171
and modified via :meth:`~pymaster.utils.set_n_iter_default`.
7272
lmax (:obj:`int`): Maximum multipole up to which map power spectra
73-
will be computed. If negative or zero, the maximum multipole given
73+
will be computed. If ``None``, the maximum multipole given
7474
the map resolution will be used (e.g. :math:`3N_{\\rm side}-1`
7575
for HEALPix maps).
7676
lmax_mask (:obj:`int`): Maximum multipole up to which the power
77-
spectrum of the mask will be computed. If negative or zero, the
77+
spectrum of the mask will be computed. If ``None``, the
7878
maximum multipole given the map resolution will be used (e.g.
7979
:math:`3N_{\\rm side}-1` for HEALPix maps).
8080
tol_pinv (:obj:`float`): When computing the pseudo-inverse of the
@@ -182,6 +182,9 @@ def __init__(self, mask, maps, *, spin=None, templates=None, beam=None,
182182
lmax = self.minfo.get_lmax()
183183
if lmax_mask is None:
184184
lmax_mask = self.minfo.get_lmax()
185+
if (lmax <= 0) or (lmax_mask <= 0):
186+
raise ValueError("`lmax` and `lmax_mask` must be positive.")
187+
185188
self.ainfo = ut.NmtAlmInfo(lmax)
186189
self.ainfo_mask = ut.NmtAlmInfo(lmax_mask)
187190

pymaster/tests/test_field.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,9 @@ def test_field_error():
308308
with pytest.raises(ValueError):
309309
f = nmt.NmtField(FT.msk, [FT.mps[1], FT.mps[2]], spin=1,
310310
purify_b=True, n_iter=0)
311+
312+
# lmax must be zero
313+
with pytest.raises(ValueError):
314+
nmt.NmtField(FT.msk, [FT.mps[0]], lmax=0)
315+
with pytest.raises(ValueError):
316+
nmt.NmtField(FT.msk, [FT.mps[0]], lmax_mask=0)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "pymaster"
10-
version = "2.3.2"
10+
version = "2.3.3"
1111
authors = [
1212
{name="David Alonso", email="[email protected]"}
1313
]

src/nmt_covar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void nmt_compute_gaussian_covariance_coupled(nmt_covar_workspace *cw,
9696
flouble *covar_out)
9797
{
9898
if((cw->lmax<wa->bin->ell_max) || (cw->lmax<wb->bin->ell_max))
99-
report_error(NMT_ERROR_COVAR,"Coupling coefficients only computed up to l=%d, but you require"
99+
report_error(NMT_ERROR_COVAR,"Coupling coefficients only computed up to l=%d, but you require "
100100
"lmax=%d. Recompute this workspace with a larger lmax\n",cw->lmax,wa->bin->ell_max);
101101
if((cw->spin0_only) && (spin_a+spin_b+spin_c+spin_d != 0))
102102
report_error(NMT_ERROR_COVAR,"Coupling coefficients only computed for spin=0\n");
@@ -191,7 +191,7 @@ void nmt_compute_gaussian_covariance(nmt_covar_workspace *cw,
191191
flouble *covar_out)
192192
{
193193
if((cw->lmax<wa->bin->ell_max) || (cw->lmax<wb->bin->ell_max))
194-
report_error(NMT_ERROR_COVAR,"Coupling coefficients only computed up to l=%d, but you require"
194+
report_error(NMT_ERROR_COVAR,"Coupling coefficients only computed up to l=%d, but you require "
195195
"lmax=%d. Recompute this workspace with a larger lmax\n",cw->lmax,wa->bin->ell_max);
196196
if((cw->spin0_only) && (spin_a+spin_b+spin_c+spin_d != 0))
197197
report_error(NMT_ERROR_COVAR,"Coupling coefficients only computed for spin=0\n");

0 commit comments

Comments
 (0)