def doc_theme():
return theme_minimal() + theme(
panel_grid_minor=element_line(color="gray", linetype="--"),
)Using Firecrown to Generate Two-Point Statistics for LSST
Version ?env:FIRECROWN_VERSION
Purpose of this Document
In the tutorial redshift distributions we illustrate the process of using Firecrown to create redshift distributions based on specified parameters describing the distributions. Additionally, in serializable redshift distributions we demonstrate how to generate redshift distributions using serializable objects. This document outlines how to use InferredGalaxyZDist objects to derive the two-point statistics pertinent to the Large Synoptic Survey Telescope (LSST), employing the redshift distribution outlined in the LSST Science Requirements Document (SRD).
This tutorial focuses on generating two-point statistics from scratch using metadata. For loading existing data from SACC files and applying scale cuts, see: - Two-Point Factory Basics - Loading SACC Data - Scale Cuts and Filtering
Two-point statistics
Two-point statistics are widely used in cosmological analyses. They provide a statistical summary of the distribution, in either real or harmonic space, of galaxies and the matter density field, or of other observables. In Firecrown, two-point statistics are represented by the TwoPoint class, in the module firecrown.likelihood.
Note: This tutorial demonstrates generating two-point statistics from scratch. If you have existing data in a SACC file, see Loading SACC Data for how to extract and use it.
Generating the LSST Year 1 Redshift Distribution Bins
Our initial step involves generating all photometric redshift bins necessary for the LSST year 1 redshift distribution. This process is detailed here in the tutorial on redshift distributions. In the serialization tutorial, we demonstrate how to get the LSST SRD redshift distributions. Here we will use the LSST SRD year 1 redshift distribution to generate the two-point statistics.
from firecrown.generators import (
LSST_Y1_LENS_HARMONIC_BIN_COLLECTION,
LSST_Y1_SOURCE_HARMONIC_BIN_COLLECTION,
)
count_bins = LSST_Y1_LENS_HARMONIC_BIN_COLLECTION.generate()
shear_bins = LSST_Y1_SOURCE_HARMONIC_BIN_COLLECTION.generate()
all_y1_bins = count_bins + shear_binsGenerating the Two-Point Metadata
Within firecrown.metadata_functions, a suite of functions is available to calculate all possible two-point statistic metadata corresponding to a designated set of bins. The data classes themselves live in firecrown.metadata_types. For instance, demonstrated below is the computation of all feasible metadata tailored to the LSST year 1 redshift distribution:
import numpy as np
from firecrown.metadata_functions import make_all_photoz_bin_combinations
from firecrown.metadata_types import TwoPointHarmonic
all_two_point_xy = make_all_photoz_bin_combinations(all_y1_bins)
ells = np.unique(np.geomspace(2, 2000, 128).astype(int))
all_two_point_cells = [TwoPointHarmonic(XY=xy, ells=ells) for xy in all_two_point_xy]Filtering with Bin Pair Selectors: If you only need specific subsets of correlations (e.g., only auto-correlations, only source measurements, or custom combinations), you can use BinPairSelector objects to filter the pairs during generation. See Bin Pair Selectors for details on how to control which bin pairs are included.
The code above generates the following table of two-point statistic metadata:
Code
import pandas as pd
from IPython.display import Markdown
two_point_names = [
(Cells.XY.x.bin_name, Cells.XY.y.bin_name, Cells.get_sacc_name())
for Cells in all_two_point_cells
]
df = pd.DataFrame(two_point_names, columns=["bin-x", "bin-y", "SACC data-type"])
Markdown(df.to_markdown())| bin-x | bin-y | SACC data-type | |
|---|---|---|---|
| 0 | lsst_y1_source0 | lsst_y1_source0 | galaxy_shear_cl_ee |
| 1 | lsst_y1_source0 | lsst_y1_source1 | galaxy_shear_cl_ee |
| 2 | lsst_y1_source0 | lsst_y1_source2 | galaxy_shear_cl_ee |
| 3 | lsst_y1_source0 | lsst_y1_source3 | galaxy_shear_cl_ee |
| 4 | lsst_y1_source0 | lsst_y1_source4 | galaxy_shear_cl_ee |
| 5 | lsst_y1_source1 | lsst_y1_source1 | galaxy_shear_cl_ee |
| 6 | lsst_y1_source1 | lsst_y1_source2 | galaxy_shear_cl_ee |
| 7 | lsst_y1_source1 | lsst_y1_source3 | galaxy_shear_cl_ee |
| 8 | lsst_y1_source1 | lsst_y1_source4 | galaxy_shear_cl_ee |
| 9 | lsst_y1_source2 | lsst_y1_source2 | galaxy_shear_cl_ee |
| 10 | lsst_y1_source2 | lsst_y1_source3 | galaxy_shear_cl_ee |
| 11 | lsst_y1_source2 | lsst_y1_source4 | galaxy_shear_cl_ee |
| 12 | lsst_y1_source3 | lsst_y1_source3 | galaxy_shear_cl_ee |
| 13 | lsst_y1_source3 | lsst_y1_source4 | galaxy_shear_cl_ee |
| 14 | lsst_y1_source4 | lsst_y1_source4 | galaxy_shear_cl_ee |
| 15 | lsst_y1_source0 | lsst_y1_lens0 | galaxy_shearDensity_cl_e |
| 16 | lsst_y1_source0 | lsst_y1_lens1 | galaxy_shearDensity_cl_e |
| 17 | lsst_y1_source0 | lsst_y1_lens2 | galaxy_shearDensity_cl_e |
| 18 | lsst_y1_source0 | lsst_y1_lens3 | galaxy_shearDensity_cl_e |
| 19 | lsst_y1_source0 | lsst_y1_lens4 | galaxy_shearDensity_cl_e |
| 20 | lsst_y1_source1 | lsst_y1_lens0 | galaxy_shearDensity_cl_e |
| 21 | lsst_y1_source1 | lsst_y1_lens1 | galaxy_shearDensity_cl_e |
| 22 | lsst_y1_source1 | lsst_y1_lens2 | galaxy_shearDensity_cl_e |
| 23 | lsst_y1_source1 | lsst_y1_lens3 | galaxy_shearDensity_cl_e |
| 24 | lsst_y1_source1 | lsst_y1_lens4 | galaxy_shearDensity_cl_e |
| 25 | lsst_y1_source2 | lsst_y1_lens0 | galaxy_shearDensity_cl_e |
| 26 | lsst_y1_source2 | lsst_y1_lens1 | galaxy_shearDensity_cl_e |
| 27 | lsst_y1_source2 | lsst_y1_lens2 | galaxy_shearDensity_cl_e |
| 28 | lsst_y1_source2 | lsst_y1_lens3 | galaxy_shearDensity_cl_e |
| 29 | lsst_y1_source2 | lsst_y1_lens4 | galaxy_shearDensity_cl_e |
| 30 | lsst_y1_source3 | lsst_y1_lens0 | galaxy_shearDensity_cl_e |
| 31 | lsst_y1_source3 | lsst_y1_lens1 | galaxy_shearDensity_cl_e |
| 32 | lsst_y1_source3 | lsst_y1_lens2 | galaxy_shearDensity_cl_e |
| 33 | lsst_y1_source3 | lsst_y1_lens3 | galaxy_shearDensity_cl_e |
| 34 | lsst_y1_source3 | lsst_y1_lens4 | galaxy_shearDensity_cl_e |
| 35 | lsst_y1_source4 | lsst_y1_lens0 | galaxy_shearDensity_cl_e |
| 36 | lsst_y1_source4 | lsst_y1_lens1 | galaxy_shearDensity_cl_e |
| 37 | lsst_y1_source4 | lsst_y1_lens2 | galaxy_shearDensity_cl_e |
| 38 | lsst_y1_source4 | lsst_y1_lens3 | galaxy_shearDensity_cl_e |
| 39 | lsst_y1_source4 | lsst_y1_lens4 | galaxy_shearDensity_cl_e |
| 40 | lsst_y1_lens0 | lsst_y1_lens0 | galaxy_density_cl |
| 41 | lsst_y1_lens0 | lsst_y1_lens1 | galaxy_density_cl |
| 42 | lsst_y1_lens0 | lsst_y1_lens2 | galaxy_density_cl |
| 43 | lsst_y1_lens0 | lsst_y1_lens3 | galaxy_density_cl |
| 44 | lsst_y1_lens0 | lsst_y1_lens4 | galaxy_density_cl |
| 45 | lsst_y1_lens1 | lsst_y1_lens1 | galaxy_density_cl |
| 46 | lsst_y1_lens1 | lsst_y1_lens2 | galaxy_density_cl |
| 47 | lsst_y1_lens1 | lsst_y1_lens3 | galaxy_density_cl |
| 48 | lsst_y1_lens1 | lsst_y1_lens4 | galaxy_density_cl |
| 49 | lsst_y1_lens2 | lsst_y1_lens2 | galaxy_density_cl |
| 50 | lsst_y1_lens2 | lsst_y1_lens3 | galaxy_density_cl |
| 51 | lsst_y1_lens2 | lsst_y1_lens4 | galaxy_density_cl |
| 52 | lsst_y1_lens3 | lsst_y1_lens3 | galaxy_density_cl |
| 53 | lsst_y1_lens3 | lsst_y1_lens4 | galaxy_density_cl |
| 54 | lsst_y1_lens4 | lsst_y1_lens4 | galaxy_density_cl |
Summary
You now have metadata for all LSST Year 1 two-point statistics. The key outputs are:
all_y1_bins: Redshift distributions for all lens and source binsall_two_point_xy: All possible tracer pair combinationsall_two_point_cells: Complete harmonic-space metadata (layouts)
These metadata objects contain no observational data—they describe the structure of measurements you want to analyze.
Next Steps
To construct TwoPoint objects from this metadata and compute predictions:
- Bin Pair Selectors: Learn how to filter which bin pair combinations are included (optional)
- Factory Basics: Learn how to use
TwoPointFactoryto build TwoPoint objects, define systematics, and compute theory vectors - Scale Cuts: Apply physical scale cuts to restrict analysis ranges
- Integration Methods: Control computation accuracy and speed