Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
de6c731
refactor(test): type erased real-space fixture consumer annotation
marcpaterno Oct 13, 2026
6d55bf5
refactor(test): document real-space TwoPoint fixture test
marcpaterno Oct 13, 2026
f6e36a0
refactor(test): Annotate SACC test fixtures with typed NDArray returns
marcpaterno Oct 17, 2026
b5d4bef
refactor(tests): type harmonic SACC fixture with dataclass records
marcpaterno Oct 17, 2026
ab184b1
refactor(tests): type real SACC fixtures with named dataclasses
marcpaterno Oct 17, 2026
416e614
refactor(test): type windowed SACC fixture with dataclasses
marcpaterno Oct 17, 2026
88978ac
refactor(test): Use HarmonicWindowFunction dataclass in window fixture
marcpaterno Oct 17, 2026
1a00633
refactor(tests): use dataclass for scale cut window fixture
marcpaterno Oct 17, 2026
eb37c23
refactor(test): replace scale-cut fixture tuples with typed dataclasses
marcpaterno Oct 17, 2026
b90feb5
refactor(test): return typed fixture from harmonic cross-bin SACC tests
marcpaterno Oct 17, 2026
8d494f0
refactor(test): type real-space SACC fixtures with dataclass
marcpaterno Oct 17, 2026
ca29473
refactor (test): Return named fixtures for three-tracer SACC tests
marcpaterno Oct 18, 2026
beea667
refactor(test): type sync deps requirement cases with dataclass
marcpaterno Oct 18, 2026
9dca016
refactor(test): annotate CCL calculator fixtures with types
marcpaterno Oct 18, 2026
7df37df
refactor(likelihood): use explicit np.float64 dtypes
marcpaterno Oct 18, 2026
0632c88
refactor: return typed SACC fixture dataclasses from tests
marcpaterno Oct 27, 2026
c3986f1
docs(test): reword fixture docstrings and drop independence claims
marcpaterno Oct 28, 2026
1017e12
fix: remove redundant allocation of beta_rows
marcpaterno Oct 31, 2026
c842299
docs(test): explain distinct SACC fixture record types
marcpaterno Oct 31, 2026
f897ce9
clarify: rename independent SACC expectation to fixture expectation
marcpaterno Oct 31, 2026
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
12 changes: 10 additions & 2 deletions GLOSSARY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Firecrown API, Dependency, and Release Language
# Firecrown Language

Terms used when assessing Firecrown dependencies and the compatibility of releases and pull requests.
Terms used when assessing Firecrown dependencies, release compatibility, and scientific test expectations.

## Language

Expand Down Expand Up @@ -33,3 +33,11 @@ An advisory, technically non-blocking sample of environment rebuildability for a

**API policy verdict**:
The target-dependent interpretation of a completed static public API comparison: no detected breaking changes, informational breaking changes on `master`, or rejection of detected breaking changes on a support target. The verdict is distinct from whether analysis and reporting succeeded; missing analysis or reporting is not evidence of compatibility, and no detected breaks does not establish complete behavioral compatibility.

## SACC Test Language

**SACC fixture expectation**:
A reference redshift distribution or angular spectrum retaining the inputs supplied to SACC, or copies of those inputs, for comparison with extracted results.

