Skip to content
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
53cb93c
Add CMBLensing tracer and tests
vitenti Dec 16, 2025
e6ee7b7
Finish tracer generalization: commit remaining metadata and likelihoo…
vitenti Dec 16, 2025
806eee2
Rename tracer module to _two_point_tracers and update imports
vitenti Dec 16, 2025
2d5d735
WIP
vitenti Jan 23, 2026
5da496e
Renaming to TomographicBin.
vitenti Feb 9, 2026
34f6f6f
Using new location for firecrown.parameters.
vitenti Feb 9, 2026
ffcfe10
Ignoring unrelated SACC warning.
vitenti Feb 9, 2026
5389cad
Using new location for firecrow.parameters.
vitenti Feb 9, 2026
e192c8f
Filtering expected warnings.
vitenti Feb 9, 2026
740576b
Finished adaptation of tests to CMBLensing.
vitenti Feb 9, 2026
02db8d9
Generalize selectors to work on field pairs.
vitenti Feb 9, 2026
e6858ef
Fixing typo in test decorator.
vitenti Feb 10, 2026
38efdb3
Renamed tutorial to tomographic_bin.qmd.
vitenti Feb 10, 2026
b4211b0
Testing passing wrong type to CMBLensing.
vitenti Feb 10, 2026
9718adb
Merge branch 'master' into tracer_generalization
marcpaterno Feb 20, 2026
4891578
Merge branch 'master' into tracer_generalization
vitenti May 20, 2026
5eeef05
Merge branch 'master' into tracer_generalization
vitenti Jul 7, 2026
7781004
Merge branch 'master' into tracer_generalization
vitenti Jul 23, 2026
afa3fd7
Replacing InferredGalaxyZDist by TomographicBin.
vitenti Jul 23, 2026
ebaa040
Renaming variables, function and methods to match the new names.
vitenti Jul 23, 2026
340d685
Adding extraction routines to get CMBLensing from sacc.
vitenti Jul 24, 2026
8c773b5
Adding support for controlling z-max in framework configurations.
vitenti Jul 24, 2026
f2d8bbc
Adding example generator for cmb lensing + shear.
vitenti Jul 24, 2026
538fb0e
Merge remote-tracking branch 'origin/master' into tracer_generalization
vitenti Jul 24, 2026
a262b38
Merge branch 'master' into tracer_generalization
marcpaterno Jul 25, 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
2 changes: 1 addition & 1 deletion docs/sacc_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ For more information about SACC:
For Firecrown-specific questions:

- :py:func:`firecrown.metadata_functions.extract_all_measured_types`
- :py:func:`firecrown.metadata_functions.extract_all_tracers_inferred_galaxy_zdists`
- :py:func:`firecrown.metadata_functions.extract_all_tracers_tomographic_bins`
- :py:class:`firecrown.app.sacc.View` - CLI view command
- :py:class:`firecrown.app.sacc.Transform` - CLI transform command
- Firecrown GitHub Issues and Discussions
Expand Down
13 changes: 13 additions & 0 deletions firecrown/app/analysis/_analysis_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def add_row(label, value):
self.use_absolute_path,
self.cosmology_analysis_spec(),
self.required_cosmology(),
self.required_distance_max_z(),
)
self._proceed_generation(generator)

Expand Down Expand Up @@ -244,6 +245,18 @@ def required_cosmology(self) -> FrameworkCosmology:
:return: True if the analysis requires a cosmology, False otherwise
"""

def required_distance_max_z(self) -> float:
"""Return the maximum redshift the background/distance splines must reach.

Frameworks compute background quantities (comoving distance, H(z)) only
out to this redshift. Analyses using a tracer that needs values beyond
the default (e.g. CMB lensing, with its source at z~1100) must override
this method to return a large enough value.

:return: Maximum redshift for background/distance computations
"""
return 4.0

def cosmology_analysis_spec(self) -> CCLCosmologySpec:
"""Return the cosmology analysis specification.

