firecrown.metadata_types

This module deals with metadata types.

This module contains metadata types definitions.

Attributes

TRACER_NAMES_TOTAL

Measurement

ALL_MEASUREMENTS

ALL_MEASUREMENT_TYPES

HARMONIC_ONLY_MEASUREMENTS

REAL_ONLY_MEASUREMENTS

EXACT_MATCH_MEASUREMENTS

INCOMPATIBLE_MEASUREMENTS

LENS_REGEX

SOURCE_REGEX

CMB_REGEX

GALAXY_SOURCE_TYPES

GALAXY_LENS_TYPES

CMB_TYPES

MEASURED_TYPE_STRING_MAP

Classes

TracerNames

The names of the two tracers in the sacc file.

TypeSource

String to specify the subtype or origin of a measurement source.

Galaxies

This enumeration type for galaxy measurements.

CMB

This enumeration type for CMB measurements.

Clusters

This enumeration type for cluster measurements.

InferredGalaxyZDist

The class used to store the redshift resolution data for a sacc file.

TwoPointXY

Class defining a two-point correlation pair of redshift resolutions.

TwoPointHarmonic

Class defining the metadata for an harmonic-space two-point measurement.

TwoPointReal

Class defining the metadata for a real-space two-point measurement.

TwoPointCorrelationSpace

This class defines the two-point correlation space.

TwoPointFilterMethod

Defines methods for filtering two-point measurements.

Functions

compare_enums(a, b)

Define a comparison function for the Measurement enumeration.

measurement_is_compatible(a, b)

Check if two Measurement are compatible.

measurement_supports_real(x)

Return True if x supports real-space calculations.

measurement_supports_harmonic(x)

Return True if x supports harmonic-space calculations.

measurement_is_compatible_real(a, b)

Check if two Measurement are compatible for real-space calculations.

measurement_is_compatible_harmonic(a, b)

Check if two Measurement are compatible for harmonic-space calculations.

type_to_sacc_string_real(x, y)

Return the final SACC string used to denote the real-space correlation.

type_to_sacc_string_harmonic(x, y)

Return the final SACC string used to denote the harmonic-space correlation.

Module Contents

class firecrown.metadata_types.TracerNames[source]

Bases: firecrown.utils.YAMLSerializable

Inheritance diagram of firecrown.metadata_types.TracerNames

The names of the two tracers in the sacc file.

name1: str
name2: str
__getitem__(item)[source]

Get the name of the tracer at the given index.

__iter__()[source]

Iterate through the data members.

This is to allow automatic unpacking.

firecrown.metadata_types.TRACER_NAMES_TOTAL
class firecrown.metadata_types.TypeSource[source]

Bases: str

Inheritance diagram of firecrown.metadata_types.TypeSource

String to specify the subtype or origin of a measurement source.

This helps distinguish between different categories of sources within the same measurement type. For example:

  • In galaxy counts, this could differentiate between red and blue galaxies.

  • In CMB lensing, it could identify data from different instruments like Planck or SPT.

DEFAULT: TypeSource
classmethod __get_pydantic_core_schema__(_source_type, _handler)[source]

Get the Pydantic core schema for the TypeSource class.

Parameters:
  • _source_type (Any)

  • _handler (Any)

Return type:

pydantic_core.core_schema.CoreSchema

class firecrown.metadata_types.Galaxies[source]

Bases: firecrown.utils.YAMLSerializable, str, enum.Enum

Inheritance diagram of firecrown.metadata_types.Galaxies

This enumeration type for galaxy measurements.

It provides identifiers for the different types of galaxy-related types of measurement.

SACC has some notion of supporting other types, but incomplete implementation. When support for more types is added to SACC this enumeration needs to be updated.

SHEAR_E
SHEAR_T
PART_OF_XI_MINUS
SHEAR_MINUS
PART_OF_XI_PLUS
SHEAR_PLUS
COUNTS
is_shear()[source]

Return True if the measurement is a shear measurement, False otherwise.

