Skip to content

Commit 7cfd29c

Browse files
authored
V1.11 (#523)
* Add type coercion to satisfy mypy * Change version number to 1.11.0
1 parent 94d3424 commit 7cfd29c

10 files changed

Lines changed: 51 additions & 48 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ jobs:
2727
- name: Setting up Miniforge
2828
uses: conda-incubator/setup-miniconda@v3
2929
with:
30-
mamba-version: "*"
3130
miniforge-version: latest
32-
auto-update-conda: true
33-
activate-environment: firecrown_developer
3431
python-version: ${{ matrix.python-version }}
3532
show-channel-urls: true
3633
conda-remove-defaults: true
3734
environment-file: environment.yml
35+
activate-environment: firecrown_developer
36+
3837
- name: Cache date
3938
id: get-date
4039
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
@@ -124,14 +123,12 @@ jobs:
124123
- name: Setting up Miniforge
125124
uses: conda-incubator/setup-miniconda@v3
126125
with:
127-
mamba-version: "*"
128126
miniforge-version: latest
129-
auto-update-conda: true
130-
activate-environment: firecrown_developer
131127
python-version: ${{ matrix.python-version }}
132128
show-channel-urls: true
133129
conda-remove-defaults: true
134130
environment-file: environment.yml
131+
activate-environment: firecrown_developer
135132
- name: Cache date
136133
id: get-date
137134
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
project = "Firecrown"
1010
copyright = "2025, LSST DESC Firecrown Contributors"
1111
author = "LSST DESC Firecrown Contributors"
12-
release = "1.11.0a0"
12+
release = "1.11.0"
1313

1414
# -- General configuration ---------------------------------------------------
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

firecrown/likelihood/gaussfamily.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def get_cov(
316316
indices: list[int] = []
317317
for stat in statistic_list:
318318
assert stat.sacc_indices is not None
319-
temp = [self.cov_index_map[idx] for idx in stat.sacc_indices]
319+
temp = [self.cov_index_map[int(idx)] for idx in stat.sacc_indices]
320320
indices += temp
321321
ixgrid = np.ix_(indices, indices)
322322

firecrown/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
FIRECROWN_MAJOR = 1
1010
FIRECROWN_MINOR = 11
11-
FIRECROWN_PATCH = "0a0"
11+
FIRECROWN_PATCH = 0
1212
__version__ = f"{FIRECROWN_MAJOR}.{FIRECROWN_MINOR}.{FIRECROWN_PATCH}"

tests/conftest.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def fixture_sacc_galaxy_cells() -> tuple[sacc.Sacc, dict, dict]:
659659
dv = []
660660

661661
for i, j in upper_triangle_indices(len(src_bins_centers)):
662-
Cells = np.random.normal(size=ells.shape[0])
662+
Cells = np.array(np.random.normal(size=ells.shape[0]))
663663
sacc_data.add_ell_cl("galaxy_shear_cl_ee", f"src{i}", f"src{j}", ells, Cells)
664664
tracer_pairs[(TracerNames(f"src{i}", f"src{j}"), "galaxy_shear_cl_ee")] = (
665665
ells,
@@ -668,7 +668,7 @@ def fixture_sacc_galaxy_cells() -> tuple[sacc.Sacc, dict, dict]:
668668
dv.append(Cells)
669669

670670
for i, j in upper_triangle_indices(len(lens_bins_centers)):
671-
Cells = np.random.normal(size=ells.shape[0])
671+
Cells = np.array(np.random.normal(size=ells.shape[0]))
672672
sacc_data.add_ell_cl("galaxy_density_cl", f"lens{i}", f"lens{j}", ells, Cells)
673673
tracer_pairs[(TracerNames(f"lens{i}", f"lens{j}"), "galaxy_density_cl")] = (
674674
ells,
@@ -677,7 +677,7 @@ def fixture_sacc_galaxy_cells() -> tuple[sacc.Sacc, dict, dict]:
677677
dv.append(Cells)
678678

679679
for i, j in product(range(len(src_bins_centers)), range(len(lens_bins_centers))):
680-
Cells = np.random.normal(size=ells.shape[0])
680+
Cells = np.array(np.random.normal(size=ells.shape[0]))
681681
sacc_data.add_ell_cl(
682682
"galaxy_shearDensity_cl_e", f"src{i}", f"lens{j}", ells, Cells
683683
)
@@ -828,7 +828,7 @@ def fixture_sacc_galaxy_xis():
828828
dv = []
829829

830830
for i, j in upper_triangle_indices(len(lens_bins_centers)):
831-
xis = np.random.normal(size=thetas.shape[0])
831+
xis = np.array(np.random.normal(size=thetas.shape[0]))
832832
sacc_data.add_theta_xi("galaxy_density_xi", f"lens{i}", f"lens{j}", thetas, xis)
833833
tracer_pairs[(TracerNames(f"lens{i}", f"lens{j}"), "galaxy_density_xi")] = (
834834
thetas,
@@ -837,7 +837,7 @@ def fixture_sacc_galaxy_xis():
837837
dv.append(xis)
838838

839839
for i, j in product(range(len(src_bins_centers)), range(len(lens_bins_centers))):
840-
xis = np.random.normal(size=thetas.shape[0])
840+
xis = np.array(np.random.normal(size=thetas.shape[0]))
841841
sacc_data.add_theta_xi(
842842
"galaxy_shearDensity_xi_t", f"src{i}", f"lens{j}", thetas, xis
843843
)
@@ -850,7 +850,7 @@ def fixture_sacc_galaxy_xis():
850850
dv.append(xis)
851851

852852
for i, j in upper_triangle_indices(len(src_bins_centers)):
853-
xis = np.random.normal(size=thetas.shape[0])
853+
xis = np.array(np.random.normal(size=thetas.shape[0]))
854854
sacc_data.add_theta_xi(
855855
"galaxy_shear_xi_minus", f"src{i}", f"src{j}", thetas, xis
856856
)
@@ -860,7 +860,7 @@ def fixture_sacc_galaxy_xis():
860860
)
861861
dv.append(xis)
862862
for i, j in upper_triangle_indices(len(src_bins_centers)):
863-
xis = np.random.normal(size=thetas.shape[0])
863+
xis = np.array(np.random.normal(size=thetas.shape[0]))
864864
sacc_data.add_theta_xi(
865865
"galaxy_shear_xi_plus", f"src{i}", f"src{j}", thetas, xis
866866
)
@@ -908,7 +908,7 @@ def fixture_sacc_galaxy_xis_inverted():
908908
dv = []
909909

910910
for i, j in upper_triangle_indices(len(lens_bins_centers)):
911-
xis = np.random.normal(size=thetas.shape[0])
911+
xis = np.array(np.random.normal(size=thetas.shape[0]))
912912
sacc_data.add_theta_xi("galaxy_density_xi", f"lens{j}", f"lens{i}", thetas, xis)
913913
tracer_pairs[(TracerNames(f"lens{j}", f"lens{i}"), "galaxy_density_xi")] = (
914914
thetas,
@@ -917,7 +917,7 @@ def fixture_sacc_galaxy_xis_inverted():
917917
dv.append(xis)
918918

919919
for i, j in product(range(len(src_bins_centers)), range(len(lens_bins_centers))):
920-
xis = np.random.normal(size=thetas.shape[0])
920+
xis = np.array(np.random.normal(size=thetas.shape[0]))
921921
sacc_data.add_theta_xi(
922922
"galaxy_shearDensity_xi_t", f"lens{i}", f"src{j}", thetas, xis
923923
)
@@ -930,7 +930,7 @@ def fixture_sacc_galaxy_xis_inverted():
930930
dv.append(xis)
931931

932932
for i, j in upper_triangle_indices(len(src_bins_centers)):
933-
xis = np.random.normal(size=thetas.shape[0])
933+
xis = np.array(np.random.normal(size=thetas.shape[0]))
934934
sacc_data.add_theta_xi(
935935
"galaxy_shear_xi_minus", f"src{j}", f"src{i}", thetas, xis
936936
)
@@ -940,7 +940,7 @@ def fixture_sacc_galaxy_xis_inverted():
940940
)
941941
dv.append(xis)
942942
for i, j in upper_triangle_indices(len(src_bins_centers)):
943-
xis = np.random.normal(size=thetas.shape[0])
943+
xis = np.array(np.random.normal(size=thetas.shape[0]))
944944
sacc_data.add_theta_xi(
945945
"galaxy_shear_xi_plus", f"src{j}", f"src{i}", thetas, xis
946946
)
@@ -969,7 +969,7 @@ def fixture_sacc_galaxy_cells_ambiguous() -> sacc.Sacc:
969969
dndz = np.exp(-0.5 * (z - 0.5) ** 2 / 0.05 / 0.05)
970970
sacc_data.add_tracer("NZ", "bin0", z, dndz)
971971
sacc_data.add_tracer("NZ", "bin1", z, dndz)
972-
Cells = np.random.normal(size=ells.shape[0])
972+
Cells = np.array(np.random.normal(size=ells.shape[0]))
973973
sacc_data.add_ell_cl("galaxy_shearDensity_cl_e", "bin0", "bin1", ells, Cells)
974974
cov = np.diag(np.zeros(len(ells)) + 0.01)
975975

@@ -1052,7 +1052,7 @@ def fixture_sacc_galaxy_cells_src0_src0_no_window() -> (
10521052
dndz = np.exp(-0.5 * (z - 0.5) ** 2 / 0.05 / 0.05)
10531053
sacc_data.add_tracer("NZ", "src0", z, dndz)
10541054

1055-
Cells = np.random.normal(size=ells.shape[0])
1055+
Cells = np.array(np.random.normal(size=ells.shape[0]))
10561056
sacc_data.add_ell_cl("galaxy_shear_cl_ee", "src0", "src0", ells, Cells)
10571057

10581058
cov = np.diag(np.ones_like(Cells) * 0.01)

tests/metadata/test_metadata_two_point_sacc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ def fixture_sacc_galaxy_xis_three_tracers() -> (
190190
dndz2 = np.exp(-0.5 * (z - 0.9) ** 2 / 0.05 / 0.05)
191191
sacc_data.add_tracer("NZ", "lens1", z, dndz2)
192192

193-
xis = np.random.normal(size=thetas.shape[0])
193+
# We have to coerce the return type of np.random.normal to np.array,
194+
# because mypy 1.16 is unable to infer the type of the return value.
195+
xis = np.array(np.random.normal(size=thetas.shape[0]))
194196
for theta, xi in zip(thetas, xis):
195197
sacc_data.add_data_point(
196198
"galaxy_density_xi", ("src0", "lens0", "lens1"), xi, theta=theta
@@ -221,7 +223,9 @@ def fixture_sacc_galaxy_cells_three_tracers() -> (
221223
dndz2 = np.exp(-0.5 * (z - 0.9) ** 2 / 0.05 / 0.05)
222224
sacc_data.add_tracer("NZ", "lens1", z, dndz2)
223225

224-
Cells = np.random.normal(size=ells.shape[0])
226+
# We have to coerce the return type of np.random.normal to np.array,
227+
# because mypy 1.16 is unable to infer the type of the return value.
228+
Cells = np.array(np.random.normal(size=ells.shape[0]))
225229
for ell, cell in zip(ells, Cells):
226230
sacc_data.add_data_point(
227231
"galaxy_shear_cl_ee", ("src0", "lens0", "lens1"), cell, ell=ell

tests/test_cluster_mass_richness.py

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,19 @@ def test_create_musigma_kernel():
6666

6767
def test_cluster_observed_z():
6868
for z in np.geomspace(1.0e-18, 2.0, 20):
69-
z = np.atleast_1d(z)
69+
zarray = np.atleast_1d(z)
7070
mass = np.atleast_1d(0)
71-
f_z = MassRichnessGaussian.observed_value((0.0, 0.0, 1.0), mass, z, 0, 0)
72-
assert f_z == pytest.approx(np.log1p(z), 1.0e-7, 0.0)
71+
f_z = MassRichnessGaussian.observed_value((0.0, 0.0, 1.0), mass, zarray, 0, 0)
72+
assert f_z == pytest.approx(np.log1p(zarray), 1.0e-7, 0.0)
7373

7474

7575
def test_cluster_observed_mass():
7676
for mass in np.linspace(10.0, 16.0, 20):
7777
z = np.atleast_1d(0)
78-
mass = np.atleast_1d(mass)
79-
f_logM = MassRichnessGaussian.observed_value((0.0, 1.0, 0.0), mass, z, 0, 0)
78+
massarray = np.atleast_1d(mass)
79+
f_logM = MassRichnessGaussian.observed_value(
80+
(0.0, 1.0, 0.0), massarray, z, 0, 0
81+
)
8082

8183
assert f_logM == pytest.approx(mass * np.log(10.0), 1.0e-7, 0.0)
8284

@@ -90,13 +92,13 @@ def test_cluster_murata_binned_distribution(murata_binned_relation: MurataBinned
9092
for mass1, mass2 in zip(mass_array[:-1], mass_array[1:]):
9193
mass1_a = np.atleast_1d(mass1)
9294
mass2_a = np.atleast_1d(mass2)
93-
z = np.atleast_1d(z)
95+
zarray = np.atleast_1d(z)
9496

9597
probability_0 = murata_binned_relation.distribution(
96-
mass1_a, z, mass_proxy_limits
98+
mass1_a, zarray, mass_proxy_limits
9799
)
98100
probability_1 = murata_binned_relation.distribution(
99-
mass2_a, z, mass_proxy_limits
101+
mass2_a, zarray, mass_proxy_limits
100102
)
101103

102104
assert probability_0 >= 0
@@ -122,14 +124,14 @@ def test_cluster_murata_binned_distribution(murata_binned_relation: MurataBinned
122124
def test_cluster_murata_binned_mean(murata_binned_relation: MurataBinned):
123125
for mass in np.linspace(7.0, 26.0, 20):
124126
for z in np.geomspace(1.0e-18, 2.0, 20):
125-
mass = np.atleast_1d(mass)
126-
z = np.atleast_1d(z)
127-
test = murata_binned_relation.get_proxy_mean(mass, z)
127+
massarray = np.atleast_1d(mass)
128+
zarray = np.atleast_1d(z)
129+
test = murata_binned_relation.get_proxy_mean(massarray, zarray)
128130

129131
true = MassRichnessGaussian.observed_value(
130132
(3.00, 0.086, 0.01),
131-
mass,
132-
z,
133+
massarray,
134+
zarray,
133135
PIVOT_MASS * np.log(10.0),
134136
np.log1p(PIVOT_Z),
135137
)
@@ -140,14 +142,14 @@ def test_cluster_murata_binned_mean(murata_binned_relation: MurataBinned):
140142
def test_cluster_murata_binned_variance(murata_binned_relation: MurataBinned):
141143
for mass in np.linspace(7.0, 26.0, 20):
142144
for z in np.geomspace(1.0e-18, 2.0, 20):
143-
mass = np.atleast_1d(mass)
144-
z = np.atleast_1d(z)
145-
test = murata_binned_relation.get_proxy_sigma(mass, z)
145+
massarray = np.atleast_1d(mass)
146+
zarray = np.atleast_1d(z)
147+
test = murata_binned_relation.get_proxy_sigma(massarray, zarray)
146148

147149
true = MassRichnessGaussian.observed_value(
148150
(3.00, 0.07, 0.01),
149-
mass,
150-
z,
151+
massarray,
152+
zarray,
151153
PIVOT_MASS * np.log(10.0),
152154
np.log1p(PIVOT_Z),
153155
)
@@ -163,14 +165,14 @@ def test_cluster_murata_unbinned_distribution(murata_unbinned_relation: MurataUn
163165
for mass1, mass2 in zip(mass_array[:-1], mass_array[1:]):
164166
mass1_a = np.atleast_1d(mass1)
165167
mass2_a = np.atleast_1d(mass2)
166-
z = np.atleast_1d(z)
168+
zarray = np.atleast_1d(z)
167169
mass_proxy = np.atleast_1d(1)
168170

169171
probability_0 = murata_unbinned_relation.distribution(
170-
mass1_a, z, mass_proxy
172+
mass1_a, zarray, mass_proxy
171173
)
172174
probability_1 = murata_unbinned_relation.distribution(
173-
mass2_a, z, mass_proxy
175+
mass2_a, zarray, mass_proxy
174176
)
175177

176178
# Probability density should be initially monotonically increasing

tests/test_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99

1010
def test_version():
11-
assert firecrown.__version__ == "1.11.0a0"
11+
assert firecrown.__version__ == "1.11.0"

tutorial/introduction_to_firecrown.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: An Introduction to Firecrown
3-
subtitle: "Version 1.11.0a0"
3+
subtitle: "Version 1.11.0"
44
authors:
55
- Marc Paterno
66
- Sandro Vitenti

tutorial/two_point_generators.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ wl_photoz = wl.PhotoZShiftFactory()
9393
wl_mult_bias = wl.MultiplicativeShearBiasFactory()
9494
9595
# NumberCounts systematics -- global
96-
# As for Firecrown 1.11.0a0, we do not have any global systematics for number counts
96+
# As for Firecrown 1.11.0, we do not have any global systematics for number counts
9797
# NumberCounts systematics -- per-bin
9898
nc_photoz = nc.PhotoZShiftFactory()
9999

0 commit comments

Comments
 (0)