flip.data_vector

Contents

flip.data_vector#

Init file of the flip.data_vector package.

Submodules#

Attributes#

Classes#

CovMatrix

DataVector

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

Density

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

DirectVel

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

DensVel

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

VelFromHDres

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

FisherVelFromHDres

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

FisherDensity

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

FisherDensVel

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

Functions#

create_log([log_level])

The create_log function creates a logger object that can be used to log messages.

Package Contents#

class flip.data_vector.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)[source]#
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#
classmethod 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)[source]#

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

Parameters:
  • cls – Indicate that the function is a class method

  • model_name – Determine which model to use for the covariance matrix

  • model_type – Determine the type of model to be used

  • power_spectrum_dict – Pass the power spectrum of the model

  • coordinates_density – Specify the coordinates of the density field

  • coordinates_velocity – Define the velocity coordinates of the covariance matrix

  • additional_parameters_values – Pass the values of additional parameters to the flip code

  • **kwargs – Pass a variable number of keyword arguments to the function

Returns:

A covariancematrix object

classmethod init_from_generator(model_name, model_type, power_spectrum_dict, coordinates_velocity=None, coordinates_density=None, additional_parameters_values=None, variant=None, **kwargs)[source]#

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

Parameters:
  • cls – Refer to the class itself

  • model_name – Specify the type of model used to generate the covariance matrix

  • model_type – Determine which model to use

  • power_spectrum_dict – Pass the power spectrum to the generate_* functions

  • coordinates_velocity – Generate the velocity covariance matrix

  • coordinates_density – Generate the density field

  • additional_parameters_values – Pass additional parameters to the generator function

  • **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

classmethod init_from_file(filename, file_format)[source]#
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

Parameters:

self – Represent the instance of the class

Returns:

The type of the model

property loaded#

The loaded function checks if the covariance matrix is loaded.

Parameters:

self – Refer to the object itself

Returns:

A boolean

compute_covariance_sum(parameter_values_dict, vector_variance, use_jit=False)[source]#
The compute_covariance_sum function computes the sum of all covariance matrices

and adds the diagonal terms.

Parameters:
  • self – Access the attributes of the class

  • 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

compute_covariance_sum_eigenvalues(parameter_values_dict, vector_variance)[source]#
compute_full_matrix()[source]#

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

Parameters:

self – Bind the method to the object

Returns:

A dictionary with the full covariance matrices for each redshift bin

compute_flat_matrix()[source]#
write(filename, file_format)[source]#

The write function writes the covariance matrix to a file.

Parameters:
  • self – Represent the instance of the class

  • 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

mask(mask_vel=None, mask_dens=None)[source]#
flip.data_vector.create_log(log_level='info')[source]#

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 "info" by default. The function returns a Logger object with the specified logging level.

Parameters:

log_level – Set the logging level

Returns:

A logger object

flip.data_vector.jax_installed = True#
flip.data_vector.log#
flip.data_vector._avail_velocity_estimator = ['watkins', 'lowz', 'hubblehighorder', 'full']#
class flip.data_vector.DataVector(data, cov=None, **kwargs)[source]#

Bases: abc.ABC

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

_free_par = []#
_kind = ''#
property conditional_free_par#
property free_par#
property kind#
property conditional_needed_keys#
property needed_keys#
property data#
abstract _give_data_and_variance(**kwargs)[source]#
_check_keys(data)[source]#
_covariance_observation = None#
_data#
_kwargs#
__call__(*args)[source]#
mask(bool_mask)[source]#
compute_covariance(model, power_spectrum_dict, **kwargs)[source]#
class flip.data_vector.Density(data, cov=None, **kwargs)[source]#

Bases: DataVector

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

_kind = 'density'#
_needed_keys = ['density', 'density_error']#
_give_data_and_variance(*args)[source]#
class flip.data_vector.DirectVel(data, cov=None)[source]#

Bases: DataVector

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

_kind = 'velocity'#
_needed_keys = ['velocity']#
property conditional_needed_keys#
_give_data_and_variance(*args)[source]#
class flip.data_vector.DensVel(DensityVector, VelocityVector)[source]#

Bases: DataVector

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

_kind = 'cross'#
property needed_keys#
property free_par#
_give_data_and_variance(*args)[source]#
densities#
velocities#
compute_covariance(model, power_spectrum_dict, **kwargs)[source]#
class flip.data_vector.VelFromHDres(data, cov=None, vel_estimator='full', **kwargs)[source]#

Bases: DirectVel

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

_needed_keys = ['dmu', 'zobs']#
property conditional_needed_keys#
_dmu2vel#
class flip.data_vector.FisherVelFromHDres(data, vel_estimator='full', **kwargs)[source]#

Bases: DataVector

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

_kind = 'velocity'#
_needed_keys = ['zobs', 'ra', 'dec', 'rcom_zobs']#
_free_par = ['sigma_M']#
_give_data_and_variance(parameter_values_dict)[source]#
_dmu2vel#
class flip.data_vector.FisherDensity(data, vel_estimator='full', **kwargs)[source]#

Bases: DataVector

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

_kind = 'density'#
_needed_keys = ['ra', 'dec', 'rcom_zobs']#
_free_par = []#
_give_data_and_variance(parameter_values_dict)[source]#
class flip.data_vector.FisherDensVel(FisherDensity, FisherVel)[source]#

Bases: DataVector

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

_kind = 'cross'#
_give_data_and_variance(*args)[source]#
densities#
velocities#
compute_covariance(model, power_spectrum_dict, **kwargs)[source]#