Returns:

True if the measurement is a shear measurement, False otherwise

Return type:

bool

sacc_type_name()[source]

Return the lower-case form of the main measurement type.

This is the first part of the SACC string used to denote a correlation between measurements of this type.

Return type:

str

sacc_measurement_name()[source]

Return the lower-case form of the specific measurement type.

This is the second part of the SACC string used to denote the specific measurement type.

Return type:

str

polarization()[source]

Return the SACC polarization code.

This is the third part of the SACC string used to denote the specific measurement type.

Return type:

str

__lt__(other)[source]

Define a comparison function for the Galaxy Measurement enumeration.

__eq__(other)[source]

Define an equality test for Galaxy Measurement enumeration.

__ne__(other)[source]

Negation of __eq__.

__hash__()[source]

Define a hash function that uses both type and value information.

Return type:

int

class firecrown.metadata_types.CMB[source]

Bases: firecrown.utils.YAMLSerializable, str, enum.Enum

Inheritance diagram of firecrown.metadata_types.CMB

This enumeration type for CMB measurements.

It provides identifiers for the different types of CMB-related types of measurement.

SACC has some notion of supporting other types, but incomplete implementation. When support for more types is added to SACC this enumeration needs to be updated.

CONVERGENCE
sacc_type_name()[source]

Return the lower-case form of the main measurement type.

This is the first part of the SACC string used to denote a correlation between measurements of this type.

Return type:

str

sacc_measurement_name()[source]

Return the lower-case form of the specific measurement type.

This is the second part of the SACC string used to denote the specific measurement type.

Return type:

str

polarization()[source]

Return the SACC polarization code.

This is the third part of the SACC string used to denote the specific measurement type.

Return type:

str

__lt__(other)[source]

Define a comparison function for the CMBMeasurement enumeration.

__eq__(other)[source]

Define an equality test for CMBMeasurement enumeration.

__ne__(other)[source]

Negation of __eq__.

__hash__()[source]

Define a hash function that uses both type and value information.

Return type:

int

class firecrown.metadata_types.Clusters[source]

Bases: firecrown.utils.YAMLSerializable, str, enum.Enum

Inheritance diagram of firecrown.metadata_types.Clusters

This enumeration type for cluster measurements.

It provides identifiers for the different types of cluster-related types of measurement.

SACC has some notion of supporting other types, but incomplete implementation. When support for more types is added to SACC this enumeration needs to be updated.

COUNTS
sacc_type_name()[source]

Return the lower-case form of the main measurement type.

This is the first part of the SACC string used to denote a correlation between measurements of this type.

Return type:

str

sacc_measurement_name()[source]

Return the lower-case form of the specific measurement type.

This is the second part of the SACC string used to denote the specific measurement type.

Return type:

str

polarization()[source]

Return the SACC polarization code.

This is the third part of the SACC string used to denote the specific measurement type.

Return type:

str

__lt__(other)[source]

Define a comparison function for the ClusterMeasurement enumeration.

__eq__(other)[source]

Define an equality test for ClusterMeasurement enumeration.

__ne__(other)[source]

Negation of __eq__.

__hash__()[source]

Define a hash function that uses both type and value information.

Return type:

int

firecrown.metadata_types.Measurement
firecrown.metadata_types.ALL_MEASUREMENTS: list[Measurement]
firecrown.metadata_types.ALL_MEASUREMENT_TYPES
firecrown.metadata_types.HARMONIC_ONLY_MEASUREMENTS
firecrown.metadata_types.REAL_ONLY_MEASUREMENTS
firecrown.metadata_types.EXACT_MATCH_MEASUREMENTS
firecrown.metadata_types.INCOMPATIBLE_MEASUREMENTS
firecrown.metadata_types.LENS_REGEX
firecrown.metadata_types.SOURCE_REGEX
firecrown.metadata_types.CMB_REGEX
firecrown.metadata_types.GALAXY_SOURCE_TYPES
firecrown.metadata_types.GALAXY_LENS_TYPES
firecrown.metadata_types.CMB_TYPES
firecrown.metadata_types.compare_enums(a, b)[source]

