Skip to content

Commit

Permalink
adds cdc tests for over 2s (height, weight, bmi - there is no OFC), c…
Browse files Browse the repository at this point in the history
…dc is linearly interpolated so this added to global_functions. Single fail for CDC height in a 2.5y girl: assert 1.3882029662677624 == 1.3893 ± 1.0e-03
  • Loading branch information
eatyourpeas committed Sep 27, 2024
1 parent bb7a1d2 commit d987652
Show file tree
Hide file tree
Showing 4 changed files with 69,170 additions and 5 deletions.
4 changes: 3 additions & 1 deletion rcpchgrowth/global_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ def fetch_lms(age: float, lms_value_array_for_measurement: list):
if (
age_matched_index >= 1
and age_matched_index < len(lms_value_array_for_measurement) - 2
and "sigma" not in lms_value_array_for_measurement[age_matched_index] # CDC BMI references have an additional sigma value
# and CDC only use linear interpolation
):
# cubic interpolation is possible
age_two_below = lms_value_array_for_measurement[age_matched_index - 1][
Expand Down Expand Up @@ -561,7 +563,7 @@ def fetch_lms(age: float, lms_value_array_for_measurement: list):
)
return {"l": l, "m": m, "s": s, "sigma": sigma}
else:
# we are at the thresholds of this reference. Only linear interpolation is possible
# we are at the thresholds of this reference or are using CDC BMI. Only linear interpolation is possible
l = linear_interpolation(
age=age,
age_one_below=age_one_below,
Expand Down
Loading

0 comments on commit d987652

Please sign in to comment.