analysis.fisher module

This module contains functions necessary to produce statistical results of the fisher formalism from a given galaxy.

class analysis.fisher.Fisher(g_parameters, image_renderer, snr, var_noise=None)[source]

Bases: object

Produce fisher object (containing fisher analysis) for a given set of galaxy parameters.

Given a galaxy image and the appropiate parameters that describe it, (in the form of analysis.galfun.GParameters object) will produce a fisher object that contains the analysis of it using the Fisher Formalism.

NOTE: The matrices are in dictionary form, use the function matrixToNumpyArray() to change them to a matrix that is ordered according to param_names.

Args:
g_parameters(GParameters): String point to the directory
specified by the user.

image_renderer(ImageRenderer): Object used to render image of galaxy. snr(float): Value S/N ratio to use in the analysis.

Attributes:

image_renderer_partials(analysis.galfun.ImageRenderer): Object used to render images of partial derivatives. image(Galsim.Image): Dictionary whose keys are the ids of each of the

galaxies specified in galaxies.csv, and that map to another dictionary that can be taken in by analysis.galfun.getGalaxyModel()

var_noise(float): Variance of noise of given S/N . steps(dict): Dictionary containing the step size used when

calculating partial derivatives.
param_names(list): A list containing the keys of fit_params
in a desirable order.

num_params(int): Number of parameters specified for the galaxy. num_galaxies(int): Number of galaxies specified. derivatives_images(dict): Dictionary containing np.array(s) that represent the

derivative of the galaxy(ies) with respect to each parameter.
second_derivatives_images(dict): Dictionary containing np.array(s) that represent the
second derivatives of the galaxy(ies) with respect to its parameters.
fisher_matrix_images(dict): Dictionary containing np.array(s) that represent the
fisher matrix images of the galaxy(ies) with respect to its parameters.

fisher_matrix(dict): Dictionary containing fisher matrix elements. covariance_matrix(dict): Dictionary containing covariance matrix elements. correlation_matrix(dict): Dictionary containing correlation matrix elements. bias_matrix_images(dict): Dictionary containing bias matrix image elements. bias_matrix(dict): Dictionary containing bias matrix elements. bias_images(dict): Dictionary containing bias images elements. biases(dict): Dictionary containing biases

biasImages()[source]

Construct the bias of each parameter per pixel.

biasMatrix()[source]

Return bias matrix from the images of the bias matrix

biasMatrixImages()[source]

Produce images of each element of the bias matrix.

correlationMatrix()[source]

Calculate correlation matrix from the covariance matrix.

covarianceMatrix()[source]

Calculate the covariance matrix by inverting fisher matrix.

derivativesImages()[source]

Return images of the partial derivatives of the galaxy.

The partial differentiation includes each of the different parameters that describe the galaxy.

fisherConditionNumber()[source]

The condition number will give a sense of how singular the matrix tends to be.

fisherMatrix()[source]

Calculate the actual values of the fisher matrix.

fisherMatrixImages()[source]

Produce images of fisher matrix).

getBiases()[source]

Return the value of the bias of each parameter in vector form.

matrixToNumpyArray(matrix)[source]

Convert matrix dictionary to a numpy array.

numpyArrayToMatrix(array)[source]

Convert numpy array to matrix dictionary.

secondDerivativesImages()[source]

Return the images for the second derivatives of the given galaxy.

analysis.fisher.getSNR(img, var_noise)[source]