Define a comparison function for the Measurement enumeration.

Return -1 if a comes before b, 0 if they are the same, and +1 if b comes before a.

Parameters:
  • a (Measurement)

  • b (Measurement)

Return type:

int

class firecrown.metadata_types.InferredGalaxyZDist[source]

Bases: firecrown.utils.YAMLSerializable

Inheritance diagram of firecrown.metadata_types.InferredGalaxyZDist

The class used to store the redshift resolution data for a sacc file.

The sacc file is a complicated set of tracers (bins) and surveys. This class is used to store the redshift resolution data for a single photometric bin.

bin_name: str
z: numpy.ndarray
dndz: numpy.ndarray
measurements: set[Measurement]
type_source: TypeSource
__post_init__()[source]

Validate the redshift resolution data.

  • Make sure the z and dndz arrays have the same shape;

  • The measurement must be of type Measurement.

  • The bin_name should not be empty.

Return type:

None

__eq__(other)[source]

Equality test for InferredGalaxyZDist.

Two InferredGalaxyZDist are equal if they have equal bin_name, z, dndz, and measurement.

firecrown.metadata_types.measurement_is_compatible(a, b)[source]

Check if two Measurement are compatible.

Two Measurement are compatible if they can be correlated in a two-point function.

Parameters:
  • a (Measurement)

  • b (Measurement)

Return type:

bool

firecrown.metadata_types.measurement_supports_real(x)[source]

Return True if x supports real-space calculations.

Parameters:

x (Measurement)

Return type:

bool

firecrown.metadata_types.measurement_supports_harmonic(x)[source]

Return True if x supports harmonic-space calculations.

Parameters:

x (Measurement)

Return type:

bool

firecrown.metadata_types.measurement_is_compatible_real(a, b)[source]

Check if two Measurement are compatible for real-space calculations.

Two Measurement are compatible if they can be correlated in a real-space two-point function.

Parameters:
  • a (Measurement)

  • b (Measurement)

Return type:

bool

firecrown.metadata_types.measurement_is_compatible_harmonic(a, b)[source]

Check if two Measurement are compatible for harmonic-space calculations.

Two Measurement are compatible if they can be correlated in a harmonic-space two-point function.

Parameters:
  • a (Measurement)

  • b (Measurement)

Return type:

bool

firecrown.metadata_types.type_to_sacc_string_real(x, y)[source]

Return the final SACC string used to denote the real-space correlation.

The SACC string used to denote the real-space correlation type between measurements of x and y.

Parameters:
  • x (Measurement)

  • y (Measurement)

Return type:

str

firecrown.metadata_types.type_to_sacc_string_harmonic(x, y)[source]

Return the final SACC string used to denote the harmonic-space correlation.

the SACC string used to denote the harmonic-space correlation type between measurements of x and y.

Parameters:
  • x (Measurement)

  • y (Measurement)

Return type:

str

firecrown.metadata_types.MEASURED_TYPE_STRING_MAP: dict[str, tuple[Measurement, Measurement]]
class firecrown.metadata_types.TwoPointXY[source]

Bases: firecrown.utils.YAMLSerializable

Inheritance diagram of firecrown.metadata_types.TwoPointXY

Class defining a two-point correlation pair of redshift resolutions.

It is used to store the two redshift resolutions for the two bins being correlated.

x: InferredGalaxyZDist
y: InferredGalaxyZDist
x_measurement: Measurement
y_measurement: Measurement
__post_init__()[source]

Make sure the two redshift resolutions are compatible.

Return type:

None

__eq__(other)[source]

Equality test for TwoPointXY objects.

Return type:

bool

__str__()[source]

Return a string representation of the TwoPointXY object.

Return type:

str

get_tracer_names()[source]

Return the TracerNames object for the TwoPointXY object.

Return type:

