firecrown.app.sacc
SACC data visualization and analysis.
Classes
Transform SACC files by updating internal representation and fixing issues. |
|
Enum for SACC file formats. |
|
Load and summarize a SACC file. |
|
Display comprehensive summary of SACC file contents and run quality checks. |
Package Contents
- class firecrown.app.sacc.Transform
Bases:
firecrown.app.sacc._load.Load
Transform SACC files by updating internal representation and fixing issues.
This command reads a SACC file and writes it back, which updates the internal representation of older SACC files to the current format. Optionally converts between FITS and HDF5 formats and fixes tracer ordering issues.
The primary use cases are:
Updating legacy SACC files to the current internal format
Converting between FITS and HDF5 formats
Fixing tracer ordering violations that don’t follow SACC naming conventions
CLI Usage:
# Update internal format (in-place) firecrown sacc transform data.sacc --overwrite # Fix tracer ordering issues firecrown sacc transform data.sacc --fix-ordering --overwrite # Convert FITS to HDF5 firecrown sacc transform data.fits --output-format hdf5 --output data.h5 # Fix ordering and convert format firecrown sacc transform data.fits --fix-ordering --output-format hdf5 -o data.h5
Python Usage:
from pathlib import Path from firecrown.app.sacc import Transform # Fix ordering and update file Transform( sacc_file=Path("data.sacc"), fix_ordering=True, overwrite=True )
- Parameters:
sacc_file (Path) – Path to the input SACC file (inherited from Load)
output (Path | None) – Output file path. If not specified, uses input filename with new extension if format changes.
input_format (SaccFormat | None) – Force input format (overrides automatic detection).
output_format (SaccFormat | None) – Output format. If not specified, uses input format.
fix_ordering (bool) – Fix tracer ordering issues according to SACC naming conventions.
overwrite (bool) – Overwrite output file if it exists.
allow_mixed_types (bool) – Allow tracers with mixed measurement types (inherited from Load).
See also
View- For inspecting SACC files and detecting issuesdocs/sacc_usage.rst- Comprehensive guide to SACC conventions- output: Annotated[pathlib.Path | None, typer.Option('--output', '-o', help='Output file path. If not specified, uses input filename with new extension (if format changes).')] = None
- input_format: Annotated[SaccFormat | None, typer.Option('--input-format', '-f', case_sensitive=False, help='Force input format (overrides automatic detection).')] = None
- output_format: Annotated[SaccFormat | None, typer.Option('--output-format', '-t', case_sensitive=False, help='Output format. If not specified, uses input format.')] = None
- fix_ordering: Annotated[bool, typer.Option('--fix-ordering', help='Fix tracer ordering issues according to SACC naming conventions.')] = False
- overwrite: Annotated[bool, typer.Option('--overwrite', help='Overwrite output file if it exists.')] = False
- __post_init__()
Transform the SACC file.
- Return type:
None
- static detect_format(filepath)
Detect file format from extension or file contents.
- Parameters:
filepath (pathlib.Path)
- Return type:
- class firecrown.app.sacc.SaccFormat
Bases:
str,enum.Enum
Enum for SACC file formats.
- FITS = 'fits'
- HDF5 = 'hdf5'
- class firecrown.app.sacc.Load
Bases:
firecrown.app.logging.Logging
Load and summarize a SACC file.
- sacc_file: Annotated[pathlib.Path, typer.Argument(help='Path to the SACC file.', show_default=True)]
- allow_mixed_types: Annotated[bool, typer.Option('--allow-mixed-types', help='Allow measurements with types from different sets (e.g., galaxy source + lens types).')] = False
- __post_init__()
Load and display metadata from the SACC file.
- Return type:
None
- class firecrown.app.sacc.View
Bases:
firecrown.app.sacc._load.Load
Display comprehensive summary of SACC file contents and run quality checks.
This command provides detailed inspection of SACC files including:
Tracers and their properties (redshift distributions, measurement types)
Harmonic and real-space bin combinations
Covariance matrix visualization (optional)
Quality checks for naming convention compliance (with –check flag)
The quality checks validate:
SACC naming convention compliance (tracer order matches data type string)
Tracer ordering according to canonical ordering (CMB < Clusters < Galaxies)
Metadata attributes consistency
CLI Usage:
# Basic inspection firecrown sacc view data.sacc # Run quality checks firecrown sacc view data.sacc --check # View with covariance plot firecrown sacc view data.sacc --plot-covariance # Full inspection with checks and plot firecrown sacc view data.sacc --check --plot-covariance
Python Usage:
from pathlib import Path from firecrown.app.sacc import View # Basic view View(sacc_file=Path("data.sacc")) # With quality checks View(sacc_file=Path("data.sacc"), check=True)
- Parameters:
sacc_file (Path) – Path to the SACC file (inherited from Load)
plot_covariance (bool) – Plot the covariance matrix with bin annotations.
check (bool) – Validate SACC file for naming convention compliance, tracer ordering, and other quality issues.
allow_mixed_types (bool) – Allow tracers with mixed measurement types (inherited from Load).
See also
Transform- For fixing detected issuesdocs/sacc_usage.rst- Comprehensive guide to SACC conventions- plot_covariance: Annotated[bool, typer.Option(help='Plot the covariance matrix.', show_default=True)] = False
- check: Annotated[bool, typer.Option('--check', help='Validate SACC file: naming convention compliance, tracer ordering, metadata attributes, and other quality checks.')] = False
- __post_init__()
Display a summary of the SACC file.
- Return type:
None