firecrown.likelihood.gauss_family.statistic.two_point.TwoPoint#

class firecrown.likelihood.gauss_family.statistic.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)[source]#

Bases: Statistic

A two-point statistic.

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

Parameters:
  • sacc_data_type (str) –

    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)

  • source0 (Source) – The first sources needed to compute this statistic.

  • source1 (Source) – The second sources needed to compute this statistic.

  • ell_or_theta (dict, 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_min (float, 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_max (float, 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_xi (dict, 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.

Variables:
  • ccl_kind (str) – The CCL correlation function kind or ‘cl’ for power spectra corresponding to the SACC data type.

  • sacc_tracers (2-tuple of str) – A tuple of the SACC tracer names for this 2pt statistic. Set after a call to read.

  • ell_or_theta (npt.NDArray[np.float64]) – The final array of ell/theta values for the statistic. Set after compute is called.

  • measured_statistic (npt.NDArray[np.float64]) – The measured value for the statistic.

  • predicted_statistic (npt.NDArray[np.float64]) – The final prediction for the statistic. Set after compute is called.

Public Methods:

__init__(sacc_data_type, source0, source1, *)

Updatable initialization.

from_metadata_cells(metadata[, wl_factory, ...])

Create a TwoPoint statistic from a TwoPointCells metadata object.

read_ell_cells(sacc_data_type, sacc_data, ...)

Read and return ell and Cell.

read_theta_xis(sacc_data_type, sacc_data, ...)

Read and return theta and xi.

read(sacc_data)

Read the data for this statistic from the SACC file.

read_real_space(sacc_data)

Read the data for this statistic from the SACC file.

read_harmonic_space(sacc_data)

Read the data for this statistic from the SACC file.

initialize_sources(sacc_data)

Initialize this TwoPoint's sources, and return the tracer names.

get_data_vector()

Return this statistic's data vector.

compute_theory_vector_real_space(tools)

Compute a two-point statistic in real space.

compute_theory_vector_harmonic_space(tools)

Compute a two-point statistic in harmonic space.

compute_cells(ells, scale0, scale1, tools, ...)

Compute the power spectrum for the given ells and tracers.

calculate_pk(pk_name, tools, tracer0, tracer1)

Return the power spectrum named by pk_name.

Inherited from Statistic

__init__([parameter_prefix])

Updatable initialization.

read(_)

Read the data for this statistic and mark it as ready for use.

get_data_vector()

Gets the statistic data vector.

compute_theory_vector(tools)

Compute a statistic from sources, applying any systematics.

get_theory_vector()

Returns the last computed theory vector.

Inherited from Updatable

__init__([parameter_prefix])

Updatable initialization.

__setattr__(key, value)

Set the attribute named key to the supplied value.

set_parameter(key, value)

Sets the parameter to the given value.

set_internal_parameter(key, value)

Assure this InternalParameter has not already been set, and then set it.

set_sampler_parameter(value)

Assure this SamplerParameter has not already been set, and then set it.

update(params)

Update self by calling to prepare for the next MCMC sample.

is_updated()

Determine if the object has been updated.

reset()

Reset the updatable.

required_parameters()

Returns a RequiredParameters object.

get_derived_parameters()

Returns a collection of derived parameters.

Private Methods:

_compute_theory_vector(tools)

Compute a two-point statistic from sources.

Inherited from Statistic

_reset()

Reset this statistic.

_compute_theory_vector(tools)

Compute a statistic from sources, concrete implementation.

Inherited from Updatable

_update(params)

Method for auxiliary updates to be made to an updatable.

_reset()

Abstract method implemented by all concrete classes to update self.

_required_parameters()

Return a RequiredParameters object containing the information for this class.

_get_derived_parameters()

Returns the derived parameters of an implementation.


_compute_theory_vector(tools)[source]#

Compute a two-point statistic from sources.

Parameters:

tools (ModelingTools) –

Return type:

TheoryVector

calculate_pk(pk_name, tools, tracer0, tracer1)[source]#

Return the power spectrum named by pk_name.

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

Compute the power spectrum for the given ells and tracers.

Parameters:
  • ells (ndarray[Any, dtype[int64]]) –

  • scale0 (float) –

  • scale1 (float) –

  • tools (ModelingTools) –

  • tracers0 (Sequence[Tracer]) –

  • tracers1 (Sequence[Tracer]) –

Return type:

ndarray[Any, dtype[float64]]

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 (ModelingTools) –

Return type:

TheoryVector

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 (ModelingTools) –

Return type:

TheoryVector

classmethod from_metadata_cells(metadata, wl_factory=None, nc_factory=None)[source]#

Create a TwoPoint statistic from a TwoPointCells metadata object.

Parameters:
Return type:

UpdatableCollection[TwoPoint]

get_data_vector()[source]#

Return this statistic’s data vector.

Return type:

DataVector

initialize_sources(sacc_data)[source]#

Initialize this TwoPoint’s sources, and return the tracer names.

Parameters:

sacc_data (Sacc) –

Return type:

TracerNames

read(sacc_data)[source]#

Read the data for this statistic from the SACC file.

Parameters:

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

Return type:

None

read_ell_cells(sacc_data_type, sacc_data, tracers)[source]#

Read and return ell and Cell.

Parameters:
  • sacc_data_type (str) –

  • sacc_data (Sacc) –

  • tracers (TracerNames) –

Return type:

None | tuple[ndarray[Any, dtype[int64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[int64]]]

read_harmonic_space(sacc_data)[source]#

Read the data for this statistic from the SACC file.

Parameters:

sacc_data (Sacc) –

read_real_space(sacc_data)[source]#

Read the data for this statistic from the SACC file.

Parameters:

sacc_data (Sacc) –

read_theta_xis(sacc_data_type, sacc_data, tracers)[source]#

Read and return theta and xi.

Parameters:
  • sacc_data_type (str) –

  • sacc_data (Sacc) –

  • tracers (TracerNames) –

Return type:

None | tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[int64]]]