firecrown.likelihood.two_point

Two point statistic support.

Classes

TwoPoint

A statistic that represents the correlation between two measurements.

Functions

calculate_angular_cl(ells, pk_name, scale0, scale1, ...)

Calculate the angular mulitpole moments.

read_reals(theory, sacc_data)

Read and return theta and xi.

read_ell_cells(theory, sacc_data)

Read and return ell and Cell.

Module Contents

firecrown.likelihood.two_point.calculate_angular_cl(ells, pk_name, scale0, scale1, tools, tracer0, tracer1)[source]

Calculate the angular mulitpole moments.

Parameters:
Returns:

The angular mulitpole moments.

class firecrown.likelihood.two_point.TwoPoint(sacc_data_type, source0, source1, *, ell_for_xi=None, ell_or_theta=None, ell_or_theta_min=None, ell_or_theta_max=None, tracers=None)[source]

Bases: firecrown.likelihood.statistic.Statistic

Inheritance diagram of firecrown.likelihood.two_point.TwoPoint

A statistic that represents the correlation between two measurements.

If the same source is used twice in the same TwoPoint object, this produces an autocorrelation.

For example, shear correlation function, galaxy-shear correlation function, etc.

Parameters

sacc_data_typestr

The kind of two-point statistic. This must be a valid SACC data type that maps to one of the CCL correlation function kinds or a power spectra. Possible options are

  • galaxy_density_cl : maps to ‘cl’ (a CCL angular power spectrum)

  • galaxy_density_xi : maps to ‘gg’ (a CCL angular position corr. function)

  • galaxy_shearDensity_cl_e : maps to ‘cl’ (a CCL angular power spectrum)

  • galaxy_shearDensity_xi_t : maps to ‘gl’ (a CCL angular cross-correlation between position and shear)

  • galaxy_shear_cl_ee : maps to ‘cl’ (a CCL angular power spectrum)

  • galaxy_shear_xi_minus : maps to ‘l-’ (a CCL angular shear corr. function xi-)

  • galaxy_shear_xi_plus : maps to ‘l+’ (a CCL angular shear corr. function xi-)

  • cmbGalaxy_convergenceDensity_xi : maps to ‘gg’ (a CCL angular position corr. function)

  • cmbGalaxy_convergenceShear_xi_t : maps to ‘gl’ (a CCL angular cross- correlation between position and shear)

source0Source

The first sources needed to compute this statistic.

source1Source

The second sources needed to compute this statistic.

ell_or_thetadict, optional

A dictionary of options for generating the ell or theta values at which to compute the statistics. This option can be used to have firecrown generate data without the corresponding 2pt data in the input SACC file. The options are:

  • minimun : float - The start of the binning.

  • maximun : float - The end of the binning.

  • n : int - The number of bins. Note that the edges of the bins start at min and end at max. The actual bin locations will be at the (possibly geometric) midpoint of the bin.

  • binning : str, optional - Pass ‘log’ to get logarithmic spaced bins and ‘lin’ to get linearly spaced bins. Default is ‘log’.

ell_or_theta_minfloat, optional

The minimum ell or theta value to keep. This minimum is applied after the ell or theta values are read and/or generated.

ell_or_theta_maxfloat, optional

The maximum ell or theta value to keep. This maximum is applied after the ell or theta values are read and/or generated.

ell_for_xidict, optional

A dictionary of options for making the ell values at which to compute Cls for use in real-space integrations. The possible keys are:

  • minimum : int, optional - The minimum angular wavenumber to use for real-space integrations. Default is 2.

  • midpoint : int, optional - The midpoint angular wavenumber to use for real-space integrations. The angular wavenumber samples are linearly spaced at integers between minimum and midpoint. Default is 50.

  • maximum : int, optional - The maximum angular wavenumber to use for real-space integrations. The angular wavenumber samples are logarithmically spaced between midpoint and maximum. Default is 60,000.

  • n_log : int, optional - The number of logarithmically spaced angular wavenumber samples between mid and max. Default is 200.

Attributes

ccl_kindstr

The CCL correlation function kind or ‘cl’ for power spectra corresponding to the SACC data type.

sacc_tracers2-tuple of str

A tuple of the SACC tracer names for this 2pt statistic. Set after a call to read.

property sacc_data_type: str

Backwards compatibility for sacc_data_type.

Return type:

str

property source0: firecrown.likelihood.source.Source

Backwards compatibility for source0.

Return type:

firecrown.likelihood.source.Source

property source1: firecrown.likelihood.source.Source

Backwards compatibility for source1.

Return type:

firecrown.likelihood.source.Source

property window: None | numpy.typing.NDArray[numpy.float64]

Backwards compatibility for window.

Return type:

None | numpy.typing.NDArray[numpy.float64]

property sacc_tracers: None | firecrown.metadata_types.TracerNames

Backwards compatibility for sacc_tracers.

Return type:

None | firecrown.metadata_types.TracerNames

property ells: None | numpy.typing.NDArray[numpy.int64]

Backwards compatibility for ells.

Return type:

None | numpy.typing.NDArray[numpy.int64]

property thetas: None | numpy.typing.NDArray[numpy.float64]

Backwards compatibility for thetas.

Return type:

None | numpy.typing.NDArray[numpy.float64]

property ells_for_xi: None | numpy.typing.NDArray[numpy.int64]

Backwards compatibility for ells_for_xi.

Return type:

None | numpy.typing.NDArray[numpy.int64]

property cells

Backwards compatibility for cells.

theory
classmethod from_metadata_index(metadata_indices, wl_factory=None, nc_factory=None)[source]

Create an UpdatableCollection of TwoPoint statistics.

