cosmicfish_pylib.fisher_operationsΒΆ
Module that contains operations that can be performed on Fisher matrices. All of them are safeguarded against non-Fisher input.
eliminate_columns_rows |
This function eliminates the row and columns corresponding to the given indexes from the Fisher matrix. |
eliminate_parameters |
This function eliminates the row and columns corresponding to the given parameter name from the Fisher matrix. |
reshuffle |
This function reshuffles a Fisher matrix. |
marginalise |
This function marginalises a Fisher matrix over all parameters but the ones in names. |
marginalise_over |
This function marginalises a Fisher matrix over the parameters in names. |
-
cosmicfish_pylib.fisher_operations.
eliminate_columns_rows
(fisher_matrix, indexes)[source] This function eliminates the row and columns corresponding to the given indexes from the Fisher matrix. It also deletes all the other informations like the names of the parameters. Notice that the index corresponding to the first parameter is zero.
Parameters: - fisher_matrix (
cosmicfish_pylib.fisher_matrix.fisher_matrix
) – input Fisher matrix - indexes (
list
ofint
) – list of integers with the indexes to delete from the Fisher matrix
Returns: A Fisher matrix with the columns and rows deleted
Return type: - fisher_matrix (
-
cosmicfish_pylib.fisher_operations.
eliminate_parameters
(fisher_matrix, names)[source] This function eliminates the row and columns corresponding to the given parameter name from the Fisher matrix. It also deletes all the other informations like the names of the parameters.
Parameters: - fisher_matrix (
cosmicfish_pylib.fisher_matrix.fisher_matrix
) – input Fisher matrix - names (
list
ofstring
) – list of names of the parameters to delete from the Fisher matrix
Returns: A Fisher matrix with the parameters deleted
Return type: - fisher_matrix (
-
cosmicfish_pylib.fisher_operations.
information_gain
(fisher_1, fisher_2, fisher_prior, units=0.6931471805599453, stat=True)[source] This function computes the Fisher approximation of Kullback-Leibler information gain. For the details of the formula we refer to the CosmicFish notes.
Parameters: - fisher_1 (
cosmicfish_pylib.fisher_matrix.fisher_matrix
) – first input Fisher matrix - fisher_2 (
cosmicfish_pylib.fisher_matrix.fisher_matrix
) – second input Fisher matrix - fisher_prior (
cosmicfish_pylib.fisher_matrix.fisher_matrix
) – input Fisher matrix with the prior information. - units (
float
) – Units of information gain. Optional by default in Bits. - stat (
logical
) – wether to output the expected value and variance
Returns: a
float
with the information gain.Return type: - fisher_1 (
-
cosmicfish_pylib.fisher_operations.
marginalise
(fisher_matrix, names)[source] This function marginalises a Fisher matrix over all parameters but the ones in names. The new Fisher matrix will have the parameters specified in names, in the order specified by names. The calculation is performed in the numerically stable way.
Parameters: - fisher_matrix (
cosmicfish_pylib.fisher_matrix.fisher_matrix
) – input Fisher matrix - names (
list
ofstring
) – list of names of the parameters of the output Fisher matrix, in the order that will appear in the output Fisher matrix. All other parameters will be marginalized over.
Returns: A Fisher matrix with the marginalized parameters
Return type: - fisher_matrix (
-
cosmicfish_pylib.fisher_operations.
marginalise_over
(fisher_matrix, names)[source] This function marginalises a Fisher matrix over the parameters in names. The new Fisher matrix will not have the parameters specified in names. The calculation is performed in the numerically stable way.
Parameters: - fisher_matrix (
cosmicfish_pylib.fisher_matrix.fisher_matrix
) – input Fisher matrix - names (
list
ofstring
) – list of names of the parameters over which the Fisher will be marginalised.
Returns: A Fisher matrix with the names parameters marginalized.
Return type: - fisher_matrix (
-
cosmicfish_pylib.fisher_operations.
reshuffle
(fisher_matrix, names)[source] This function reshuffles a Fisher matrix. The new Fisher matrix will have the parameters specified in names, in the order specified by names. Can be used to delete parameters, change their order or extract the Fisher for some parameters without marginalizing over the others.
Parameters: - fisher_matrix (
cosmicfish_pylib.fisher_matrix.fisher_matrix
) – input Fisher matrix - names (
list
ofstring
) – list of names of the parameters that are desired in the output Fisher matrix, in the desired order.
Returns: A Fisher matrix with the new parameters
Return type: - fisher_matrix (