-
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
Add includes_for_obsid helper function #311
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 |
---|---|---|
|
@@ -1450,3 +1450,34 @@ def get_kwargs_from_starcheck_text(obs_text, include_cat=False, force_catalog=Fa | |
pass | ||
|
||
return kw | ||
|
||
|
||
def includes_for_obsid(obsid): | ||
""" | ||
Return a dict with the include_ids_acq, include_halfws_acq and include_ids_guide | ||
lists for the as-run flight catalog of ``obsid``. Useful for forcing catalog. | ||
|
||
Example:: | ||
|
||
>>> from proseco import get_aca_catalog | ||
>>> from proseco.core import includes_for_obsid | ||
>>> obsid = 8008 | ||
>>> aca = get_aca_catalog(obsid, **includes_for_obsid(obsid)) | ||
|
||
:param obsid: int, obsid | ||
""" | ||
from mica.starcheck import get_starcheck_catalog | ||
|
||
obs = get_starcheck_catalog(obsid) | ||
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. Could use get_starcat here but get_starcheck_catalog is fine. |
||
|
||
cat = obs['cat'] | ||
out = {} | ||
|
||
ok = np.in1d(cat['type'], ('ACQ', 'BOT')) | ||
out['include_ids_acq'] = cat['id'][ok].tolist() | ||
out['include_halfws_acq'] = cat['halfw'][ok].tolist() | ||
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. This looks good as I don't see any way the ids and the halfwidths can end up with mismatched indexes. |
||
|
||
ok = np.in1d(cat['type'], ('GUI', 'BOT')) | ||
out['include_ids_guide'] = cat['id'][ok].tolist() | ||
|
||
return out |
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.
I note that get_starcheck_catalog has both as-run catalogs and has ingested latest-version catalogs for obsids that haven't actually run yet. But that does not apply to this PR.