present diagnostics for speed limit issues, allow application to continue
@@ -73,7 +73,7 @@ def make_icom_angles_continuous(icom_datasets):
COLLIMATOR_EXPECTED_SPEED_LIMIT * NOISE_BUFFER_FACTOR,
)
- angle_speed_check(icom_datasets)
+ # angle_speed_check(icom_datasets)
return icom_datasets
@@ -127,13 +127,54 @@ def attempt_to_make_angles_continuous(
range_iter=0.1,
):
if init_range_to_adjust > max_range:
- st.write(times)
- st.write(angles)
- df = pd.concat([times, pd.Series(angles, name="angle")], axis=1)
+ st.error(
+ "Unable to automatically convert the iCom data to bipolar. "
+ "Below are some diagnostic outputs to help get to the "
+ "root cause of the issue."
+ )
- # alt.Chart()
+ st.info(
+ f"""
+ iCom data is converted to bipolar by making an assumption
+ that the angle movement is unable to go above a certain
+ RPM. If this error has occurred it is because no sign
+ adjustment combination for the provided data was able to
+ be found that brings the RPM to less than `{speed_limit}`.
+ Below is a plot of the provided data with the data coloured
+ by its RPM.
+ """
+ )
+ rpm = determine_speed(angles, times)
+ df = pd.concat(
+ [
+ times,
+ pd.Series(angles, name="angle"),
+ pd.Series(rpm, name="rpm"),
+ ],
+ axis=1,
+ )
st.write(df)
- raise ValueError("The adjustment range was larger than the maximum")
+
+ chart = (
+ alt.Chart(df)
+ .mark_circle()
+ .encode(
+ x="datetime:T",
+ y="angle:Q",
+ color="rpm:Q",
+ tooltip=["datetime", "angle", "rpm"],
+ )
+ .interactive(bind_y=False)
+ )
+ st.altair_chart(chart, use_container_width=True)
+
+ st.error(
+ "The WLutz analysis will now continue with this angle 'jump' "
+ "in-place. Be aware that this brings into question the sign "
+ "of the angle determination in the vicinity of the high RPM regions "
+ "presented in the above plot."
+ )
+ return angles
within_adjustment_range = np.abs(angles) >= 180 - init_range_to_adjust
outside_adjustment_range = np.invert(within_adjustment_range)
