Skip to content

Commit

Permalink
removed pdf covmat changes
Browse files Browse the repository at this point in the history
  • Loading branch information
comane committed Jun 9, 2023
1 parent a6f0b15 commit e309d4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 89 deletions.
10 changes: 5 additions & 5 deletions validphys2/src/validphys/closuretest/multiclosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
@check_use_t0
@check_t0pdfset_matches_multiclosure_law
def internal_multiclosure_dataset_loader(
dataset, fits_pdf, multiclosure_underlyinglaw, fits, t0_covmat_from_systematics_pdferr_considered
dataset, fits_pdf, multiclosure_underlyinglaw, fits, t0_covmat_from_systematics
):
"""Internal function for loading multiple theory predictions for a given
dataset and a single covariance matrix using underlying law as t0 PDF,
Expand Down Expand Up @@ -92,10 +92,10 @@ def internal_multiclosure_dataset_loader(
multiclosure_underlyinglaw, dataset
)

sqrt_covmat = la.cholesky(t0_covmat_from_systematics_pdferr_considered, lower=True)
sqrt_covmat = la.cholesky(t0_covmat_from_systematics, lower=True)
# TODO: support covmat reg and theory covariance matrix
# possibly make this a named tuple
return (fits_dataset_predictions, fits_underlying_predictions, t0_covmat_from_systematics_pdferr_considered, sqrt_covmat)
return (fits_dataset_predictions, fits_underlying_predictions, t0_covmat_from_systematics, sqrt_covmat)



Expand All @@ -109,15 +109,15 @@ def internal_multiclosure_data_loader(
fits_pdf,
multiclosure_underlyinglaw,
fits,
dataset_inputs_t0_covmat_from_systematics_pdferr_considered,
dataset_inputs_t0_covmat_from_systematics,
):
"""Like `internal_multiclosure_dataset_loader` except for all data"""
return internal_multiclosure_dataset_loader(
data,
fits_pdf,
multiclosure_underlyinglaw,
fits,
dataset_inputs_t0_covmat_from_systematics_pdferr_considered,
dataset_inputs_t0_covmat_from_systematics,
)


Expand Down
84 changes: 0 additions & 84 deletions validphys2/src/validphys/covmats.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,48 +303,6 @@ def t0_covmat_from_systematics(
_central_values=dataset_t0_predictions
)

def t0_covmat_from_systematics_pdferr_considered(
loaded_commondata_with_cuts,
*,
dataset_input,
pdf,
dataset,
covmat_combi=False,
pdf_err=False,
use_weights_in_covmat=True,
norm_threshold=None,
dataset_t0_predictions
):
"""Like :py:func:`t0_covmat_from_systematics` except allows for the
PDF error covariance matrix to be summed to it.
"""
if covmat_combi:
th = ThPredictionsResult.from_convolution(pdf, dataset)
pdf_cov = np.cov(th.error_members, rowvar=True)

return pdf_cov + covmat_from_systematics(
loaded_commondata_with_cuts,
dataset_input,
use_weights_in_covmat,
norm_threshold=norm_threshold,
_central_values=dataset_t0_predictions
)

elif pdf_err:
th = ThPredictionsResult.from_convolution(pdf, dataset)
pdf_cov = np.cov(th.error_members, rowvar=True)
regularized_pdf_covmat = regularize_covmat(pdf_cov)
return regularized_pdf_covmat

else:
return covmat_from_systematics(
loaded_commondata_with_cuts,
dataset_input,
use_weights_in_covmat,
norm_threshold=norm_threshold,
_central_values=dataset_t0_predictions
)


dataset_inputs_t0_predictions = collect("dataset_t0_predictions", ("data",))

Expand Down Expand Up @@ -430,48 +388,6 @@ def dataset_inputs_t0_covmat_from_systematics_pdferr_considered(
)


def dataset_inputs_t0_total_covmat_separate(
dataset_inputs_t0_exp_covmat_separate,
loaded_theory_covmat
):
"""
Function to compute the covmat to be used for the sampling by make_replica.
In this case the t0 prescription is used for the experimental covmat and the multiplicative
errors are separated. Moreover, the theory covmat is added to experimental covmat.
"""
covmat = dataset_inputs_t0_exp_covmat_separate
covmat += loaded_theory_covmat
return covmat

def dataset_inputs_t0_exp_covmat_separate(
dataset_inputs_loaded_cd_with_cuts,
*,
data_input,
use_weights_in_covmat=True,
norm_threshold=None,
dataset_inputs_t0_predictions,
):
"""
Function to compute the covmat to be used for the sampling by make_replica.
In this case the t0 prescription is used for the experimental covmat and the multiplicative
errors are separated.
"""
covmat = generate_exp_covmat(dataset_inputs_loaded_cd_with_cuts, data_input, use_weights_in_covmat, norm_threshold, dataset_inputs_t0_predictions , True)
return covmat

def dataset_inputs_total_covmat_separate(
dataset_inputs_exp_covmat_separate,
loaded_theory_covmat,
):
"""
Function to compute the covmat to be used for the sampling by make_replica.
In this case the t0 prescription is not used for the experimental covmat and the multiplicative
errors are separated. Moreover, the theory covmat is added to experimental covmat.
"""
covmat = dataset_inputs_exp_covmat_separate
covmat += loaded_theory_covmat
return covmat

def dataset_inputs_exp_covmat_separate(
dataset_inputs_loaded_cd_with_cuts,
*,
Expand Down

0 comments on commit e309d4a

Please sign in to comment.