Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,7 @@ def calculate_magnitude_and_axis(j0, j45):
|
|
70 |
# Ensure the final axis is between 0 and 180
|
71 |
final_axis = final_axis % 180
|
72 |
|
73 |
-
return magnitude, final_axis
|
74 |
|
75 |
def main():
|
76 |
st.set_page_config(page_title='Astigmatism Prediction', page_icon=':eyeglasses:', layout='wide')
|
@@ -91,7 +91,7 @@ def main():
|
|
91 |
new_j0, new_j45 = predict_new_j0_j45(age, aca_magnitude, aca_axis)
|
92 |
|
93 |
# Calculate predicted magnitude and axis
|
94 |
-
predicted_magnitude, predicted_axis = calculate_magnitude_and_axis(new_j0, new_j45)
|
95 |
|
96 |
st.success(f'Predicted Total Corneal Astigmatism Magnitude: {predicted_magnitude:.2f} D')
|
97 |
st.success(f'Predicted Total Corneal Astigmatism Axis: {predicted_axis:.1f}°')
|
@@ -100,6 +100,15 @@ def main():
|
|
100 |
st.info(f'Initial J0: {initial_j0:.2f}, Initial J45: {initial_j45:.2f}')
|
101 |
st.info(f'Predicted J0: {new_j0:.2f}, Predicted J45: {new_j45:.2f}')
|
102 |
st.info(f'ACA Axis (Degrees): {aca_axis:.2f}°, ACA Axis (Radians): {math.radians(aca_axis):.4f}')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
else:
|
104 |
st.error('Please ensure all inputs are within the specified ranges.')
|
105 |
|
|
|
70 |
# Ensure the final axis is between 0 and 180
|
71 |
final_axis = final_axis % 180
|
72 |
|
73 |
+
return magnitude, final_axis, Z # Return Z as the intermediate axis
|
74 |
|
75 |
def main():
|
76 |
st.set_page_config(page_title='Astigmatism Prediction', page_icon=':eyeglasses:', layout='wide')
|
|
|
91 |
new_j0, new_j45 = predict_new_j0_j45(age, aca_magnitude, aca_axis)
|
92 |
|
93 |
# Calculate predicted magnitude and axis
|
94 |
+
predicted_magnitude, predicted_axis, intermediate_axis = calculate_magnitude_and_axis(new_j0, new_j45)
|
95 |
|
96 |
st.success(f'Predicted Total Corneal Astigmatism Magnitude: {predicted_magnitude:.2f} D')
|
97 |
st.success(f'Predicted Total Corneal Astigmatism Axis: {predicted_axis:.1f}°')
|
|
|
100 |
st.info(f'Initial J0: {initial_j0:.2f}, Initial J45: {initial_j45:.2f}')
|
101 |
st.info(f'Predicted J0: {new_j0:.2f}, Predicted J45: {new_j45:.2f}')
|
102 |
st.info(f'ACA Axis (Degrees): {aca_axis:.2f}°, ACA Axis (Radians): {math.radians(aca_axis):.4f}')
|
103 |
+
st.info(f'Intermediate Axis (Z): {intermediate_axis:.1f}°')
|
104 |
+
|
105 |
+
# Additional debugging information
|
106 |
+
st.subheader('Debugging Information:')
|
107 |
+
st.write(f'atan(J45/J0): {math.degrees(math.atan(new_j45 / new_j0) if new_j0 != 0 else math.pi/2):.2f}°')
|
108 |
+
st.write(f'0.5 * atan(J45/J0): {0.5 * math.degrees(math.atan(new_j45 / new_j0) if new_j0 != 0 else math.pi/2):.2f}°')
|
109 |
+
st.write(f'J0 > 0: {new_j0 > 0}, J45 > 0: {new_j45 > 0}')
|
110 |
+
st.write(f'Quadrant adjustment: {90 if new_j0 < 0 else 0}°')
|
111 |
+
st.write(f'Final modulo operation: {predicted_axis % 180:.1f}°')
|
112 |
else:
|
113 |
st.error('Please ensure all inputs are within the specified ranges.')
|
114 |
|