Skip to content

Conversation

@vitenti
Copy link
Collaborator

@vitenti vitenti commented Nov 10, 2025

Description

Introduce Firecrown CLI Application

This PR introduces a new command-line interface (CLI) for Firecrown that simplifies the creation and management of cosmological analysis examples. The firecrown command provides a unified interface to generate complete analysis pipelines with data files and framework-specific configurations.

Key Features

Example Generator System

  • Generate complete analysis examples with a single command
  • Automatically creates SACC data files, likelihood factories, and framework configurations
  • Supports three frameworks: CosmoSIS, Cobaya, and NumCosmo
  • Includes three example types:
    • cosmic_shear: Weak lensing cosmic shear with synthetic galaxy data
    • sn_srd: Supernova SRD analysis with LSST DESC synthetic data
    • des_y1_3x2pt: DES Y1 3x2pt analysis (cosmic shear + galaxy-galaxy lensing + galaxy clustering)

Multiple Factory Implementations
The DES Y1 3x2pt example supports multiple factory types:

  • Python-based: standard, pt (perturbation theory), tatt (TATT IA model), hmia (halo model IA), pk_modifier (baryonic effects)
  • YAML-based: yaml_default, yaml_pure_ccl, yaml_mu_sigma (modified gravity)

Flexible Configuration

  • Optional cosmology computation (can exclude CAMB/CLASS when external tools provide cosmology)
  • Support for both A_s and σ₈ amplitude parameters
  • Configurable cosmology requirements: none, background, linear, or nonlinear
  • Absolute or relative file paths in generated configurations

Architecture

  • Clean separation between analysis infrastructure (firecrown/app/analysis/) and examples (firecrown/app/examples/)
  • Extensible builder pattern for adding new examples
  • Framework-agnostic configuration generators with specialized implementations
  • Rich console output with progress tracking

Usage Example

# Generate DES Y1 3x2pt example for CosmoSIS
firecrown examples des_y1_3x2pt ./output --target-framework cosmosis

# Generate with YAML factory and no cosmology computation
firecrown examples des_y1_3x2pt ./output --factory-type yaml_default --no-require-cosmology

# Generate cosmic shear example for Cobaya
firecrown examples cosmic_shear ./output --target-framework cobaya

Implementation Highlights

  • Phased workflow: SACC generation → Factory creation → Build parameters → Model parameters → Framework config
  • Template system: Reusable likelihood factory templates extracted from existing examples
  • Type-safe: Full type annotations with Python 3.11+ features

This CLI makes it significantly easier for users to get started with Firecrown and provides a standardized way to generate analysis configurations across different statistical frameworks.

Type of change

Please delete the bullet items below that do not apply to this pull request.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

The following checklist will make sure that you are following the code style and
guidelines of the project as described in the
contributing page.

  • I have run bash pre-commit-check and fixed any issues
  • I have added tests that prove my fix is effective or that my feature works
  • I have made corresponding changes to the documentation
  • I have 100% test coverage for my changes (please check this after the CI system has verified the coverage)

@vitenti vitenti self-assigned this Nov 10, 2025
@arthurmloureiro
Copy link
Member

@vitenti it would be amazing if we could provide a likelihood experiment (in .py for example) and then also be able to build the config files for numcosmo/cosmosis/cobaya... is this a possibility ?

@arthurmloureiro
Copy link
Member

Two other suggestions for the examples:

  • Initialise the values in the cosmosis/cobaya/numcosmo centered around the ccl.CosmologyVanillaLCDM() cosmology
  • allow the user to specify outputs in .fits or hdf5 sacc

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (e66f7bb) to head (880de55).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master     #583     +/-   ##
=========================================
  Coverage   100.0%   100.0%             
=========================================
  Files         122      150     +28     
  Lines        6964     8782   +1818     
  Branches      819     1012    +193     
=========================================
+ Hits         6964     8782   +1818     
Files with missing lines Coverage Δ
firecrown/app/__init__.py 100.0% <100.0%> (ø)
firecrown/app/analysis/__init__.py 100.0% <100.0%> (ø)
firecrown/app/analysis/_analysis_builder.py 100.0% <100.0%> (ø)
firecrown/app/analysis/_cobaya.py 100.0% <100.0%> (ø)
firecrown/app/analysis/_config_generator.py 100.0% <100.0%> (ø)
firecrown/app/analysis/_cosmosis.py 100.0% <100.0%> (ø)
firecrown/app/analysis/_download.py 100.0% <100.0%> (ø)
firecrown/app/analysis/_numcosmo.py 100.0% <100.0%> (ø)
firecrown/app/analysis/_types.py 100.0% <100.0%> (ø)
firecrown/app/cosmology.py 100.0% <100.0%> (ø)
... and 30 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vitenti
Copy link
Collaborator Author

vitenti commented Nov 24, 2025

Two other suggestions for the examples:

* Initialise the values in the cosmosis/cobaya/numcosmo centered around the ccl.CosmologyVanillaLCDM() cosmology

* allow the user to specify outputs in .fits or hdf5 sacc

Thanks for the suggestions, these were just implemented.

@vitenti
Copy link
Collaborator Author

vitenti commented Nov 24, 2025

@vitenti it would be amazing if we could provide a likelihood experiment (in .py for example) and then also be able to build the config files for numcosmo/cosmosis/cobaya... is this a possibility ?

Yes, this PR introduces all the necessary infrastructure for that. However, since this one is already big, I think it is better to leave this feature to a next PR.

@vitenti vitenti marked this pull request as ready for review December 10, 2025 14:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 88 out of 100 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vitenti vitenti merged commit 1e4ce05 into master Dec 10, 2025
13 checks passed
@vitenti vitenti deleted the firecrown_app branch December 10, 2025 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants