Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue always logging about NSM during maneuver #277

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions kadi/commands/commands_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def get_cmds_obs_from_manvrs(cmds, prev_att=None):
f"NSM at {nsm_date} happened during maneuver preceding"
f" obs\n{cmd}"
)
log_context_obs(cmds, cmd)
log_context_obs(cmds, cmd, log_level="info")
bad_idxs.append(ii)
if bad_idxs:
logger.info(f"Removing obss at {bad_idxs}")
Expand Down Expand Up @@ -820,12 +820,13 @@ def get_cmds_obs_final(cmds, pars_dict, rev_pars_dict, schedule_stop_time):
return cmds_obs


def log_context_obs(cmds, cmd, before=3600, after=3600):
def log_context_obs(cmds, cmd, before=3600, after=3600, log_level="warning"):
"""Log commands before and after ``cmd``"""
date_before = (CxoTime(cmd["date"]) - before * u.s).date
date_after = (CxoTime(cmd["date"]) + after * u.s).date
ok = (cmds["date"] >= date_before) & (cmds["date"] <= date_after)
logger.warning(f"\n{cmds[ok]}")
log_func = getattr(logger, log_level)
log_func(f"\n{cmds[ok]}")


def is_google_id(scenario):
Expand Down