firecrown.data_functions ======================== .. py:module:: firecrown.data_functions .. autoapi-nested-parse:: This module deals with two-point data functions. It contains functions to manipulate two-point data objects. Attributes ---------- .. autoapisummary:: firecrown.data_functions.BinSpec Classes ------- .. autoapisummary:: firecrown.data_functions.TwoPointTracerSpec firecrown.data_functions.TwoPointBinFilter firecrown.data_functions.TwoPointBinFilterCollection Functions --------- .. autoapisummary:: firecrown.data_functions.cov_hash firecrown.data_functions.extract_all_harmonic_data firecrown.data_functions.maybe_enforce_window firecrown.data_functions.extract_all_real_data firecrown.data_functions.ensure_no_overlaps firecrown.data_functions.check_consistence firecrown.data_functions.check_two_point_consistence_harmonic firecrown.data_functions.check_two_point_consistence_real firecrown.data_functions.make_interval_from_list firecrown.data_functions.bin_spec_from_metadata Module Contents --------------- .. py:function:: cov_hash(sacc_data) Return a hash of the covariance matrix. :param sacc_data: The SACC data object containing the covariance matrix. :return: The hash of the covariance matrix. .. py:function:: extract_all_harmonic_data(sacc_data, allowed_data_type = None, include_maybe_types=False) Extract the two-point function metadata and data from a sacc file. .. py:function:: maybe_enforce_window(ells, indices, sacc_data) Possibly enforce a window function on the given ells. :param ells: The original ell values. :param indices: The indices of the data points in the SACC object. :param sacc_data: The SACC object containing the data. :return: A tuple containing the possibly replaced ells and the window weights. .. py:function:: extract_all_real_data(sacc_data, allowed_data_type = None, include_maybe_types=False) Extract the two-point function metadata and data from a sacc file. .. py:function:: ensure_no_overlaps(measurement, index_set, index_sets, other_measurements) Check if the indices of the measurement-space two-point functions overlap. Raises a ValueError if they do. :param measurement: The TwoPointHarmonic to check. :param index_set: The indices of the current TwoPointHarmonic. :param index_sets: The indices of the other TwoPointHarmonics. :param other_measurements: The other TwoPointHarmonics. .. py:function:: check_consistence(measurements, is_type_func, type_name) Check the indices of the two-point functions. Make sure the indices of the two-point functions are consistent. :param measurements: The measurements to check. :param is_type_func: A function to verify the type of the measurements. :param type_name: The type of the measurements. .. py:function:: check_two_point_consistence_harmonic(two_point_harmonics) Check the indices of the harmonic-space two-point functions. .. py:function:: check_two_point_consistence_real(two_point_reals) Check the indices of the real-space two-point functions. .. py:class:: TwoPointTracerSpec(/, **data) Bases: :py:obj:`pydantic.BaseModel` .. autoapi-inheritance-diagram:: firecrown.data_functions.TwoPointTracerSpec :parts: 1 Class defining a tracer bin specification. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: name :type: Annotated[str, Field(description='The name of the tracer bin.')] .. py:attribute:: measurement :type: Annotated[firecrown.metadata_types.Measurement, Field(description='The measurement of the tracer bin.'), BeforeValidator(make_measurement)] .. py:method:: serialize_measurement(value) :classmethod: Serialize the Measurement. .. py:function:: make_interval_from_list(values) Create an interval from a list of values. .. py:class:: TwoPointBinFilter(/, **data) Bases: :py:obj:`pydantic.BaseModel` .. autoapi-inheritance-diagram:: firecrown.data_functions.TwoPointBinFilter :parts: 1 Class defining a filter for a bin. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: spec :type: Annotated[list[TwoPointTracerSpec], Field(description='The two-point bin specification.')] .. py:attribute:: interval :type: Annotated[tuple[float, float], BeforeValidator(make_interval_from_list), Field(description='The range of the bin to filter.')] .. py:method:: check_bin_filter() Check the bin filter. .. py:method:: serialize_interval(value) :classmethod: Serialize the Measurement. .. py:method:: from_args(name1, measurement1, name2, measurement2, lower, upper) :classmethod: Create a TwoPointBinFilter from the arguments. .. py:method:: from_args_auto(name, measurement, lower, upper) :classmethod: Create a TwoPointBinFilter from the arguments. .. py:data:: BinSpec .. py:function:: bin_spec_from_metadata(metadata) Return the bin spec from the metadata. .. py:class:: TwoPointBinFilterCollection(/, **data) Bases: :py:obj:`pydantic.BaseModel` .. autoapi-inheritance-diagram:: firecrown.data_functions.TwoPointBinFilterCollection :parts: 1 Class defining a collection of bin filters. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: require_filter_for_all :type: bool :value: None .. py:attribute:: allow_empty :type: bool :value: None .. py:attribute:: filters :type: list[TwoPointBinFilter] :value: None .. py:method:: check_bin_filters() Check the bin filters. .. py:property:: bin_filter_dict :type: dict[BinSpec, tuple[float, float]] Return the bin filter dictionary. .. py:method:: filter_match(tpm) Check if the TwoPointMeasurement matches the filter. .. py:method:: run_bin_filter(bin_filter, vals) Run the filter merge. .. py:method:: apply_filter_single(tpm) Apply the filter to a single TwoPointMeasurement. .. py:method:: __call__(tpms) Filter the two-point measurements.