-
Notifications
You must be signed in to change notification settings - Fork 0
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
Handle vehicle mode with custom filtered backstop #421
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
from chandra_aca.transform import mag_to_count_rate, pixels_to_yagzag, yagzag_to_pixels | ||
from kadi.commands import states | ||
from mica.archive import aca_dark | ||
from parse_cm import read_backstop_as_list, write_backstop | ||
from proseco.catalog import get_aca_catalog, get_effective_t_ccd | ||
from proseco.core import ACABox | ||
from proseco.guide import get_imposter_mags | ||
|
@@ -543,3 +544,20 @@ def proseco_probs(**kw): | |
] | ||
|
||
return p_acqs, float(-np.log10(acq_cat.calc_p_safe())), float(np.sum(p_acqs)) | ||
|
||
|
||
def vehicle_filter_backstop(backstop_file, outfile): | ||
""" | ||
Filter the backstop file to remove SCS 131, 132, 133 except MP_OBSID commands. | ||
This is basically equivalent to the vehicle backstop file, but the MP_OBSID | ||
commands are useful for ACA to associate maneuvers with observations. | ||
""" | ||
# Use parse_cm read_backstop_as_list instead of kadi.commands.read_backstop | ||
# as we want the params to keep the SCS to write back later. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @taldcroft as I was in a bit of a hurry I didn't dig much into this, but to me it made more sense to use the validated and tagged read-in backstop instead of a grep of some kind in the file. But then if writing out a backstop, it seemed to make sense to use write_backstop... which seemed to have the params it wanted if I used parse_cm's own methods for reading backstop instead of the kadi versions. |
||
cmds = read_backstop_as_list(backstop_file, inline_params=False) | ||
# Filter the commands to remove SCS 131, 132, 133 except MP_OBSID commands | ||
filtered_cmds = [cmd for cmd in cmds | ||
if cmd["scs"] < 131 | ||
or cmd["type"] == "MP_OBSID"] | ||
# Write the filtered commands to the output file | ||
write_backstop(filtered_cmds, outfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we'd add a unit test for this function, but given the impact I think it can probably go with functional testing.