cosmicfish_pylib.fisher_plot_analysis¶
Module that contains a set of tools to perform the analysis of a set of Fisher matrices.
-
class
cosmicfish_pylib.fisher_plot_analysis.
CosmicFish_FisherAnalysis
(fisher_list=None, fisher_path=None, search_fisher_guess=False, with_derived=True)[source]¶ This class takes care of handeling a set of Fisher matrices with plotting in mind. This class is meant to hold a list of Fisher matrices and have defined on this list a set of vectorized operations. For now no caching is implemented.
Variables: - fisher_list – list of Fisher matrices
cosmicfish_pylib.fisher_matrix.fisher_matrix
- fisher_name_list – list of names of the Fisher matrices. The names are used as the unique identifier of the Fisher matrix. No double name is enforced.
CosmicFish_FisherAnalysis class constructor. The constructor builds the Fisher matrices list. If all the arguments of the constructor are None then the Fisher list will be created and will be empty. If this is initialized with fisher_list then this will constitute the base Fisher set. if this is initialized with fisher_path then the code will search the desired path for Fisher matrices. If initialized with both fisher_list and fisher_path then both will be added.
Parameters: - fisher_list (
cosmicfish_pylib.fisher_matrix.fisher_matrix
orlist
ofcosmicfish_pylib.fisher_matrix.fisher_matrix
) – Fisher matrix or list of Fisher matrices. - fisher_path (
string
orlist
ofstring
) – path or list of paths to search for Fisher matrices. - search_fisher_guess (
bool
) – wether to guess the Fisher matrix name or not. Guessing assumes that the Fisher matrices have ‘fisher_matrix’ and ‘.dat’ in the name as happens with Fisher matrices produced with CosmicFish. - with_derived (
bool
) – wether to search for derived Fisher matrices to add to the base Fisher that are found.
-
add_fisher_matrix
(fisher)[source]¶ Add a set of Fisher matrices to the already existing set. Rejects Fisher matrices if the name is double i.e. the name is the unique identifier of the Fisher matrix. Checks wether the elements that are passed are really Fisher matrices.
Parameters: fisher_list ( cosmicfish_pylib.fisher_matrix.fisher_matrix
orlist
ofcosmicfish_pylib.fisher_matrix.fisher_matrix
) – Fisher matrix or list of Fisher matrices.
-
compute_ellipse
(params1=None, params2=None, confidence_level=0.68, names=None, num_points=100)[source]¶ Function that computes the (2D) ellipses for a given parameters combination. Returns a dictionary with all the meaningul information about the ellipses.
Parameters: - params1 (a
string
or alist
ofstring
) – name of the first parameter or list of names of parameters. - params2 – name of the second parameter or list of names of parameters.
- confidence_level (
float
) – (optional) Confidence Level of the bounds. Default 68%. - names (a
string
or alist
ofstring
) – names of the Fisher matrices. - num_points (
int
) – number of (x,y) points.
Returns: a dictionary mapping name and parameters to a tuple of: [x, y, [fiducial_x, fiducial_y, coeff_a, coeff_b, theta_0]]
Return type: - params1 (a
-
compute_gaussian
(params=None, confidence_level=0.68, names=None, num_points=100, normalized=False, nice_bounds=True)[source]¶ Function that computes the (1D) gaussian distribution of a given parameter. Returns a dictionary with all the meaningul information about the gaussian.
Parameters: - params (a
string
or alist
ofstring
) – name of the parameter or list of names of parameters. - confidence_level (
float
) – (optional) Confidence Level of the bounds. Default 68%. - names (a
string
or alist
ofstring
) – names of the Fisher matrices. - num_points (
int
) – number of (x,y) points. - normalized (
bool
) – wether the distribution is normalized or not. - nice_bounds (
bool
) – wether the x range is properly rounded to be nice or not.
Returns: a dictionary mapping name and parameter to a tuple of: [x, y, [fiducial,sigma]]
Return type: - params (a
-
compute_plot_range
(params=None, confidence_level=0.68, names=None, nice=True)[source]¶ Function that computes a meaningfull plot range for the plots involving the specified parameters and the specified Fisher names.
Parameters: - params (a
string
or alist
ofstring
) – name of the parameter or list of names of parameters. - confidence_level (
float
) – (optional) Confidence Level of the bounds. Default 68%. - names (a
string
or alist
ofstring
) – names of the Fisher matrices. - nice (
bool
) – wether the number is properly rounded to be nice.
Returns: a dictionary of name and bounds
Return type: - params (a
-
delete_fisher_matrix
(names=None)[source]¶ Delete the fisher matrix or the fisher matrices in names from the Fisher list.
Parameters: names (a string
or alist
ofstring
) – names of the Fisher matrices to delete.
-
get_fisher_matrix
(names=None)[source]¶ Returns the list of Fisher matrices corresponding to the given names.
Parameters: names (a string
or alist
ofstring
) – names of the Fisher matrices.Returns: a list containing the desired Fisher matrices. Notice if the name is not found in the list no error is risen and and the entrance is just ignored. Return type: a list
ofcosmicfish_pylib.fisher_matrix.fisher_matrix
-
get_fisher_name_list
()[source]¶ Returns: the list fisher matrices names. These are the unique identifiers of the list.
-
get_parameter_latex_names
(names=None)[source]¶ Returns a dictionary mapping parameter names and latex parameter names.
Parameters: names (a string
or alist
ofstring
) – names of the Fisher matrices.Returns: a dictionary containing parameter names and the LaTeX parameter names. Return type: dict
-
get_parameter_list
(names=None)[source]¶ Returns the list of parameter names of all the matrices identified in names.
Parameters: names (a string
or alist
ofstring
) – names of the Fisher matrices.Returns: a list containing the parameter names. Return type: a list
ofstring
-
marginalise
(params, names=None)[source]¶ Marginalise all the Fisher matrices over all the parameters that are not in params.
Parameters: Returns: a new Fisher list with the reshuffled Fishers
Return type: a
cosmicfish_pylib.fisher_plot_analysis.CosmicFish_FisherAnalysis
-
reshuffle
(params, names=None)[source]¶ Reshuffles all the Fisher matrices.
Parameters: Returns: a new Fisher list with the reshuffled Fishers
Return type: a
cosmicfish_pylib.fisher_plot_analysis.CosmicFish_FisherAnalysis
-
search_fisher_path
(fisher_path, search_fisher_guess=False, with_derived=True)[source]¶ Searches a path for fisher matrices. Will detect wether fisher_path contains directly the paths to the Fisher files or folder. If a list of folders is passed all the folders will be searched, first for Fisher matrices then for derived Fisher matrices.
Parameters: - fisher_path (
string
orlist
ofstring
) – path or list of paths to search for Fisher matrices. If this contains Fisher matrices files those are imported as well. - search_fisher_guess (
bool
) – wether to guess the Fisher matrix name or not. Guessing assumes that the Fisher matrices have ‘fisher_matrix’ and ‘.dat’ in the name as happens with Fisher matrices produced with CosmicFish. - with_derived (
bool
) – wether to search for derived Fisher matrices to add to the base Fisher that are found.
- fisher_path (
- fisher_list – list of Fisher matrices