Expand Down
4 changes: 4 additions & 0 deletions firecrown/app/analysis/_cobaya.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def create_config(
cosmo_spec: CCLCosmologySpec,
use_absolute_path: bool = False,
required_cosmology: FrameworkCosmology = FrameworkCosmology.NONLINEAR,
distance_max_z: float = 4.0,
) -> dict[str, Any]:
"""Create Cobaya configuration dictionary.

Expand All @@ -68,6 +69,7 @@ def create_config(
:param cosmo_spec: Cosmology specification
:param use_absolute_path: Use absolute paths in configuration
:param required_cosmology: Level of cosmology computation
:param distance_max_z: Maximum redshift for background/distance splines
:return: Configuration dictionary ready for YAML serialization
"""
factory_source_str = get_path_str(factory_source, use_absolute_path)
Expand Down Expand Up @@ -101,6 +103,7 @@ def create_config(

if use_cosmology:
config["likelihood"][likelihood_name]["input_style"] = "CAMB"
config["likelihood"][likelihood_name]["distance_max_z"] = distance_max_z

config.update(
{
Expand Down Expand Up @@ -255,6 +258,7 @@ def write_config(self) -> None:
likelihood_name=likelihood_name,
cosmo_spec=self.cosmo_spec,
required_cosmology=self.required_cosmology,
distance_max_z=self.distance_max_z,
)
add_models(cfg, self.models)
write_config(cfg, cobaya_yaml)
5 changes: 5 additions & 0 deletions firecrown/app/analysis/_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get_generator(
use_absolute_path: bool,
cosmo_spec: CCLCosmologySpec,
required_cosmology: FrameworkCosmology = FrameworkCosmology.NONLINEAR,
distance_max_z: float = 4.0,
) -> ConfigGenerator:
"""Factory function to create framework-specific configuration generator.

Expand All @@ -38,6 +39,7 @@ def get_generator(
:param cosmo_spec: Cosmology specification with parameters and priors
:param required_cosmology: Level of cosmology computation
(none/background/linear/nonlinear)
:param distance_max_z: Maximum redshift for background/distance splines
:return: Initialized configuration generator ready for component addition
:raises ValueError: If framework is not supported
"""
Expand All @@ -50,6 +52,7 @@ def get_generator(
use_absolute_path=use_absolute_path,
cosmo_spec=cosmo_spec,
required_cosmology=required_cosmology,
distance_max_z=distance_max_z,
)
case Frameworks.COBAYA:
return CobayaConfigGenerator(
Expand All @@ -58,6 +61,7 @@ def get_generator(
use_absolute_path=use_absolute_path,
cosmo_spec=cosmo_spec,
required_cosmology=required_cosmology,
distance_max_z=distance_max_z,
)
case Frameworks.NUMCOSMO:
return NumCosmoConfigGenerator(
Expand All @@ -66,6 +70,7 @@ def get_generator(
use_absolute_path=use_absolute_path,
cosmo_spec=cosmo_spec,
required_cosmology=required_cosmology,
distance_max_z=distance_max_z,
)
case _:
raise ValueError(f"Unsupported framework: {framework}")
21 changes: 19 additions & 2 deletions firecrown/app/analysis/_cosmosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,19 @@ def add_comment_block(
config.set(section, comment_line)


#: Default upper bound of the matter-power/background redshift grid. Analyses
#: needing background quantities beyond this (e.g. CMB lensing) get the extra
#: reach through CAMB's own log-spaced background extension (n_logz/zmax_logz)
#: instead of widening this grid, since that would coarsen the P(k,z) sampling
#: over the whole range for no benefit.
_DEFAULT_ZMAX = 4.0


def _add_cosmology_modules(
cfg: configparser.ConfigParser,
required_cosmology: FrameworkCosmology,
cosmo_spec: CCLCosmologySpec,
distance_max_z: float = _DEFAULT_ZMAX,
) -> None:
"""Add CAMB and consistency modules to pipeline configuration."""
cfg["consistency"] = {
Expand All @@ -101,10 +110,15 @@ def _add_cosmology_modules(
"mode": "power",
"feedback": "0",
"zmin": "0.0",
"zmax": "4.0",
"zmax": str(_DEFAULT_ZMAX),
"nz": "100",
"kmax": "50.0",
"nk": "1000",
**(
{"n_logz": "50", "zmax_logz": str(distance_max_z)}
if distance_max_z > _DEFAULT_ZMAX
else {}
),
**(
cosmo_spec.extra_parameters.get_dict()
if cosmo_spec.extra_parameters
Expand Down Expand Up @@ -147,6 +161,7 @@ def create_config(
*,
use_absolute_path: bool = True,
required_cosmology: FrameworkCosmology = FrameworkCosmology.NONLINEAR,
distance_max_z: float = _DEFAULT_ZMAX,
) -> configparser.ConfigParser:
"""Create CosmoSIS pipeline configuration (main INI file).

Expand All @@ -162,6 +177,7 @@ def create_config(
:param cosmo_spec: Cosmology specification
:param use_absolute_path: Use absolute paths in configuration
:param required_cosmology: Level of cosmology computation
:param distance_max_z: Maximum redshift for background/distance splines
:return: Configured ConfigParser ready to write
"""
cfg = configparser.ConfigParser(
Expand Down Expand Up @@ -196,7 +212,7 @@ def create_config(
cfg["pipeline"]["priors"] = get_path_str(priors_path, use_absolute_path)

if use_cosmology:
_add_cosmology_modules(cfg, required_cosmology, cosmo_spec)
_add_cosmology_modules(cfg, required_cosmology, cosmo_spec, distance_max_z)

_add_firecrown_likelihood(
cfg, get_path_str(factory_source, use_absolute_path), build_parameters
Expand Down Expand Up @@ -447,6 +463,7 @@ def write_config(self) -> None:
cosmo_spec=self.cosmo_spec,
use_absolute_path=self.use_absolute_path,
required_cosmology=self.required_cosmology,
distance_max_z=self.distance_max_z,
)
add_models(cfg, self.models)

Expand Down
1 change: 1 addition & 0 deletions firecrown/app/analysis/_numcosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ def write_config(self) -> None:
self.use_absolute_path,
self.required_cosmology,
self.prefix,
distance_max_z=self.distance_max_z,
)
ctx = mp.get_context("spawn")
proc = ctx.Process(target=_write_config_worker, args=(config_options,))
Expand Down
1 change: 1 addition & 0 deletions firecrown/app/analysis/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ class ConfigGenerator(ABC):
use_absolute_path: bool
cosmo_spec: CCLCosmologySpec
required_cosmology: FrameworkCosmology = FrameworkCosmology.NONLINEAR
distance_max_z: float = 4.0

sacc_path: Path | None = None
factory_source: str | Path | None = None
Expand Down
3 changes: 3 additions & 0 deletions firecrown/app/examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@
"""

from ..analysis import AnalysisBuilder
from ._cmb_cross import ExampleCMBCross
from ._cosmic_shear import ExampleCosmicShear
from ._des_y1_3x2pt import DESY1FactoryType, ExampleDESY13x2pt
from ._sn_srd import ExampleSupernovaSRD

__all__ = [
"EXAMPLES_LIST",
"ExampleCosmicShear",
"ExampleCMBCross",
"ExampleSupernovaSRD",
"ExampleDESY13x2pt",
"DESY1FactoryType",
]

EXAMPLES_LIST: dict[str, type[AnalysisBuilder]] = {
"cosmic_shear": ExampleCosmicShear,
"cmb_cross": ExampleCMBCross,
"sn_srd": ExampleSupernovaSRD,
"des_y1_3x2pt": ExampleDESY13x2pt,
}
Expand Down
Loading