TracerNames

class firecrown.metadata_types.TwoPointHarmonic[source]

Bases: firecrown.utils.YAMLSerializable

Inheritance diagram of firecrown.metadata_types.TwoPointHarmonic

Class defining the metadata for an harmonic-space two-point measurement.

The class used to store the metadata for a (spherical) harmonic-space two-point function measured on a sphere.

This includes the two redshift resolutions (one for each binned quantity) and the array of (integer) l’s at which the two-point function which has this metadata were calculated.

XY: TwoPointXY
ells: numpy.typing.NDArray[numpy.int64]
window: None | numpy.typing.NDArray[numpy.float64] = None
window_ells: None | numpy.typing.NDArray[numpy.float64] = None
__post_init__()[source]

Validate the TwoPointHarmonic data.

Make sure the ells are a 1D array and X and Y are compatible with harmonic-space calculations.

Return type:

None

__eq__(other)[source]

Equality test for TwoPointHarmonic objects.

Return type:

bool

__str__()[source]

Return a string representation of the TwoPointHarmonic object.

Return type:

str

get_sacc_name()[source]

Return the SACC name for the two-point function.

Return type:

str

n_observations()[source]

Return the number of observations described by these metadata.

Returns:

The number of observations.

Return type:

int

class firecrown.metadata_types.TwoPointReal[source]

Bases: firecrown.utils.YAMLSerializable

Inheritance diagram of firecrown.metadata_types.TwoPointReal

Class defining the metadata for a real-space two-point measurement.

The class used to store the metadata for a real-space two-point function measured on a sphere.

This includes the two redshift resolutions (one for each binned quantity) and the a array of (floating point) theta (angle) values at which the two-point function which has this metadata were calculated.

XY: TwoPointXY
thetas: numpy.typing.NDArray[numpy.float64]
__post_init__()[source]

Validate the TwoPointReal data.

Make sure the window is

__str__()[source]

Return a string representation of the TwoPointReal object.

Return type:

str

get_sacc_name()[source]

Return the SACC name for the two-point function.

Return type:

str

__eq__(other)[source]

Equality test for TwoPointReal objects.

Return type:

bool

n_observations()[source]

Return the number of observations described by these metadata.

Returns:

The number of observations.

Return type:

int

class firecrown.metadata_types.TwoPointCorrelationSpace[source]

Bases: firecrown.utils.YAMLSerializable, enum.StrEnum

Inheritance diagram of firecrown.metadata_types.TwoPointCorrelationSpace

This class defines the two-point correlation space.

The two-point correlation space can be either real or harmonic. The real space corresponds measurements in terms of angular separation, while the harmonic space corresponds to measurements in terms of spherical harmonics decomposition.

REAL
HARMONIC
classmethod __get_pydantic_core_schema__(_source_type, _handler)[source]

Get the Pydantic core schema for the TypeSource class.

Parameters:
  • _source_type (Any)

  • _handler (Any)

Return type:

pydantic_core.core_schema.CoreSchema

class firecrown.metadata_types.TwoPointFilterMethod[source]

Bases: firecrown.utils.YAMLSerializable, enum.StrEnum

Inheritance diagram of firecrown.metadata_types.TwoPointFilterMethod

Defines methods for filtering two-point measurements.

When filtering a two-point measurement with an associated window, the filter is applied to the window first. The user must then choose how to proceed:

  • If filtering by LABEL, the window_ells labels are used to determine whether the observation should be kept.

  • If filtering by SUPPORT, the full ell support must lie within the allowed range.

  • If filtering by SUPPORT_95, only the 95% support region must lie within the range.

In all cases, filters define an interval of ells to retain.

LABEL
SUPPORT
SUPPORT_95
classmethod __get_pydantic_core_schema__(_source_type, _handler)[source]

Get the Pydantic core schema for the TypeSource class.

Parameters:
  • _source_type (Any)

  • _handler (Any)

Return type:

pydantic_core.core_schema.CoreSchema