Skip to content

Commit

Permalink
Corrected bug
Browse files Browse the repository at this point in the history
  • Loading branch information
achiefa committed Jul 16, 2024
1 parent abc9325 commit db67070
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions validphys2/src/validphys/theorycovariance/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ def thcov_ht(combine_by_type_ht, H2_list, HL_list, groups_data_by_process, pdf,
deltas[f"d({i+1}+,0)"] += [PC_2]
deltas[f"d(0,{i+1}+)"] += [PC_L]
elif target == 'ratio':
deltas[f"p({i+1}+,0)"] += [compute_ratio_delta(dataset, pdf, "p", PC_2)]
deltas[f"p(0,{i+1}+)"] += [compute_ratio_delta(dataset, pdf, "p", PC_L)]
deltas[f"d({i+1}+,0)"] += [compute_ratio_delta(dataset, pdf, "d", PC_2)]
deltas[f"d(0,{i+1}+)"] += [compute_ratio_delta(dataset, pdf, "d", PC_L)]
deltas[f"p({i+1}+,0)"] += [compute_ratio_delta(dataset, pdf, "p", PC_2) - compute_ratio_delta(dataset, pdf)]
deltas[f"p(0,{i+1}+)"] += [compute_ratio_delta(dataset, pdf, "p", PC_L) - compute_ratio_delta(dataset, pdf)]
deltas[f"d({i+1}+,0)"] += [compute_ratio_delta(dataset, pdf, "d", PC_2) - compute_ratio_delta(dataset, pdf)]
deltas[f"d(0,{i+1}+)"] += [compute_ratio_delta(dataset, pdf, "d", PC_L) - compute_ratio_delta(dataset, pdf)]
else:
raise ValueError("Could not detect target.")

Expand Down Expand Up @@ -222,7 +222,7 @@ def extract_target(dataset):
raise ValueError(f"Unexpected operator in {dataset.name}: {dataset.op}")


def compute_ratio_delta(dataset, pdf: PDF, target, PC: np.array) -> np.array:
def compute_ratio_delta(dataset, pdf: PDF, target = None, PC: np.array = None) -> np.array:
"""This function computes the predictions as in validphys.convolution._predictions,
but for ratio and including higher twist terms in bot NUM and """
opfunc = operator.truediv
Expand All @@ -234,7 +234,7 @@ def compute_ratio_delta(dataset, pdf: PDF, target, PC: np.array) -> np.array:
all_predictions.append(np.concatenate(tmp.values))
if target == "d":
all_predictions[0] += PC
if target == "p":
elif target == "p":
all_predictions[1] += PC
return opfunc(*all_predictions)

Expand Down

0 comments on commit db67070

Please sign in to comment.