Skip to content

Commit

Permalink
Extend validation (#55)
Browse files Browse the repository at this point in the history
* json file for Lb2pKg

* Solving issue #42

* Delete file with comma

* same validation marks for lc2pkpi

* variables in json file

* Change name of the parameter

* add validation points for lineshapes, modify qmd file

* "name"->"point" in checksums, rename validation points, linshapes variables

* add tonumber to julia dictionary

* `name` -> `point` in python notebook

* Validation of lineshapes for X to 3pi

* condition to not checking lineshapes in python
  • Loading branch information
IlyaSegal authored Jun 1, 2024
1 parent 680e36a commit afcb173
Show file tree
Hide file tree
Showing 9 changed files with 430 additions and 171 deletions.
1 change: 1 addition & 0 deletions .cspell/julia.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ nonpole
quadgk
struct
textrm
tonumber
xlab
xlim
ylab
Expand Down
17 changes: 13 additions & 4 deletions docs/julia/lb2pkg-lhcb-2765817.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ end
function ThreeBodyDecaysIO.dict2instance(::Type{Constant}, dict)
return Constant()
end
# type piracy, not good
(bw::HadronicLineshapes.BreitWigner)(x::Dict) = bw(first(values(x)))
(bw::HadronicLineshapes.MultichannelBreitWigner)(x::Dict) = bw(first(values(x)))
```

## Deserialization of Objects to a Workspace
Expand Down Expand Up @@ -92,23 +96,28 @@ df = let
@unpack amplitude_model_checksums = misc
map(amplitude_model_checksums) do check_point_info
@unpack name, value, distribution = check_point_info
@unpack point, value, distribution = check_point_info
#
# pull distribution
dist = workspace[distribution]
# pull correct parameter point
parameter_points_dict = array2dict(parameter_points; key="name")
# find the point in the list of points
parameter_point = parameter_points_dict[name]
parameter_point = parameter_points_dict[point]
# compute, compare
_parameters = array2dict(parameter_point["parameters"];
key="name", apply=v -> v["value"])
#
computed_value = dist(_parameters)
status = label_diff(value - computed_value; levels=[1e-2, 1e-12])
#
tonumber(X::Number) = X
tonumber(X::String) = string2complex(X)
reference_value = tonumber(value)
status = label_diff(reference_value - computed_value)
#
(; Distribution=distribution, Reference=value, Computed_value=computed_value,
Point=name, Status=status)
Point=point, Status=status)
end |> DataFrame
end
```
Expand Down
23 changes: 19 additions & 4 deletions docs/julia/lc2ppik-lhcb-2683025.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ function ThreeBodyDecaysIO.dict2instance(::Type{BreitWignerWidthExpLikeBugg}, di
@unpack mass, width, slope = dict
return BreitWignerWidthExpLikeBugg(mass, width, slope)
end
# type piracy, not good
(bw::HadronicLineshapes.BreitWigner)(x::Dict) = bw(first(values(x)))
(bw::HadronicLineshapes.MultichannelBreitWigner)(x::Dict) = bw(first(values(x)))
```

## Deserialization of Objects to a Workspace
Expand Down Expand Up @@ -101,23 +105,34 @@ let
@unpack amplitude_model_checksums = misc
map(amplitude_model_checksums) do check_point_info
@unpack name, value, distribution = check_point_info
@unpack point, value, distribution = check_point_info
#
# pull distribution
dist = workspace[distribution]
# pull correct parameter point
parameter_points_dict = array2dict(parameter_points; key="name")
# find the point in the list of points
parameter_point = parameter_points_dict[name]
parameter_point = parameter_points_dict[point]
# compute, compare
_parameters = array2dict(parameter_point["parameters"];
key="name", apply=v -> v["value"])
#
function label_diff(diff; levels=[1e-2, 1e-10])
_diff = abs(diff)
_diff < levels[2] && return '🟢'
_diff < levels[1] && return '🟡'
return '🔴'
end
computed_value = dist(_parameters)
status = label_diff(value - computed_value; levels=[1e-2, 1e-10])
#
tonumber(X::Number) = X
tonumber(X::String) = string2complex(X)
reference_value = tonumber(value)
status = label_diff(reference_value - computed_value)
#
(; Distribution=distribution,
Point=name, Status=status)
Point=point, Status=status)
end |> DataFrame
end
```
Expand Down
14 changes: 13 additions & 1 deletion docs/julia/x2pipipi-compass-1391643.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ function ThreeBodyDecaysIO.dict2instance(::Type{KatchaevSigma}, dict)
@unpack poles, residues, nonpole_expansion_coeffs = dict
return KatchaevSigma(poles, residues, nonpole_expansion_coeffs)
end
# type piracy, not good
(bw::HadronicLineshapes.BreitWigner)(x::Dict) = bw(first(values(x)))
(bw::HadronicLineshapes.MultichannelBreitWigner)(x::Dict) = bw(first(values(x)))
(bw::KatchaevSigma)(x::Dict) = bw(first(values(x)))
(bw::BreitWignerRho3XQrt)(x::Dict) = bw(first(values(x)))
(bw::BreitWignerRhoNoSqrt)(x::Dict) = bw(first(values(x)))
```

## Deserialization of Objects to a Workspace
Expand Down Expand Up @@ -164,7 +171,12 @@ let
key="name", apply=v -> v["value"])
#
computed_value = dist(_parameters)
status = label_diff(value - computed_value; levels=[1e-3, 1e-10])
#
tonumber(X::Number) = X
tonumber(X::String) = string2complex(X)
reference_value = tonumber(value)
status = label_diff(reference_value - computed_value)
#
(; Distribution=distribution,
Point=point, computed_value, value, Status=status)
end |> DataFrame
Expand Down
4 changes: 3 additions & 1 deletion docs/python/lc2ppik-lhcb-2683025.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ The following serves as a numerical check on whether the amplitude model has bee

```{python}
checksums = {
misc_key: {checksum["name"]: checksum["value"] for checksum in misc_value}
misc_key: {checksum["point"]: checksum["value"] for checksum in misc_value}
for misc_key, misc_value in MODEL_DEFINITION["misc"].items()
if "checksum" in misc_key
}
Expand All @@ -424,6 +424,8 @@ array = []
for distribution_name, checksum in checksums.items():
for point_name, expected in checksum.items():
parameters = checksum_points[point_name]
if len(parameters) < 6:
continue
s1 = parameters["m_31_2"] ** 2
s2 = parameters["m_31"] ** 2
computed = intensity_funcs[3]({"sigma1": s1, "sigma2": s2})
Expand Down
Loading

0 comments on commit afcb173

Please sign in to comment.