**Synthetic SACC observation**:
A supplied test value for a recognized SACC observable, such as an angular power spectrum, angular correlation, or windowed bandpower. It is neither a survey measurement nor necessarily a theory prediction or physically plausible realization; a value with an unknown data-type label has no established observable interpretation.
4 changes: 2 additions & 2 deletions firecrown/likelihood/_gaussfamily.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def __init__(
self.cholesky: None | npt.NDArray[np.float64] = None
self.inv_cov: None | npt.NDArray[np.float64] = None
self.cov_index_map: None | dict[int, int] = None
self.theory_vector: None | npt.NDArray[np.double] = None
self.data_vector: None | npt.NDArray[np.double] = None
self.theory_vector: None | npt.NDArray[np.float64] = None
self.data_vector: None | npt.NDArray[np.float64] = None
self._use_cholesky_for_chisq: bool = use_cholesky

@classmethod
Expand Down
5 changes: 2 additions & 3 deletions firecrown/likelihood/_gaussian_pointmass.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ def _prepare_integrand(self, cosmo: pyccl.Cosmology) -> np.ndarray:

# Cosmology calculations
sc_valid = pyccl.sigma_critical(cosmo, a_lens=aL_all, a_source=aS_all)
sc = np.full(mask.shape, np.nan, dtype=float)
sc = np.full(mask.shape, np.nan, dtype=np.float64)
sc[mask] = sc_valid
D_l_valid = pyccl.angular_diameter_distance(cosmo, a_l)[z_l > 0]
D_l = np.full(z_l.shape, np.nan, dtype=float)
D_l = np.full(z_l.shape, np.nan, dtype=np.float64)
D_l[z_l > 0] = D_l_valid
D_l = D_l[:, None]
integrand = 1.0 / sc / (D_l * D_l)
Expand Down Expand Up @@ -448,7 +448,6 @@ def _build_V(self, betas: np.ndarray) -> np.ndarray:

V = np.zeros((len(row_src_idx), len(lens_tracers)))
valid = (row_lens_idx >= 0) & (row_src_idx >= 0)
beta_rows = np.zeros(valid.sum(), dtype=float)
beta_rows = betas[row_lens_idx[valid], row_src_idx[valid]]
V[valid, row_lens_idx[valid]] = beta_rows / (theta[valid] ** 2)
return V
Expand Down
168 changes: 150 additions & 18 deletions tests/_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""Shared types for test fixtures."""
"""Shared types for test fixtures.

from typing import TypeAlias, TypedDict
Expected arrays retain the inputs supplied to SACC, or copies of those inputs.
"""

from dataclasses import dataclass
from typing import TypedDict

from numcosmo_py import Nc
import numpy as np
Expand All @@ -9,22 +13,150 @@

from firecrown.metadata_types import TracerNames

RedshiftDistribution: TypeAlias = tuple[
npt.NDArray[np.float64], npt.NDArray[np.float64]
]
"""Sampled redshift distribution as (z, dndz), without a normalization guarantee."""

WindowedAngularPowerSpectrum: TypeAlias = tuple[
npt.NDArray[np.int64], npt.NDArray[np.float64], sacc.BandpowerWindow
]
"""Window ell grid, measured bandpowers, and their bandpower window."""

SaccGalaxyWindowedFixture: TypeAlias = tuple[
sacc.Sacc,
dict[str, RedshiftDistribution],
dict[tuple[TracerNames, str], WindowedAngularPowerSpectrum],
]
"""SACC data, distributions by tracer name, and spectra by tracer pair/data type."""

@dataclass(frozen=True, kw_only=True)
class SampledRedshiftDistribution:
"""Sampled redshift coordinates and unnormalized number density.

:param z: Sampled redshift coordinates.
:param dndz: Number-density values on the redshift grid; not normalized.
"""

z: npt.NDArray[np.float64]
dndz: npt.NDArray[np.float64]


@dataclass(frozen=True, kw_only=True)
class SaccGalaxyDistributionFixture:
"""SACC tracer data and its sampled redshift distributions.

:param sacc_data: SACC data used by production extraction and construction.
:param distributions: Redshift distributions keyed by tracer name.
"""

sacc_data: sacc.Sacc
distributions: dict[str, SampledRedshiftDistribution]


# Harmonic and real-space cross-bin records have distinct types because they
# represent different physical observables. Their shared fields can evolve
# independently as fixture values become more physically realistic.
@dataclass(frozen=True, kw_only=True)
class SaccHarmonicCrossBinFixture:
"""Harmonic cross-bin SACC data and expected redshift distributions.

Both tracer distributions share their original redshift coordinate array,
but retain distinct unnormalized number densities. No measurement metadata
is inferred here; consumers still exercise production extraction.

:param sacc_data: Unwindowed harmonic SACC data for the two tracers.
:param distributions: Sampled redshift distributions keyed by tracer name.
"""

sacc_data: sacc.Sacc
distributions: dict[str, SampledRedshiftDistribution]


@dataclass(frozen=True, kw_only=True)
class SaccRealCrossBinFixture:
"""Real cross-bin SACC data and expected redshift distributions.

Both tracer distributions share their original redshift coordinate array,
but retain distinct unnormalized number densities. No measurement metadata
is inferred here; consumers still exercise production extraction.

:param sacc_data: Unwindowed real-space SACC data for the two tracers.
:param distributions: Sampled redshift distributions keyed by tracer name.
"""

sacc_data: sacc.Sacc
distributions: dict[str, SampledRedshiftDistribution]


@dataclass(frozen=True, kw_only=True)
class HarmonicAngularPowerSpectrum:
"""Unwindowed harmonic coordinates and synthetic observations.

:param ells: Integer multipoles for the synthetic observations.
:param cells: Synthetic observed values, not survey data or theory predictions.
"""

ells: npt.NDArray[np.int64]
cells: npt.NDArray[np.float64]


@dataclass(frozen=True, kw_only=True)
class SaccGalaxyHarmonicFixture:
"""Harmonic SACC data with named expected distributions and spectra.

:param sacc_data: SACC data used by production extraction and construction.
:param distributions: Redshift distributions keyed by tracer name.
:param spectra: Synthetic spectra keyed by ordered tracer names and data type.
"""

sacc_data: sacc.Sacc
distributions: dict[str, SampledRedshiftDistribution]
spectra: dict[tuple[TracerNames, str], HarmonicAngularPowerSpectrum]


@dataclass(frozen=True, kw_only=True)
class RealAngularCorrelation:
"""Unwindowed angular coordinates and synthetic observations.

:param thetas: Angular coordinates for the observations.
:param xis: Synthetic correlations, not survey data or theory predictions.
"""

thetas: npt.NDArray[np.float64]
xis: npt.NDArray[np.float64]


@dataclass(frozen=True, kw_only=True)
class SaccGalaxyRealFixture:
"""Real SACC data with named expected distributions and correlations.

:param sacc_data: SACC data used by production extraction and construction.
:param distributions: Redshift distributions keyed by tracer name.
:param spectra: Synthetic correlations keyed by ordered tracer names and data type.
"""

sacc_data: sacc.Sacc
distributions: dict[str, SampledRedshiftDistribution]
spectra: dict[tuple[TracerNames, str], RealAngularCorrelation]


@dataclass(frozen=True, kw_only=True)
class WindowedAngularPowerSpectrum:
"""Window support, synthetic bandpowers, and their shared window.

Support multipoles need not match the number of bandpowers.
SACC observation labels are weighted support sums, not the support grid
or normalized band centers.

:param support_ells: Integer multipoles on which the window is defined.
:param bandpowers: Synthetic observed values, not survey data or predictions;
one per window column.
:param window: SACC BandpowerWindow shared with the fixture's data points;
its values are support multipoles and its weights are unnormalized.
"""

support_ells: npt.NDArray[np.int64]
bandpowers: npt.NDArray[np.float64]
window: sacc.BandpowerWindow


@dataclass(frozen=True, kw_only=True)
class SaccGalaxyWindowedFixture:
"""Windowed SACC data with named expected distributions and spectra.

:param sacc_data: SACC data used by production extraction and construction.
:param distributions: Redshift distributions keyed by tracer name.
:param spectra: Windowed spectra keyed by ordered tracer names and data type.
"""

sacc_data: sacc.Sacc
distributions: dict[str, SampledRedshiftDistribution]
spectra: dict[tuple[TracerNames, str], WindowedAngularPowerSpectrum]


class NumCosmoCosmologyFixture(TypedDict):
Expand Down
Loading
Loading