This constructor creates an UpdatableCollection of TwoPoint statistics from a list of TwoPointCellsIndex or TwoPointXiThetaIndex metadata index objects. The purpose of this constructor is to create a TwoPoint statistic from metadata index, which requires a follow-up call to read to read the data and metadata from the SACC object.

Parameters:
Returns:

An UpdatableCollection of TwoPoint statistics.

Return type:

firecrown.updatable.UpdatableCollection[TwoPoint]

classmethod from_metadata(metadata_seq, wl_factory=None, nc_factory=None)[source]

Create an UpdatableCollection of TwoPoint statistics from metadata.

This constructor creates an UpdatableCollection of TwoPoint statistics from a list of TwoPointHarmonic or TwoPointReal metadata objects. The metadata objects are used to initialize the TwoPoint statistics. The sources are initialized using the factories provided.

Note that TwoPoint created with this constructor are ready to be used, but contain no data.

Parameters:
Returns:

An UpdatableCollection of TwoPoint statistics.

Return type:

firecrown.updatable.UpdatableCollection[TwoPoint]

classmethod create_two_point(measurement, wl_factory, nc_factory)[source]

Create a single TwoPoint statistic from a measurement.

Parameters:
Return type:

TwoPoint

classmethod from_measurement(measurements, wl_factory=None, nc_factory=None)[source]

Create an UpdatableCollection of TwoPoint statistics from measurements.

This constructor creates an UpdatableCollection of TwoPoint statistics from a list of TwoPointMeasurement objects. The measurements are used to initialize the TwoPoint statistics. The sources are initialized using the factories provided.

Note that TwoPoint created with this constructor are ready to be used and contain data.

Parameters:
Returns:

An UpdatableCollection of TwoPoint statistics.

Return type:

firecrown.updatable.UpdatableCollection[TwoPoint]

read(sacc_data)[source]

Read the data for this statistic from the SACC file.

Parameters:

sacc_data (sacc.Sacc) – The data in the sacc format.

Return type:

None

read_real_space(sacc_data)[source]

Read the data for this statistic from the SACC file.

Parameters:

sacc_data (sacc.Sacc)

read_harmonic_space(sacc_data)[source]

Read the data for this statistic from the SACC file.

Parameters:

sacc_data (sacc.Sacc)

Return type:

None

read_harmonic_spectrum_data(ells_cells_indices, sacc_data)[source]

Read all the data for this statistic from the SACC file.

Parameters:
  • ells_cells_indices (None | tuple[numpy.typing.NDArray[numpy.int64], numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.int64]]) – The ells, the cells and the indices of the data in the SACC file.

  • sacc_data (sacc.Sacc) – The data in the sacc format.

Returns:

The ells, the cells and the indices, and window function if there is one.

Return type:

tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.int64], numpy.typing.NDArray[numpy.int64] | None, numpy.typing.NDArray[numpy.float64] | None]

get_data_vector()[source]

Return this statistic’s data vector.

Return type:

firecrown.data_types.DataVector

set_data_vector(value)[source]

Set this statistic’s data vector.

Parameters:

value (firecrown.data_types.DataVector)

Return type:

None

compute_theory_vector_real_space(tools)[source]

Compute a two-point statistic in real space.

This method computes the two-point statistic in real space. It first computes the Cl’s in harmonic space and then translates them to real space using CCL.

Parameters:

tools (firecrown.modeling_tools.ModelingTools)

Return type:

firecrown.data_types.TheoryVector

compute_theory_vector_harmonic_space(tools)[source]

Compute a two-point statistic in harmonic space.

This method computes the two-point statistic in harmonic space. It computes either the Cl’s at the ells provided by the SACC file or the ells required for the window function.

Parameters:

tools (firecrown.modeling_tools.ModelingTools)

Return type:

firecrown.data_types.TheoryVector

compute_cells(ells, scale0, scale1, tools, tracers0, tracers1)[source]

Compute the power spectrum for the given ells and tracers.

Parameters:
Return type:

numpy.typing.NDArray[numpy.float64]

compute_cells_interpolated(ells, ells_for_interpolation, scale0, scale1, tools, tracers0, tracers1)[source]

Compute the interpolated power spectrum for the given ells and tracers.

Parameters:
  • ells (numpy.typing.NDArray[numpy.int64]) – The angular wavenumbers at which to compute the power spectrum.

  • ells_for_interpolation (numpy.typing.NDArray[numpy.int64]) – The angular wavenumbers at which the power spectrum is computed for interpolation.

  • scale0 (float) – The scale factor for the first tracer.

  • scale1 (float) – The scale factor for the second tracer.

  • tools (firecrown.modeling_tools.ModelingTools) – The modeling tools to use.

  • tracers0 (Sequence[firecrown.likelihood.source.Tracer]) – The first tracers to use.

  • tracers1 (Sequence[firecrown.likelihood.source.Tracer]) – The second tracers to use.

Return type:

numpy.typing.NDArray[numpy.float64]

Compute the power spectrum for the given ells and tracers and interpolate the result to the ells provided.

Returns:

The interpolated power spectrum.

Parameters:
Return type:

numpy.typing.NDArray[numpy.float64]

Parameters:
firecrown.likelihood.two_point.read_reals(theory, sacc_data)[source]

Read and return theta and xi.

Parameters:
Returns:

The theta and xi values.

Return type:

None | tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.int64]]

firecrown.likelihood.two_point.read_ell_cells(theory, sacc_data)[source]

Read and return ell and Cell.

Parameters:
Returns:

The ell and Cell values.

Return type:

None | tuple[numpy.typing.NDArray[numpy.int64], numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.int64]]