firecrown.likelihood.two_point ============================== .. py:module:: firecrown.likelihood.two_point .. autoapi-nested-parse:: Two point statistic support. Classes ------- .. autoapisummary:: firecrown.likelihood.two_point.TwoPoint Functions --------- .. autoapisummary:: firecrown.likelihood.two_point.calculate_angular_cl firecrown.likelihood.two_point.read_reals firecrown.likelihood.two_point.read_ell_cells Module Contents --------------- .. py:function:: calculate_angular_cl(ells, pk_name, scale0, scale1, tools, tracer0, tracer1) Calculate the angular mulitpole moments. :param ells: The angular wavenumbers at which to compute the power spectrum. :param pk_name: The name of the power spectrum to return. :param scale0: The scale factor for the first tracer. :param scale1: The scale factor for the second tracer. :param tools: The modeling tools to use. :param tracer0: The first tracer to use. :param tracer1: The second tracer to use. :return: The angular mulitpole moments. .. py:class:: 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) Bases: :py:obj:`firecrown.likelihood.statistic.Statistic` .. autoapi-inheritance-diagram:: firecrown.likelihood.two_point.TwoPoint :parts: 1 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_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. Attributes ---------- 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. .. py:property:: sacc_data_type :type: str Backwards compatibility for sacc_data_type. .. py:property:: source0 :type: firecrown.likelihood.source.Source Backwards compatibility for source0. .. py:property:: source1 :type: firecrown.likelihood.source.Source Backwards compatibility for source1. .. py:property:: window :type: None | numpy.typing.NDArray[numpy.float64] Backwards compatibility for window. .. py:property:: sacc_tracers :type: None | firecrown.metadata_types.TracerNames Backwards compatibility for sacc_tracers. .. py:property:: ells :type: None | numpy.typing.NDArray[numpy.int64] Backwards compatibility for ells. .. py:property:: thetas :type: None | numpy.typing.NDArray[numpy.float64] Backwards compatibility for thetas. .. py:property:: ells_for_xi :type: None | numpy.typing.NDArray[numpy.int64] Backwards compatibility for ells_for_xi. .. py:property:: cells Backwards compatibility for cells. .. py:attribute:: theory .. py:method:: from_metadata_index(metadata_indices, wl_factory = None, nc_factory = None) :classmethod: 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. :param metadata_index: The metadata index objects to initialize the TwoPoint statistics. :param wl_factory: The weak lensing factory to use. :param nc_factory: The number counts factory to use. :return: An UpdatableCollection of TwoPoint statistics. .. py:method:: from_metadata(metadata_seq, wl_factory = None, nc_factory = None) :classmethod: 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. :param metadata_seq: The metadata objects to initialize the TwoPoint statistics. :param wl_factory: The weak lensing factory to use. :param nc_factory: The number counts factory to use. :return: An UpdatableCollection of TwoPoint statistics. .. py:method:: create_two_point(measurement, wl_factory, nc_factory) :classmethod: Create a single TwoPoint statistic from a measurement. :param measurement: The measurement object to initialize the TwoPoint statistic. .. py:method:: from_measurement(measurements, wl_factory = None, nc_factory = None) :classmethod: 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. :param measurements: The measurements objects to initialize the TwoPoint statistics. :param wl_factory: The weak lensing factory to use. :param nc_factory: The number counts factory to use. :return: An UpdatableCollection of TwoPoint statistics. .. py:method:: read(sacc_data) Read the data for this statistic from the SACC file. :param sacc_data: The data in the sacc format. .. py:method:: read_real_space(sacc_data) Read the data for this statistic from the SACC file. .. py:method:: read_harmonic_space(sacc_data) Read the data for this statistic from the SACC file. .. py:method:: read_harmonic_spectrum_data(ells_cells_indices, sacc_data) Read all the data for this statistic from the SACC file. :param ells_cells_indices: The ells, the cells and the indices of the data in the SACC file. :param sacc_data: The data in the sacc format. :return: The ells, the cells and the indices, and window function if there is one. .. py:method:: get_data_vector() Return this statistic's data vector. .. py:method:: set_data_vector(value) Set this statistic's data vector. .. py:method:: compute_theory_vector_real_space(tools) 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. .. py:method:: compute_theory_vector_harmonic_space(tools) 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. .. py:method:: compute_cells(ells, scale0, scale1, tools, tracers0, tracers1) Compute the power spectrum for the given ells and tracers. .. py:method:: compute_cells_interpolated(ells, ells_for_interpolation, scale0, scale1, tools, tracers0, tracers1) Compute the interpolated power spectrum for the given ells and tracers. :param ells: The angular wavenumbers at which to compute the power spectrum. :param ells_for_interpolation: The angular wavenumbers at which the power spectrum is computed for interpolation. :param scale0: The scale factor for the first tracer. :param scale1: The scale factor for the second tracer. :param tools: The modeling tools to use. :param tracers0: The first tracers to use. :param tracers1: The second tracers to use. Compute the power spectrum for the given ells and tracers and interpolate the result to the ells provided. :return: The interpolated power spectrum. .. py:function:: read_reals(theory, sacc_data) Read and return theta and xi. :param theory: The theory, carrying data type and tracers. :param sacc_data: The SACC data object to be read. :return: The theta and xi values. .. py:function:: read_ell_cells(theory, sacc_data) Read and return ell and Cell. :param theory: The theory, carrying data type and tracers. :param sacc_data: The SACC data object to be read. :return: The ell and Cell values.