flip.data_vector
================

.. py:module:: flip.data_vector

.. autoapi-nested-parse::

   Init file of the flip.data_vector package.



Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/flip/data_vector/basic/index
   /autoapi/flip/data_vector/cosmo_utils/index
   /autoapi/flip/data_vector/galaxypv_vectors/index
   /autoapi/flip/data_vector/snia_vectors/index
   /autoapi/flip/data_vector/vector_utils/index


Attributes
----------

.. autoapisummary::

   flip.data_vector.jax_installed
   flip.data_vector.log


Classes
-------

.. autoapisummary::

   flip.data_vector.CovMatrix
   flip.data_vector.DataVector
   flip.data_vector.Dens
   flip.data_vector.DirectVel
   flip.data_vector.DensVel
   flip.data_vector.VelFromHDres
   flip.data_vector.FisherVelFromHDres
   flip.data_vector.FisherDens
   flip.data_vector.FisherDensVel


Functions
---------

.. autoapisummary::

   flip.data_vector.create_log


Package Contents
----------------

.. py:class:: CovMatrix(model_name=None, model_type=None, free_par=None, los_definition=None, covariance_dict=None, full_matrix=False, number_densities=None, number_velocities=None, redshift_dict=None, variant=None)

   .. py:attribute:: model_name
      :value: None



   .. py:attribute:: model_type
      :value: None



   .. py:attribute:: free_par
      :value: None



   .. py:attribute:: los_definition
      :value: None



   .. py:attribute:: covariance_dict
      :value: None



   .. py:attribute:: full_matrix
      :value: False



   .. py:attribute:: number_densities
      :value: None



   .. py:attribute:: number_velocities
      :value: None



   .. py:attribute:: redshift_dict
      :value: None



   .. py:attribute:: variant
      :value: None



   .. py:method:: init_from_flip(model_name, model_type, power_spectrum_dict, coordinates_density=None, coordinates_velocity=None, additional_parameters_values=None, los_definition='bisector', variant=None, **kwargs)
      :classmethod:


      The init_from_flip function is a function that initializes the covariance matrix from the flip code.
      It takes as input:
          - model_name: name of the model used to generate the covariance matrix (e.g., 'lai22')
          - model_type: type of data used to generate the covariance matrix (e.g., 'density' or 'velocity')
          - power_spectrum_dict: dictionary containing all information about power spectrum, including k and P(k) values, redshift, etc...
              It is generated by calling getPowerSpectrumDict() in

      :param cls: Indicate that the function is a class method
      :param model_name: Determine which model to use for the covariance matrix
      :param model_type: Determine the type of model to be used
      :param power_spectrum_dict: Pass the power spectrum of the model
      :param coordinates_density: Specify the coordinates of the density field
      :param coordinates_velocity: Define the velocity coordinates of the covariance matrix
      :param additional_parameters_values: Pass the values of additional parameters to the flip code
      :param \*\*kwargs: Pass a variable number of keyword arguments to the function

      :returns: A covariancematrix object



   .. py:method:: init_from_generator(model_name, model_type, power_spectrum_dict, coordinates_velocity=None, coordinates_density=None, additional_parameters_values=None, variant=None, **kwargs)
      :classmethod:


      The init_from_generator function is a helper function that allows the user to initialize
      a Covariance object from a generator. The init_from_generator function takes in as arguments:
          - cls: the class of the object being initialized (Covariance)
          - model_name: name of covariance model used to generate covariance matrix (e.g., 'lai22')
          - model_type: type of covariance matrix generated ('density' or 'velocity')
          - power spectrum dictionary containing keys for each redshift bin and values corresponding to
              power spectra at those red

      :param cls: Refer to the class itself
      :param model_name: Specify the type of model used to generate the covariance matrix
      :param model_type: Determine which model to use
      :param power_spectrum_dict: Pass the power spectrum to the generate_* functions
      :param coordinates_velocity: Generate the velocity covariance matrix
      :param coordinates_density: Generate the density field
      :param additional_parameters_values: Pass additional parameters to the generator function
      :param \*\*kwargs: Pass a variable number of keyword arguments to the function
      :param : Generate the covariance matrix from a given model

      :returns: An object of the class covariancematrix



   .. py:method:: init_from_file(filename, file_format)
      :classmethod:



   .. py:property:: type

      The type function is used to determine the type of covariance model that will be computed.
      The options are:
          - velocity: The covariance model is computed for velocity only.
          - density: The covariance model is computed for density only.
          - density_velocity: The covariance model is computed for both velocity and density, without cross-term (i.e., the covariances between velocities and densities are zero). This option should be used when computing a full 3D tomography in which we want to compute a separate 1D tomography along each axis (x, y, z

      :param self: Represent the instance of the class

      :returns: The type of the model


   .. py:property:: loaded

      The loaded function checks if the covariance matrix is loaded.

      :param self: Refer to the object itself

      :returns: A boolean


   .. py:method:: compute_covariance_sum(parameter_values_dict, vector_variance, use_jit=False)

      The compute_covariance_sum function computes the sum of all covariance matrices
          and adds the diagonal terms.

      :param self: Access the attributes of the class
      :param parameter_values_dict: Pass the values of the parameters
      :param : Compute the covariance matrix

      :returns: The sum of the covariance matrices with their respective coefficients



   .. py:method:: compute_covariance_sum_eigenvalues(parameter_values_dict, vector_variance)


   .. py:method:: compute_full_matrix()

      The compute_full_matrix function takes the covariance matrix and fills in all of the missing values.

      :param self: Bind the method to the object

      :returns: A dictionary with the full covariance matrices for each redshift bin



   .. py:method:: compute_flat_matrix()


   .. py:method:: write(filename, file_format)

      The write function writes the covariance matrix to a file.

      :param self: Represent the instance of the class
      :param filename: Specify the name of the file to be written
      :param : Specify the name of the file in which we want to save our covariance matrix

      :returns: Nothing



   .. py:method:: mask(mask_vel=None, mask_dens=None)


.. py:function:: create_log(log_level='info')

   The create_log function creates a logger object that can be used to log messages.
   The function takes one argument, the log_level, which is set to &quot;info&quot; by default.
   The function returns a Logger object with the specified logging level.

   :param log_level: Set the logging level

   :returns: A logger object


.. py:data:: jax_installed
   :value: True


.. py:data:: log

.. py:class:: DataVector(data, covariance_observation=None, **kwargs)

   Bases: :py:obj:`abc.ABC`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: _free_par
      :value: []



   .. py:attribute:: _kind
      :value: ''



   .. py:property:: conditional_free_par


   .. py:property:: free_par


   .. py:property:: kind


   .. py:property:: conditional_needed_keys


   .. py:property:: needed_keys


   .. py:property:: data


   .. py:method:: _give_data_and_variance(**kwargs)
      :abstractmethod:



   .. py:method:: _check_keys(data)


   .. py:attribute:: _covariance_observation
      :value: None



   .. py:attribute:: _data


   .. py:attribute:: _kwargs


   .. py:method:: __call__(*args)


   .. py:method:: mask(bool_mask)


   .. py:method:: compute_covariance(model, power_spectrum_dict, **kwargs)


.. py:class:: Dens(data, covariance_observation=None, **kwargs)

   Bases: :py:obj:`DataVector`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: _kind
      :value: 'density'



   .. py:attribute:: _needed_keys
      :value: ['density', 'density_error']



   .. py:method:: _give_data_and_variance(*args)


.. py:class:: DirectVel(data, covariance_observation=None)

   Bases: :py:obj:`DataVector`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: _kind
      :value: 'velocity'



   .. py:attribute:: _needed_keys
      :value: ['velocity']



   .. py:property:: conditional_needed_keys


   .. py:method:: _give_data_and_variance(*args)


.. py:class:: DensVel(density_vector, velocity_vector)

   Bases: :py:obj:`DataVector`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: _kind
      :value: 'cross'



   .. py:property:: needed_keys


   .. py:property:: free_par


   .. py:method:: _give_data_and_variance(*args)


   .. py:attribute:: densities


   .. py:attribute:: velocities


   .. py:method:: compute_covariance(model, power_spectrum_dict, **kwargs)


.. py:class:: VelFromHDres(data, covariance_observation=None, velocity_estimator='full', **kwargs)

   Bases: :py:obj:`DirectVel`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: _needed_keys
      :value: ['dmu', 'zobs']



   .. py:attribute:: _free_par
      :value: ['M_0']



   .. py:property:: conditional_needed_keys


   .. py:method:: _give_data_and_variance(parameter_values_dict)


   .. py:attribute:: _distance_modulus_difference_to_velocity


.. py:class:: FisherVelFromHDres(data, velocity_estimator='full', **kwargs)

   Bases: :py:obj:`DataVector`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: _kind
      :value: 'velocity'



   .. py:attribute:: _needed_keys
      :value: ['zobs', 'ra', 'dec', 'rcom_zobs']



   .. py:attribute:: _free_par
      :value: ['sigma_M']



   .. py:method:: _give_data_and_variance(parameter_values_dict)


   .. py:attribute:: _distance_modulus_difference_to_velocity


.. py:class:: FisherDens(data, velocity_estimator='full', **kwargs)

   Bases: :py:obj:`DataVector`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: _kind
      :value: 'density'



   .. py:attribute:: _needed_keys
      :value: ['ra', 'dec', 'rcom_zobs']



   .. py:attribute:: _free_par
      :value: []



   .. py:method:: _give_data_and_variance(parameter_values_dict)


.. py:class:: FisherDensVel(fisher_density, fisher_velocity)

   Bases: :py:obj:`DataVector`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: _kind
      :value: 'cross'



   .. py:method:: _give_data_and_variance(*args)


   .. py:attribute:: densities


   .. py:attribute:: velocities


   .. py:method:: compute_covariance(model, power_spectrum_dict, **kwargs)


