-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89a4bb4
commit 1b5deac
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import jax.numpy as jnp | ||
import numpy as np | ||
from pathlib import Path | ||
import pickle | ||
|
||
# Get the directory of the current file | ||
current_dir = Path(__file__).parent | ||
|
||
|
||
class HLLHC_kappa_lambda_chi2: | ||
def __init__(self, coefficients, rgemat=None): | ||
self.wc = [ | ||
"Op", | ||
] | ||
self.rgemat = rgemat | ||
self.chi2_path = current_dir / "kappa_lambda_HL-LHC_likelihood.pkl" | ||
|
||
# coefficients is a list with the names of the coefficients. We need to create a projection matrix | ||
# that projects the coefficients to the basis of the observables | ||
self.project = np.zeros((len(self.wc), coefficients.size)) | ||
for i, op in enumerate(self.wc): | ||
if op in coefficients.name: | ||
self.project[i, np.argwhere(coefficients.name == op)[0, 0]] = 1 | ||
|
||
if self.rgemat is not None: | ||
self.project = jnp.einsum("ij,jk->ik", self.project, self.rgemat) | ||
|
||
# load pickle file | ||
with open(self.chi2_path, "rb") as f: | ||
self.chi2 = pickle.load(f) | ||
|
||
def compute_chi2(self, coefficient_values): | ||
coeffs_vals = jnp.dot(self.project, coefficient_values) | ||
# now we have to transform cphi in klambda | ||
klambda = 1 - 0.47 * coeffs_vals | ||
|
||
chi2_value = self.chi2(klambda).squeeze() | ||
|
||
return chi2_value |
Binary file not shown.