firecrown.app.sacc ================== .. py:module:: firecrown.app.sacc .. autoapi-nested-parse:: SACC data visualization and analysis. Classes ------- .. autoapisummary:: firecrown.app.sacc.Transform firecrown.app.sacc.SaccFormat firecrown.app.sacc.Load firecrown.app.sacc.View Package Contents ---------------- .. py:class:: Transform Bases: :py:obj:`firecrown.app.sacc._load.Load` .. autoapi-inheritance-diagram:: firecrown.app.sacc.Transform :parts: 1 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: 1. Updating legacy SACC files to the current internal format 2. Converting between FITS and HDF5 formats 3. 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 ) :param sacc_file: Path to the input SACC file (inherited from Load) :type sacc_file: Path :param output: Output file path. If not specified, uses input filename with new extension if format changes. :type output: Path | None :param input_format: Force input format (overrides automatic detection). :type input_format: SaccFormat | None :param output_format: Output format. If not specified, uses input format. :type output_format: SaccFormat | None :param fix_ordering: Fix tracer ordering issues according to SACC naming conventions. :type fix_ordering: bool :param overwrite: Overwrite output file if it exists. :type overwrite: bool :param allow_mixed_types: Allow tracers with mixed measurement types (inherited from Load). :type allow_mixed_types: bool .. seealso:: :class:`View` - For inspecting SACC files and detecting issues ``docs/sacc_usage.rst`` - Comprehensive guide to SACC conventions .. py:attribute:: output :type: Annotated[pathlib.Path | None, typer.Option('--output', '-o', help='Output file path. If not specified, uses input filename with new extension (if format changes).')] :value: None .. py:attribute:: input_format :type: Annotated[SaccFormat | None, typer.Option('--input-format', '-f', case_sensitive=False, help='Force input format (overrides automatic detection).')] :value: None .. py:attribute:: output_format :type: Annotated[SaccFormat | None, typer.Option('--output-format', '-t', case_sensitive=False, help='Output format. If not specified, uses input format.')] :value: None .. py:attribute:: fix_ordering :type: Annotated[bool, typer.Option('--fix-ordering', help='Fix tracer ordering issues according to SACC naming conventions.')] :value: False .. py:attribute:: overwrite :type: Annotated[bool, typer.Option('--overwrite', help='Overwrite output file if it exists.')] :value: False .. py:method:: __post_init__() Transform the SACC file. .. py:method:: detect_format(filepath) :staticmethod: Detect file format from extension or file contents. .. py:class:: SaccFormat Bases: :py:obj:`str`, :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: firecrown.app.sacc.SaccFormat :parts: 1 Enum for SACC file formats. .. py:attribute:: FITS :value: 'fits' .. py:attribute:: HDF5 :value: 'hdf5' .. py:class:: Load Bases: :py:obj:`firecrown.app.logging.Logging` .. autoapi-inheritance-diagram:: firecrown.app.sacc.Load :parts: 1 Load and summarize a SACC file. .. py:attribute:: sacc_file :type: Annotated[pathlib.Path, typer.Argument(help='Path to the SACC file.', show_default=True)] .. py:attribute:: allow_mixed_types :type: Annotated[bool, typer.Option('--allow-mixed-types', help='Allow measurements with types from different sets (e.g., galaxy source + lens types).')] :value: False .. py:method:: __post_init__() Load and display metadata from the SACC file. .. py:class:: View Bases: :py:obj:`firecrown.app.sacc._load.Load` .. autoapi-inheritance-diagram:: firecrown.app.sacc.View :parts: 1 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) :param sacc_file: Path to the SACC file (inherited from Load) :type sacc_file: Path :param plot_covariance: Plot the covariance matrix with bin annotations. :type plot_covariance: bool :param check: Validate SACC file for naming convention compliance, tracer ordering, and other quality issues. :type check: bool :param allow_mixed_types: Allow tracers with mixed measurement types (inherited from Load). :type allow_mixed_types: bool .. seealso:: :class:`Transform` - For fixing detected issues ``docs/sacc_usage.rst`` - Comprehensive guide to SACC conventions .. py:attribute:: plot_covariance :type: Annotated[bool, typer.Option(help='Plot the covariance matrix.', show_default=True)] :value: False .. py:attribute:: check :type: Annotated[bool, typer.Option('--check', help='Validate SACC file: naming convention compliance, tracer ordering, metadata attributes, and other quality checks.')] :value: False .. py:method:: __post_init__() Display a summary of the SACC file.