-
Notifications
You must be signed in to change notification settings - Fork 3
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 starcat_date argument to get_observations, get_starcats and get_s… #241
Conversation
Looking at cases where there is more than one OBSID per catalog, I found OBSID 2983 and 2748, which one gets with:
and it turns out that OBSID 2983 has two separate catalogs:
The first one is not a real catalog. What's the deal with this one?
|
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.
Some minor comments, otherwise looks good.
@@ -302,6 +303,7 @@ def get_starcats(start=None, stop=None, *, obsid=None, scenario=None, | |||
the archive. | |||
:param as_dict: bool, False Return a list of dictionaries instead of a list | |||
of ACATable objects. | |||
:param starcat_date: CxoTime-like, None |
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.
Needs a description.
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.
Fixed.
@@ -217,11 +217,12 @@ def get_starcats_as_table(start=None, stop=None, *, obsid=None, unique=False, | |||
:param scenario: str, None Scenario | |||
:param cmds: CommandTable, None Use this command table instead of querying | |||
the archive. | |||
:param starcat_date: CxoTime-like, None |
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.
Needs description.
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.
Fixed.
""" | ||
sc = get_starcats(obsid=8008, scenario='flight')[0] | ||
sc_by_date = get_starcats(starcat_date='2007:002:04:31:43.965', scenario='flight')[0] | ||
assert np.all(sc == sc_by_date) |
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.
If you want full coverage of your new code you need to check the case of also supplying start
and/or stop
, along with raising an exception from no match. I'm not adamant on this.
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 added a test for the exception
Description
The starcat_date is effectively the catalog's unique ID, so it would be convenient to be able to fetch a catalog given starcat_date. This PR does that: it adds a
starcat_date
argument toget_observations
,get_starcats
andget_starcats_as_table
.If the starcat_date argument is given, the start time defaults to starcat_date and the stop time defaults to starcat_date + 7 days.
I have not checked, but in principle one can have multiple observations with the same catalog, right? It would be nice to check in those cases.
Interface impacts
Add one optional argument to three functions. This should not affect any existing code.
Testing
A unit test was added to check this functionality on a simple case
Unit tests
Independent check of unit tests by [REVIEWER NAME]
Functional tests