Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion glass/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import math
from typing import TYPE_CHECKING

import healpix
import healpy as hp
import numpy as np

Expand Down Expand Up @@ -85,7 +86,7 @@ def vmap_galactic_ecliptic(
msg = "ecliptic stripe must be a pair of numbers"
raise TypeError(msg)

m = np.ones(hp.nside2npix(nside))
m = np.ones(healpix.nside2npix(nside))
m[hp.query_strip(nside, *galactic)] = 0
m = hp.Rotator(coord="GC").rotate_map_pixel(m)
m[hp.query_strip(nside, *ecliptic)] = 0
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ classifiers = [
dependencies = [
"array-api-compat>=1.12.0",
"array-api-extra>=0.9.0",
"ducc0>=0.39.1",
"healpix>=2022.11.1",
"healpy>=1.15.0",
"transformcl>=2022.8.9",
Expand Down
6 changes: 3 additions & 3 deletions tests/benchmarks/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import random
from typing import TYPE_CHECKING

import healpy as hp
import healpix
import pytest

import glass
Expand Down Expand Up @@ -205,7 +205,7 @@ def function_to_benchmark() -> list[Any]:

gaussian_fields = benchmark(function_to_benchmark)

assert gaussian_fields[0].shape == (hp.nside2npix(nside),)
assert gaussian_fields[0].shape == (healpix.nside2npix(nside),)


@pytest.mark.stable
Expand Down Expand Up @@ -248,7 +248,7 @@ def function_to_benchmark() -> list[Any]:

assert len(result) == expected_len
for field in result:
assert field.shape == (hp.nside2npix(nside),)
assert field.shape == (healpix.nside2npix(nside),)
compare.assert_allclose(result[1], result[0] ** 2, atol=1e-05)


Expand Down
9 changes: 5 additions & 4 deletions tests/core/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from typing import TYPE_CHECKING

import healpix
import healpy as hp
import numpy as np
import pytest
Expand Down Expand Up @@ -336,21 +337,21 @@ def test_generate_grf(compare: type[Compare]) -> None:

gaussian_fields = list(glass.fields._generate_grf(gls, nside))

assert gaussian_fields[0].shape == (hp.nside2npix(nside),)
assert gaussian_fields[0].shape == (healpix.nside2npix(nside),)

# requires resetting the RNG for reproducibility
rng = np.random.default_rng(seed=seed)
gaussian_fields = list(glass.fields._generate_grf(gls, nside, rng=rng))

assert gaussian_fields[0].shape == (hp.nside2npix(nside),)
assert gaussian_fields[0].shape == (healpix.nside2npix(nside),)

# requires resetting the RNG for reproducibility
rng = np.random.default_rng(seed=seed)
new_gaussian_fields = list(
glass.fields._generate_grf(gls, nside, ncorr=ncorr, rng=rng),
)

assert new_gaussian_fields[0].shape == (hp.nside2npix(nside),)
assert new_gaussian_fields[0].shape == (healpix.nside2npix(nside),)

compare.assert_allclose(new_gaussian_fields[0], gaussian_fields[0])

Expand Down Expand Up @@ -379,7 +380,7 @@ def test_generate(compare: type[Compare]) -> None:
# check output shape

nside = 16
npix = hp.nside2npix(nside)
npix = healpix.nside2npix(nside)
gls = [np.ones(10), np.ones(10), np.ones(10)]

result = list(glass.generate(fields, gls, nside=nside))
Expand Down
3 changes: 2 additions & 1 deletion tests/core/test_harmonics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import healpy as hp
import pytest
import healpix

import array_api_extra as xpx

Expand Down Expand Up @@ -70,7 +71,7 @@ def test_transform(compare: type[Compare], xp: ModuleType) -> None:
nside = 8

# create an unpolarised map where every pixel is the same
simple_map = xp.full(hp.nside2npix(nside), constant)
simple_map = xp.full(healpix.nside2npix(nside), constant)

a00 = math.sqrt(4 * xp.pi) * constant
# the alm array for lmax=0 has size 1, so it only contains a_00
Expand Down
32 changes: 32 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.