diff --git a/ruff-base.toml b/ruff-base.toml index d9054f15..8e9a25a8 100644 --- a/ruff-base.toml +++ b/ruff-base.toml @@ -41,6 +41,8 @@ lint.ignore = [ "B028", # No explicit `stacklevel` keyword argument found "PLR0913", # Too many arguments to function call "PLR1730", # Checks for if statements that can be replaced with min() or max() calls + "PLC0415", # `import` should be at the top-level of a file + "PLW1641", # Class implements `__hash__` if `__eq__` is implemented ] extend-exclude = [ diff --git a/starcheck/src/lib/Ska/Starcheck/Obsid.pm b/starcheck/src/lib/Ska/Starcheck/Obsid.pm index 774b7d3f..3e1b2804 100644 --- a/starcheck/src/lib/Ska/Starcheck/Obsid.pm +++ b/starcheck/src/lib/Ska/Starcheck/Obsid.pm @@ -729,7 +729,10 @@ sub check_dither { # and such observations could end in larger roll errors. Check added in PR #452. # Operationally, we also do not expect to use, for example, 4x4 dither, so this # adds a CAUTION for unexpected small dither patterns. - my $creep_away = ($man_angle_next_data->{"angle"} < 5.0); + + # Round the angle_next to 1 decimal place + my $angle_next = sprintf("%.1f", $man_angle_next_data->{"angle"}); + my $creep_away = ($angle_next < 3.0); my $no_dither = (($guide_dither->{state} eq 'DISA') or (($guide_dither->{ampl_y_int} == 0) and ($guide_dither->{ampl_p_int}== 0))); my $small_dither = (($guide_dither->{ampl_y_int} < 8) and ($guide_dither->{ampl_p_int} < 8) diff --git a/starcheck/state_checks.py b/starcheck/state_checks.py index 61c926bf..19d17151 100644 --- a/starcheck/state_checks.py +++ b/starcheck/state_checks.py @@ -29,7 +29,7 @@ def make_man_table(): # Use a range of angles that sample the curve pretty well by eye # The duration function is a little slow and not vectorized, so # this is sparse. - angles = [0, 5, 10, 15, 20, 25, 35, 50, 100, 150, 180] + angles = [0, 3, 5, 10, 15, 20, 25, 35, 50, 100, 150, 180] for angle in angles: q1 = Quat(equatorial=(angle, 0, 0)) durations.append(duration(q0, q1)) @@ -171,8 +171,9 @@ def get_obs_man_angle(npnt_tstart, backstop_file): if np.abs(CxoTime(npnt_tstart).secs - prev_state["tstop"]) > 600: warn = f"Maneuver angle err - no manvr ends within 600s of {CxoTime(npnt_tstart).date}\n" return {"angle": 180, "warn": warn} - dur = prev_state["tstop"] - prev_state["tstart"] - angle = calc_man_angle_for_duration(dur) + nmm_dur = prev_state["tstop"] - prev_state["tstart"] + manvr_dur = nmm_dur - 10.25 # subtract standard time between AONMMODE and AOMANUVR + angle = calc_man_angle_for_duration(manvr_dur) return {"angle": angle} @@ -188,6 +189,7 @@ def get_obs_man_angle_next(npnt_tstart, backstop_file): if next_state is None: warn = f"No NMAN state after {CxoTime(npnt_tstart).date}\n" return {"angle": 180, "warn": warn} - dur = next_state["tstop"] - next_state["tstart"] - angle = calc_man_angle_for_duration(dur) + nmm_dur = next_state["tstop"] - next_state["tstart"] + manvr_dur = nmm_dur - 10.25 # subtract standard time between AONMMODE and AOMANUVR + angle = calc_man_angle_for_duration(manvr_dur) return {"angle": angle}