hey assistent I have this def stopapproachphase(starttime, gradient): t80dmax =…
- User
hey assistent I have this def stop_approach_phase(start_time, gradient): t80_dmax = start_time + T80 dmax_80 = 0.8 * DMAX if G1s < dmax_80: gradient_80 = (dmax_80 - DMAX) / (t80_dmax - start_time) length = abs(DMAX) / abs(gradient_80) x_values = np.linspace(start_time, start_time + length, FREQ) normalized_x = np.linspace(-1, 0, FREQ) scaled_atan = np.arctan(10 * normalized_x) atan_min, atan_max = scaled_atan.min(), scaled_atan.max() y_values = DMAX + (scaled_atan - atan_min) / (atan_max - atan_min) * (-DMAX)
return x_values, y_values, [], [], t80_dmax, dmax_80 but is not quite good. the point t80 with it's x(t80_dmax) and y(dmax_80) is not on the curve. I think I need another function that with the gradient goes from the start point(Dmax) threw t80 and then straight to the end - Assistant
- User
ok is not entierly corect, from DMax to t80 is the graph with gradient_80 but then from t80 to the end is the gradient from input
- Assistant
- User
it is good indeed but hte values of y_values_first are not. the function is liniar based on the gradient. I want the full graph to have a rounded bottom, like acurve that goes from dmax to t80 and then straight to the end (witch is now correct)
- Assistant
- User
now the y_values_first look more like an upside down S, I want to be only a curve
- Assistant
- User
this is my function def stop_approach_phase(start_time, gradient): t80_dmax = start_time + T80 dmax_80 = 0.8 * DMAX gradient_80 = (dmax_80 - DMAX) / (t80_dmax - start_time) remainder_time = dmax_80 / gradient
num_points_first = FREQ // 2 x_values_first = np.linspace(start_time, t80_dmax, num_points_first) normalized_x = (x_values_first - start_time) / T80 y_values_first = DMAX - (DMAX - dmax_80) * (normalized_x**2) num_points_second = FREQ - num_points_first x_values_second = np.linspace( t80_dmax, t80_dmax + remainder_time, num_points_second ) y_values_second = dmax_80 + -gradient * (x_values_second - t80_dmax) x_values = np.concatenate((x_values_first, x_values_second)) y_values = np.concatenate((y_values_first, y_values_second)) return x_values, y_values, [], [], t80_dmax, dmax_80 but I don't see where graident_80 is used - Assistant