Skip to content

Commit

Permalink
bug fix to measurement from sds 3.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourpeas committed Jan 5, 2022
1 parent a0b7270 commit 4f893db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rcpchgrowth/global_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def generate_centile(z: float, centile: float, measurement_method: str, sex: str
Takes the z-score equivalent of the centile, the centile to be used as a label, the sex and measurement method.
"""

print(f"hello: {z}")

if (len(lms_array_for_measurement)==0):
raise Exception(f"No reference data available for {measurement_method} in {sex} in {reference}")

Expand All @@ -119,13 +121,15 @@ def generate_centile(z: float, centile: float, measurement_method: str, sex: str
reference=reference, measurement_method=measurement_method, requested_sds=z, sex=sex, age=age)
except Exception as err:
print(f"Measurement Calculation Error: {err}")
return

# creates a data point
if measurement is not None:
try:
rounded = round(measurement*10000)/10000
rounded = round(measurement, 4)
except Exception as e:
print(f"{e} z:{z} age:{age} measurement: {measurement}")
return
else:
rounded = None
value = {
Expand Down Expand Up @@ -292,7 +296,7 @@ def measurement_for_z(z: float, l: float, m: float, s: float) -> float:
if first_step < 0:
return None
try:
measurement_value= (first_step ** (1/exponent)) * m
measurement_value= (first_step ** exponent) * m
except Exception as e:
print(e)
return
Expand Down

0 comments on commit 4f893db

Please sign in to comment.