Some more fixes in Fisher information calculation
@@ -1090,7 +1090,8 @@ class FisherInformation:
fisher_information_uncertainty : ndarray
Only returned if calculate_uncertainty is True. Covariance matrix of the Fisher information. Note that this
does not take into account any uncertainty on the nuisance parameter part of the Fisher information, and
- correlations between events are neglected.
+ correlations between events are neglected. Note that independent of sum_events, the covariance matrix is
+ always summed over the events.
"""
@@ -1116,8 +1117,7 @@ class FisherInformation:
else:
i_ref_benchmark = list(self.benchmarks.keys()).index(self.reference_benchmark)
nuisance_weight_ratio = (
- weights_benchmarks.T[self.benchmark_is_nuisance, :] / weights_benchmarks[np.newaxis, :,
- i_ref_benchmark]
+ weights_benchmarks.T[self.benchmark_is_nuisance, :] / weights_benchmarks[np.newaxis, :, i_ref_benchmark]
)
# Shape (n_nuisance_parameters, n_events)
@@ -1179,8 +1179,12 @@ class FisherInformation:
covariance_information_phys = np.einsum("ijnb,nbc,klnc->ijkl", jacobian, covariance_inputs, jacobian)
if include_nuisance_parameters:
- covariance_information = np.zeros((n_all_parameters, n_all_parameters))
- covariance_information[: self.n_parameters, : self.n_parameters] = covariance_information_phys
+ covariance_information = np.zeros(
+ (n_all_parameters, n_all_parameters, n_all_parameters, n_all_parameters)
+ )
+ covariance_information[
+ : self.n_parameters, : self.n_parameters, : self.n_parameters, : self.n_parameters
+ ] = covariance_information_phys
else:
covariance_information = covariance_information_phys
