Dashboard is failing in prod but works locally
m, b = np.polyfit(relative_positions, estimated_1rm_scaled, 1) ValueError: On entry to DLASCL parameter number 4 had an illegal value
This commit is contained in:
17
utils.py
17
utils.py
@@ -249,12 +249,17 @@ def get_exercise_graph_model(title, estimated_1rm, repetitions, weight, start_da
|
|||||||
|
|
||||||
best_fit_points = []
|
best_fit_points = []
|
||||||
try:
|
try:
|
||||||
# Calculate line of best fit using NumPy
|
if len(relative_positions) > 1: # Ensure there are enough points for polyfit
|
||||||
m, b = np.polyfit(relative_positions, estimated_1rm_scaled, 1)
|
# Calculate line of best fit using NumPy
|
||||||
y_best_fit = m * relative_positions + b
|
m, b = np.polyfit(relative_positions, estimated_1rm_scaled, 1)
|
||||||
best_fit_points = list(zip(y_best_fit.tolist(), relative_positions.tolist()))
|
y_best_fit = m * relative_positions + b
|
||||||
except np.linalg.LinAlgError:
|
best_fit_points = list(zip(y_best_fit.tolist(), relative_positions.tolist()))
|
||||||
pass
|
else:
|
||||||
|
raise ValueError("Not enough data points for polyfit")
|
||||||
|
except (np.linalg.LinAlgError, ValueError) as e:
|
||||||
|
# Handle cases where polyfit fails
|
||||||
|
best_fit_points = []
|
||||||
|
m, b = 0, 0
|
||||||
|
|
||||||
# Prepare data for plots
|
# Prepare data for plots
|
||||||
repetitions_data = {
|
repetitions_data = {
|
||||||
|
|||||||
Reference in New Issue
Block a user